blob: 63c2dc4da6cccdcdaedc60e2312e36b532c5dd15 [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86.td - Target definition file for the Intel X86 --*- tablegen -*-===//
Michael J. Spencerb88784c2011-04-14 14:33:36 +00002//
John Criswell29265fe2003-10-21 15:17:13 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Michael J. Spencerb88784c2011-04-14 14:33:36 +00007//
John Criswell29265fe2003-10-21 15:17:13 +00008//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +00009//
Craig Topper271064e2011-10-11 06:44:02 +000010// This is a target description file for the Intel i386 architecture, referred
11// to here as the "X86" architecture.
Chris Lattner5da8e802003-08-03 15:47:49 +000012//
13//===----------------------------------------------------------------------===//
14
Chris Lattner25510802003-08-04 04:59:56 +000015// Get the target-independent interfaces which we are implementing...
Chris Lattner5da8e802003-08-03 15:47:49 +000016//
Evan Cheng977e7be2008-11-24 07:34:46 +000017include "llvm/Target/Target.td"
Chris Lattner5da8e802003-08-03 15:47:49 +000018
19//===----------------------------------------------------------------------===//
Anitha Boyapati426feb62012-08-16 03:50:04 +000020// X86 Subtarget state
Evan Cheng13bcc6c2011-07-07 21:06:52 +000021//
22
23def Mode64Bit : SubtargetFeature<"64bit-mode", "In64BitMode", "true",
24 "64-bit mode (x86_64)">;
Craig Topper3c80d622014-01-06 04:55:54 +000025def Mode32Bit : SubtargetFeature<"32bit-mode", "In32BitMode", "true",
26 "32-bit mode (80386)">;
27def Mode16Bit : SubtargetFeature<"16bit-mode", "In16BitMode", "true",
28 "16-bit mode (i8086)">;
Evan Cheng13bcc6c2011-07-07 21:06:52 +000029
30//===----------------------------------------------------------------------===//
Anitha Boyapati426feb62012-08-16 03:50:04 +000031// X86 Subtarget features
Bill Wendlinge6182262007-05-04 20:38:40 +000032//===----------------------------------------------------------------------===//
Chris Lattnercc8c5812009-09-02 05:53:04 +000033
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +000034def FeatureX87 : SubtargetFeature<"x87","HasX87", "true",
35 "Enable X87 float instructions">;
36
Craig Topper505f38a2018-01-10 22:07:16 +000037def FeatureNOPL : SubtargetFeature<"nopl", "HasNOPL", "true",
38 "Enable NOPL instruction">;
39
Chris Lattnercc8c5812009-09-02 05:53:04 +000040def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
41 "Enable conditional move instructions">;
42
Benjamin Kramer2f489232010-12-04 20:32:23 +000043def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
44 "Support POPCNT instruction">;
45
Craig Topper09b65982015-10-16 06:03:09 +000046def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
47 "Support fxsave/fxrestore instructions">;
48
Amjad Aboud1db6d7a2015-10-12 11:47:46 +000049def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
50 "Support xsave instructions">;
51
52def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
53 "Support xsaveopt instructions">;
54
55def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
56 "Support xsavec instructions">;
57
58def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
59 "Support xsaves instructions">;
60
Bill Wendlinge6182262007-05-04 20:38:40 +000061def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
62 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000063 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000064 // SSE1+ processors support them.
Eric Christopher11e59832015-10-08 20:10:06 +000065 [FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000066def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
67 "Enable SSE2 instructions",
68 [FeatureSSE1]>;
69def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
70 "Enable SSE3 instructions",
71 [FeatureSSE2]>;
72def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
73 "Enable SSSE3 instructions",
74 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000075def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000076 "Enable SSE 4.1 instructions",
77 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000078def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000079 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000080 [FeatureSSE41]>;
Eric Christopher57a6e132015-11-14 03:04:00 +000081// The MMX subtarget feature is separate from the rest of the SSE features
82// because it's important (for odd compatibility reasons) to be able to
83// turn it off explicitly while allowing SSE+ to be on.
84def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
85 "Enable MMX instructions">;
Bill Wendlinge6182262007-05-04 20:38:40 +000086def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000087 "Enable 3DNow! instructions",
88 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000089def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000090 "Enable 3DNow! Athlon instructions",
91 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000092// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
93// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
94// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000095def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000096 "Support 64-bit instructions",
97 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000098def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000099 "64-bit with cmpxchg16b",
100 [Feature64Bit]>;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000101def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
102 "SHLD instruction is slow">;
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000103def FeatureSlowPMULLD : SubtargetFeature<"slow-pmulld", "IsPMULLDSlow", "true",
104 "PMULLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +0000105// FIXME: This should not apply to CPUs that do not have SSE.
106def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
107 "IsUAMem16Slow", "true",
108 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000109def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000110 "IsUAMem32Slow", "true",
111 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000112def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000113 "Support SSE 4a instructions",
114 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000115
Craig Topperf287a452012-01-09 09:02:13 +0000116def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
117 "Enable AVX instructions",
118 [FeatureSSE42]>;
119def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000120 "Enable AVX2 instructions",
121 [FeatureAVX]>;
Craig Toppercb6c3862017-11-06 22:49:01 +0000122def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
123 "Enable three-operand fused multiple-add",
124 [FeatureAVX]>;
Craig Topper428a4e62017-11-06 22:49:04 +0000125def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
126 "Support 16-bit floating point conversion instructions",
127 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000128def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000129 "Enable AVX-512 instructions",
Craig Topper428a4e62017-11-06 22:49:04 +0000130 [FeatureAVX2, FeatureFMA, FeatureF16C]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000131def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000132 "Enable AVX-512 Exponential and Reciprocal Instructions",
133 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000134def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000135 "Enable AVX-512 Conflict Detection Instructions",
136 [FeatureAVX512]>;
Oren Ben Simhon7bf27f02017-05-25 13:45:23 +0000137def FeatureVPOPCNTDQ : SubtargetFeature<"avx512vpopcntdq", "HasVPOPCNTDQ",
138 "true", "Enable AVX-512 Population Count Instructions",
139 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000140def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000141 "Enable AVX-512 PreFetch Instructions",
142 [FeatureAVX512]>;
Craig Toppere2685982017-12-22 02:30:30 +0000143def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPREFETCHWT1",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000144 "true",
145 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000146def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
147 "Enable AVX-512 Doubleword and Quadword Instructions",
148 [FeatureAVX512]>;
149def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
150 "Enable AVX-512 Byte and Word Instructions",
151 [FeatureAVX512]>;
152def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
153 "Enable AVX-512 Vector Length eXtensions",
154 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000155def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
Craig Topper5c842be2016-11-09 04:50:48 +0000156 "Enable AVX-512 Vector Byte Manipulation Instructions",
157 [FeatureBWI]>;
Coby Tayree71e37cc2017-11-21 09:48:44 +0000158def FeatureVBMI2 : SubtargetFeature<"avx512vbmi2", "HasVBMI2", "true",
159 "Enable AVX-512 further Vector Byte Manipulation Instructions",
160 [FeatureBWI]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000161def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000162 "Enable AVX-512 Integer Fused Multiple-Add",
163 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000164def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
165 "Enable protection keys">;
Coby Tayree3880f2a2017-11-21 10:04:28 +0000166def FeatureVNNI : SubtargetFeature<"avx512vnni", "HasVNNI", "true",
167 "Enable AVX-512 Vector Neural Network Instructions",
168 [FeatureAVX512]>;
Coby Tayree5c7fe5d2017-11-21 10:32:42 +0000169def FeatureBITALG : SubtargetFeature<"avx512bitalg", "HasBITALG", "true",
170 "Enable AVX-512 Bit Algorithms",
171 [FeatureBWI]>;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000172def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
173 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000174 [FeatureSSE2]>;
Coby Tayreed8b17be2017-11-26 09:36:41 +0000175def FeatureGFNI : SubtargetFeature<"gfni", "HasGFNI", "true",
176 "Enable Galois Field Arithmetic Instructions",
177 [FeatureSSE2]>;
Coby Tayree7ca5e5872017-11-21 09:30:33 +0000178def FeatureVPCLMULQDQ : SubtargetFeature<"vpclmulqdq", "HasVPCLMULQDQ", "true",
179 "Enable vpclmulqdq instructions",
180 [FeatureAVX, FeaturePCLMUL]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000181def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000182 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000183 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000184def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000185 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000186 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000187def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
188 "HasSSEUnalignedMem", "true",
189 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000190def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000191 "Enable AES instructions",
192 [FeatureSSE2]>;
Coby Tayree2a1c02f2017-11-21 09:11:41 +0000193def FeatureVAES : SubtargetFeature<"vaes", "HasVAES", "true",
194 "Promote selected AES instructions to AVX512/AVX registers",
195 [FeatureAVX, FeatureAES]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000196def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
197 "Enable TBM instructions">;
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000198def FeatureLWP : SubtargetFeature<"lwp", "HasLWP", "true",
199 "Enable LWP instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000200def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
201 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000202def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000203 "Support RDRAND instruction">;
Craig Topper228d9132011-10-30 19:57:21 +0000204def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
205 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000206def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
207 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000208def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
209 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000210def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
211 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000212def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
213 "Support RTM instructions">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000214def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
215 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000216def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
217 "Enable SHA instructions",
218 [FeatureSSE2]>;
Oren Ben Simhonfa582b02017-11-26 13:02:45 +0000219def FeatureSHSTK : SubtargetFeature<"shstk", "HasSHSTK", "true",
220 "Support CET Shadow-Stack instructions">;
Michael Liao5173ee02013-03-26 17:47:11 +0000221def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
222 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000223def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
224 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000225def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
226 "Support LAHF and SAHF instructions">;
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000227def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
228 "Enable MONITORX/MWAITX timer functionality">;
Craig Topper50f3d142017-02-09 04:27:34 +0000229def FeatureCLZERO : SubtargetFeature<"clzero", "HasCLZERO", "true",
230 "Enable Cache Line Zero">;
Gabor Buella604be442018-04-13 07:35:08 +0000231def FeatureCLDEMOTE : SubtargetFeature<"cldemote", "HasCLDEMOTE", "true",
232 "Enable Cache Demote">;
Gabor Buellaa832b222018-05-10 07:26:05 +0000233def FeaturePTWRITE : SubtargetFeature<"ptwrite", "HasPTWRITE", "true",
234 "Support ptwrite instruction">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000235def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
236 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000237def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000238 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000239def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
240 "HasSlowDivide32", "true",
241 "Use 8-bit divide for positive values less than 256">;
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000242def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divl",
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000243 "HasSlowDivide64", "true",
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000244 "Use 32-bit divide for positive values less than 2^32">;
Preston Gurda01daac2013-01-08 18:27:24 +0000245def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
246 "PadShortFunctions", "true",
247 "Pad short functions">;
Gabor Buellad2f1ab12018-05-25 06:32:05 +0000248def FeatureINVPCID : SubtargetFeature<"invpcid", "HasINVPCID", "true",
249 "Invalidate Process-Context Identifier">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000250def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
251 "Enable Software Guard Extensions">;
252def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
253 "Flush A Cache Line Optimized">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000254def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
255 "Cache Line Write Back">;
Gabor Buella2ef36f32018-04-11 20:01:57 +0000256def FeatureWBNOINVD : SubtargetFeature<"wbnoinvd", "HasWBNOINVD", "true",
257 "Write Back No Invalidate">;
Craig Topper84b26b92018-01-18 23:52:31 +0000258def FeatureRDPID : SubtargetFeature<"rdpid", "HasRDPID", "true",
259 "Support RDPID instructions">;
Gabor Buella31fa8022018-04-20 18:42:47 +0000260def FeatureWAITPKG : SubtargetFeature<"waitpkg", "HasWAITPKG", "true",
261 "Wait and pause enhancements">;
Craig Topper62c47a22017-08-29 05:14:27 +0000262// On some processors, instructions that implicitly take two memory operands are
263// slow. In practice, this means that CALL, PUSH, and POP with memory operands
264// should be avoided in favor of a MOV + register CALL/PUSH/POP.
265def FeatureSlowTwoMemOps : SubtargetFeature<"slow-two-mem-ops",
266 "SlowTwoMemOps", "true",
267 "Two memory operand instructions are slow">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000268def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
269 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000270def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
271 "LEA instruction with certain arguments is slow">;
Lama Saba2ea271b2017-05-18 08:11:50 +0000272def FeatureSlow3OpsLEA : SubtargetFeature<"slow-3ops-lea", "Slow3OpsLEA", "true",
273 "LEA instruction with 3 ops or certain registers is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000274def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
275 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000276def FeatureSoftFloat
277 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
278 "Use software floating point features.">;
Marina Yatsina77a21db2018-01-22 10:07:01 +0000279def FeaturePOPCNTFalseDeps : SubtargetFeature<"false-deps-popcnt",
280 "HasPOPCNTFalseDeps", "true",
281 "POPCNT has a false dependency on dest register">;
282def FeatureLZCNTFalseDeps : SubtargetFeature<"false-deps-lzcnt-tzcnt",
283 "HasLZCNTFalseDeps", "true",
284 "LZCNT/TZCNT have a false dependency on dest register">;
Gabor Buella2b5e9602018-05-08 06:47:36 +0000285def FeaturePCONFIG : SubtargetFeature<"pconfig", "HasPCONFIG", "true",
286 "platform configuration instruction">;
Simon Pilgrimfd5df632017-12-19 13:16:43 +0000287// On recent X86 (port bound) processors, its preferable to combine to a single shuffle
288// using a variable mask over multiple fixed shuffles.
289def FeatureFastVariableShuffle
290 : SubtargetFeature<"fast-variable-shuffle",
291 "HasFastVariableShuffle",
292 "true", "Shuffles with variable masks are fast">;
Amjad Aboud4f977512017-03-03 09:03:24 +0000293// On some X86 processors, there is no performance hazard to writing only the
294// lower parts of a YMM or ZMM register without clearing the upper part.
295def FeatureFastPartialYMMorZMMWrite
296 : SubtargetFeature<"fast-partial-ymm-or-zmm-write",
297 "HasFastPartialYMMorZMMWrite",
298 "true", "Partial writes to YMM/ZMM registers are fast">;
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000299// FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
300// than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
301// vector FSQRT has higher throughput than the corresponding NR code.
302// The idea is that throughput bound code is likely to be vectorized, so for
303// vectorized code we should care about the throughput of SQRT operations.
304// But if the code is scalar that probably means that the code has some kind of
305// dependency and we should care more about reducing the latency.
306def FeatureFastScalarFSQRT
307 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
308 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
309def FeatureFastVectorFSQRT
310 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
311 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000312// If lzcnt has equivalent latency/throughput to most simple integer ops, it can
313// be used to replace test/set sequences.
314def FeatureFastLZCNT
315 : SubtargetFeature<
316 "fast-lzcnt", "HasFastLZCNT", "true",
317 "LZCNT instructions are as fast as most simple integer ops">;
Simon Pilgrim02bdac52018-01-29 21:24:31 +0000318// If the target can efficiently decode NOPs upto 11-bytes in length.
319def FeatureFast11ByteNOP
320 : SubtargetFeature<
321 "fast-11bytenop", "HasFast11ByteNOP", "true",
322 "Target can quickly decode up to 11 byte NOPs">;
323// If the target can efficiently decode NOPs upto 15-bytes in length.
324def FeatureFast15ByteNOP
325 : SubtargetFeature<
326 "fast-15bytenop", "HasFast15ByteNOP", "true",
327 "Target can quickly decode up to 15 byte NOPs">;
Craig Topperd88389a2017-02-21 06:39:13 +0000328// Sandy Bridge and newer processors can use SHLD with the same source on both
329// inputs to implement rotate to avoid the partial flag update of the normal
330// rotate instructions.
331def FeatureFastSHLDRotate
332 : SubtargetFeature<
333 "fast-shld-rotate", "HasFastSHLDRotate", "true",
334 "SHLD can be used as a faster rotate">;
335
Clement Courbet203fc172017-04-21 09:20:50 +0000336// Ivy Bridge and newer processors have enhanced REP MOVSB and STOSB (aka
337// "string operations"). See "REP String Enhancement" in the Intel Software
Clement Courbet41b43332017-04-21 09:21:05 +0000338// Development Manual. This feature essentially means that REP MOVSB will copy
Clement Courbet203fc172017-04-21 09:20:50 +0000339// using the largest available size instead of copying bytes one by one, making
340// it at least as fast as REPMOVS{W,D,Q}.
341def FeatureERMSB
Clement Courbet1ce3b822017-04-21 09:20:39 +0000342 : SubtargetFeature<
Clement Courbet203fc172017-04-21 09:20:50 +0000343 "ermsb", "HasERMSB", "true",
Clement Courbet1ce3b822017-04-21 09:20:39 +0000344 "REP MOVS/STOS are fast">;
345
Craig Topper641e2af2017-08-30 04:34:48 +0000346// Sandy Bridge and newer processors have many instructions that can be
347// fused with conditional branches and pass through the CPU as a single
348// operation.
349def FeatureMacroFusion
350 : SubtargetFeature<"macrofusion", "HasMacroFusion", "true",
351 "Various instructions can be fused with conditional branches">;
352
Craig Topperea37e202017-11-25 18:09:37 +0000353// Gather is available since Haswell (AVX2 set). So technically, we can
354// generate Gathers on all AVX2 processors. But the overhead on HSW is high.
355// Skylake Client processor has faster Gathers than HSW and performance is
356// similar to Skylake Server (AVX-512).
357def FeatureHasFastGather
358 : SubtargetFeature<"fast-gather", "HasFastGather", "true",
359 "Indicates if gather is reasonably fast.">;
360
Craig Topper0d797a32018-01-20 00:26:08 +0000361def FeaturePrefer256Bit
362 : SubtargetFeature<"prefer-256-bit", "Prefer256Bit", "true",
363 "Prefer 256-bit AVX instructions">;
364
Chandler Carruthc58f2162018-01-22 22:05:25 +0000365// Enable mitigation of some aspects of speculative execution related
366// vulnerabilities by removing speculatable indirect branches. This disables
367// jump-table formation, rewrites explicit `indirectbr` instructions into
368// `switch` instructions, and uses a special construct called a "retpoline" to
369// prevent speculation of the remaining indirect branches (indirect calls and
370// tail calls).
371def FeatureRetpoline
372 : SubtargetFeature<"retpoline", "UseRetpoline", "true",
373 "Remove speculation of indirect branches from the "
374 "generated code, either by avoiding them entirely or "
375 "lowering them with a speculation blocking construct.">;
376
377// Rely on external thunks for the emitted retpoline calls. This allows users
378// to provide their own custom thunk definitions in highly specialized
379// environments such as a kernel that does boot-time hot patching.
380def FeatureRetpolineExternalThunk
381 : SubtargetFeature<
382 "retpoline-external-thunk", "UseRetpolineExternalThunk", "true",
383 "Enable retpoline, but with an externally provided thunk.",
384 [FeatureRetpoline]>;
385
Gabor Buellac8ded042018-05-01 10:01:16 +0000386// Direct Move instructions.
387def FeatureMOVDIRI : SubtargetFeature<"movdiri", "HasMOVDIRI", "true",
388 "Support movdiri instruction">;
389def FeatureMOVDIR64B : SubtargetFeature<"movdir64b", "HasMOVDIR64B", "true",
390 "Support movdir64b instruction">;
391
Evan Chengff1beda2006-10-06 09:17:41 +0000392//===----------------------------------------------------------------------===//
Craig Topper57c28152017-12-10 17:42:36 +0000393// Register File Description
394//===----------------------------------------------------------------------===//
395
396include "X86RegisterInfo.td"
397include "X86RegisterBanks.td"
398
399//===----------------------------------------------------------------------===//
400// Instruction Descriptions
Evan Chengff1beda2006-10-06 09:17:41 +0000401//===----------------------------------------------------------------------===//
402
Andrew Trick8523b162012-02-01 23:20:51 +0000403include "X86Schedule.td"
Craig Topper57c28152017-12-10 17:42:36 +0000404include "X86InstrInfo.td"
Andrea Di Biagiob6022aa2018-07-19 16:42:15 +0000405include "X86SchedPredicates.td"
Craig Topper57c28152017-12-10 17:42:36 +0000406
407def X86InstrInfo : InstrInfo;
408
409//===----------------------------------------------------------------------===//
410// X86 processors supported.
411//===----------------------------------------------------------------------===//
412
413include "X86ScheduleAtom.td"
414include "X86SchedSandyBridge.td"
415include "X86SchedHaswell.td"
416include "X86SchedBroadwell.td"
417include "X86ScheduleSLM.td"
418include "X86ScheduleZnver1.td"
419include "X86ScheduleBtVer2.td"
420include "X86SchedSkylakeClient.td"
421include "X86SchedSkylakeServer.td"
Andrew Trick8523b162012-02-01 23:20:51 +0000422
423def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
424 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000425def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
426 "Intel Silvermont processors">;
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000427def ProcIntelGLM : SubtargetFeature<"glm", "X86ProcFamily", "IntelGLM",
428 "Intel Goldmont processors">;
Gabor Buella8f1646b2018-04-16 07:47:35 +0000429def ProcIntelGLP : SubtargetFeature<"glp", "X86ProcFamily", "IntelGLP",
430 "Intel Goldmont Plus processors">;
431def ProcIntelTRM : SubtargetFeature<"tremont", "X86ProcFamily", "IntelTRM",
432 "Intel Tremont processors">;
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000433def ProcIntelHSW : SubtargetFeature<"haswell", "X86ProcFamily",
434 "IntelHaswell", "Intel Haswell processors">;
435def ProcIntelBDW : SubtargetFeature<"broadwell", "X86ProcFamily",
436 "IntelBroadwell", "Intel Broadwell processors">;
437def ProcIntelSKL : SubtargetFeature<"skylake", "X86ProcFamily",
438 "IntelSkylake", "Intel Skylake processors">;
439def ProcIntelKNL : SubtargetFeature<"knl", "X86ProcFamily",
440 "IntelKNL", "Intel Knights Landing processors">;
441def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily",
442 "IntelSKX", "Intel Skylake Server processors">;
443def ProcIntelCNL : SubtargetFeature<"cannonlake", "X86ProcFamily",
444 "IntelCannonlake", "Intel Cannonlake processors">;
Gabor Buella213edc42018-04-10 18:59:13 +0000445def ProcIntelICL : SubtargetFeature<"icelake-client", "X86ProcFamily",
446 "IntelIcelakeClient", "Intel Icelake processors">;
447def ProcIntelICX : SubtargetFeature<"icelake-server", "X86ProcFamily",
448 "IntelIcelakeServer", "Intel Icelake Server processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000449
Evan Chengff1beda2006-10-06 09:17:41 +0000450class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000451 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000452
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000453def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
454def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
455def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
456def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
457def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
458def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
Craig Topper38373222017-11-01 22:15:49 +0000459
Craig Topper505f38a2018-01-10 22:07:16 +0000460def : Proc<"i686", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
461def : Proc<"pentiumpro", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV,
462 FeatureNOPL]>;
Craig Topper38373222017-11-01 22:15:49 +0000463
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000464def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
Craig Topper505f38a2018-01-10 22:07:16 +0000465 FeatureCMOV, FeatureFXSR, FeatureNOPL]>;
Craig Topper38373222017-11-01 22:15:49 +0000466
467foreach P = ["pentium3", "pentium3m"] in {
468 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
Craig Topper505f38a2018-01-10 22:07:16 +0000469 FeatureFXSR, FeatureNOPL]>;
Craig Topper38373222017-11-01 22:15:49 +0000470}
Mitch Bodarte60465d2016-04-27 22:52:35 +0000471
472// Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
473// The intent is to enable it for pentium4 which is the current default
474// processor in a vanilla 32-bit clang compilation when no specific
475// architecture is specified. This generally gives a nice performance
476// increase on silvermont, with largely neutral behavior on other
477// contemporary large core processors.
478// pentium-m, pentium4m, prescott and nocona are included as a preventative
479// measure to avoid performance surprises, in case clang's default cpu
480// changes slightly.
481
482def : ProcessorModel<"pentium-m", GenericPostRAModel,
483 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
Craig Topper505f38a2018-01-10 22:07:16 +0000484 FeatureSSE2, FeatureFXSR, FeatureNOPL]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000485
Craig Topper38373222017-11-01 22:15:49 +0000486foreach P = ["pentium4", "pentium4m"] in {
487 def : ProcessorModel<P, GenericPostRAModel,
488 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
Craig Topper505f38a2018-01-10 22:07:16 +0000489 FeatureSSE2, FeatureFXSR, FeatureNOPL]>;
Craig Topper38373222017-11-01 22:15:49 +0000490}
Chandler Carruth32908d72014-05-07 17:37:03 +0000491
Andrey Turetskiy958eb462016-04-01 10:16:15 +0000492// Intel Quark.
493def : Proc<"lakemont", []>;
494
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000495// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000496def : ProcessorModel<"yonah", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000497 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
Craig Topper505f38a2018-01-10 22:07:16 +0000498 FeatureFXSR, FeatureNOPL]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000499
500// NetBurst.
Mitch Bodarte60465d2016-04-27 22:52:35 +0000501def : ProcessorModel<"prescott", GenericPostRAModel,
502 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
Craig Topper505f38a2018-01-10 22:07:16 +0000503 FeatureFXSR, FeatureNOPL]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000504def : ProcessorModel<"nocona", GenericPostRAModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000505 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000506 FeatureSlowUAMem16,
507 FeatureMMX,
508 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000509 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000510 FeatureNOPL,
Craig Topper27381172017-10-15 16:57:33 +0000511 FeatureCMPXCHG16B
Eric Christopher11e59832015-10-08 20:10:06 +0000512]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000513
514// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000515def : ProcessorModel<"core2", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000516 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000517 FeatureSlowUAMem16,
518 FeatureMMX,
519 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000520 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000521 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000522 FeatureCMPXCHG16B,
Craig Topper641e2af2017-08-30 04:34:48 +0000523 FeatureLAHFSAHF,
524 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000525]>;
526def : ProcessorModel<"penryn", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000527 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000528 FeatureSlowUAMem16,
529 FeatureMMX,
530 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000531 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000532 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000533 FeatureCMPXCHG16B,
Craig Topper641e2af2017-08-30 04:34:48 +0000534 FeatureLAHFSAHF,
535 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000536]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000537
Chandler Carruthaf8924032014-12-09 10:58:36 +0000538// Atom CPUs.
539class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000540 ProcIntelAtom,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000541 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000542 FeatureSlowUAMem16,
543 FeatureMMX,
544 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000545 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000546 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000547 FeatureCMPXCHG16B,
548 FeatureMOVBE,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000549 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000550 FeatureSlowDivide32,
551 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000552 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000553 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000554 FeaturePadShortFunctions,
555 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000556]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000557def : BonnellProc<"bonnell">;
558def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000559
Chandler Carruthaf8924032014-12-09 10:58:36 +0000560class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000561 ProcIntelSLM,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000562 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000563 FeatureMMX,
564 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000565 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000566 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000567 FeatureCMPXCHG16B,
568 FeatureMOVBE,
569 FeaturePOPCNT,
570 FeaturePCLMUL,
571 FeatureAES,
572 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000573 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000574 FeaturePRFCHW,
575 FeatureSlowLEA,
576 FeatureSlowIncDec,
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000577 FeatureSlowPMULLD,
Craig Topperb207dd62018-01-26 19:34:14 +0000578 FeatureRDRAND,
Craig Topperbc895a32018-04-19 19:25:24 +0000579 FeatureLAHFSAHF,
580 FeaturePOPCNTFalseDeps
Eric Christopher11e59832015-10-08 20:10:06 +0000581]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000582def : SilvermontProc<"silvermont">;
583def : SilvermontProc<"slm">; // Legacy alias.
584
Gabor Buella8f1646b2018-04-16 07:47:35 +0000585class ProcessorFeatures<list<SubtargetFeature> Inherited,
586 list<SubtargetFeature> NewFeatures> {
587 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
588}
589
590class ProcModel<string Name, SchedMachineModel Model,
591 list<SubtargetFeature> ProcFeatures,
592 list<SubtargetFeature> OtherFeatures> :
593 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
594
595def GLMFeatures : ProcessorFeatures<[], [
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000596 FeatureX87,
597 FeatureMMX,
598 FeatureSSE42,
599 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000600 FeatureNOPL,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000601 FeatureCMPXCHG16B,
602 FeatureMOVBE,
603 FeaturePOPCNT,
604 FeaturePCLMUL,
605 FeatureAES,
606 FeaturePRFCHW,
Craig Topper62c47a22017-08-29 05:14:27 +0000607 FeatureSlowTwoMemOps,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000608 FeatureSlowLEA,
609 FeatureSlowIncDec,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000610 FeatureLAHFSAHF,
611 FeatureMPX,
612 FeatureSHA,
Craig Toppera4c5caf2017-07-04 05:33:19 +0000613 FeatureRDRAND,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000614 FeatureRDSEED,
615 FeatureXSAVE,
616 FeatureXSAVEOPT,
617 FeatureXSAVEC,
618 FeatureXSAVES,
Michael Zuckermanac1d20d2017-09-25 13:45:31 +0000619 FeatureCLFLUSHOPT,
620 FeatureFSGSBase
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000621]>;
Gabor Buella8f1646b2018-04-16 07:47:35 +0000622
623class GoldmontProc<string Name> : ProcModel<Name, SLMModel,
Craig Topperbc895a32018-04-19 19:25:24 +0000624 GLMFeatures.Value, [
625 ProcIntelGLM,
626 FeaturePOPCNTFalseDeps
627]>;
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000628def : GoldmontProc<"goldmont">;
629
Gabor Buellaa832b222018-05-10 07:26:05 +0000630def GLPFeatures : ProcessorFeatures<GLMFeatures.Value, [
631 FeaturePTWRITE,
Gabor Buella8f1646b2018-04-16 07:47:35 +0000632 FeatureRDPID,
633 FeatureSGX
634]>;
Gabor Buellaa832b222018-05-10 07:26:05 +0000635
636class GoldmontPlusProc<string Name> : ProcModel<Name, SLMModel,
637 GLPFeatures.Value, [
638 ProcIntelGLP
639]>;
Gabor Buella8f1646b2018-04-16 07:47:35 +0000640def : GoldmontPlusProc<"goldmont-plus">;
641
642class TremontProc<string Name> : ProcModel<Name, SLMModel,
Gabor Buellaa832b222018-05-10 07:26:05 +0000643 GLPFeatures.Value, [
Gabor Buella8f1646b2018-04-16 07:47:35 +0000644 ProcIntelTRM,
645 FeatureCLDEMOTE,
646 FeatureGFNI,
Gabor Buellac8ded042018-05-01 10:01:16 +0000647 FeatureMOVDIRI,
648 FeatureMOVDIR64B,
Gabor Buella31fa8022018-04-20 18:42:47 +0000649 FeatureWAITPKG
Gabor Buella8f1646b2018-04-16 07:47:35 +0000650]>;
651def : TremontProc<"tremont">;
652
Eric Christopher2ef63182010-04-02 21:54:27 +0000653// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000654class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000655 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000656 FeatureMMX,
657 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000658 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000659 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000660 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000661 FeaturePOPCNT,
Craig Topper641e2af2017-08-30 04:34:48 +0000662 FeatureLAHFSAHF,
663 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000664]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000665def : NehalemProc<"nehalem">;
666def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000667
Eric Christopher2ef63182010-04-02 21:54:27 +0000668// Westmere is a similar machine to nehalem with some additional features.
669// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000670class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000671 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000672 FeatureMMX,
673 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000674 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000675 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000676 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000677 FeaturePOPCNT,
678 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000679 FeaturePCLMUL,
Craig Topper641e2af2017-08-30 04:34:48 +0000680 FeatureLAHFSAHF,
681 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000682]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000683def : WestmereProc<"westmere">;
684
Nate Begeman8b08f522010-12-10 00:26:57 +0000685// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
686// rather than a superset.
Craig Topperf730a6b2016-02-13 21:35:37 +0000687def SNBFeatures : ProcessorFeatures<[], [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000688 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000689 FeatureMMX,
690 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000691 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000692 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000693 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000694 FeaturePOPCNT,
695 FeatureAES,
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000696 FeatureSlowDivide64,
Craig Topper0ee35692015-10-14 05:37:38 +0000697 FeaturePCLMUL,
698 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000699 FeatureXSAVEOPT,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000700 FeatureLAHFSAHF,
Lama Saba2ea271b2017-05-18 08:11:50 +0000701 FeatureSlow3OpsLEA,
Craig Topperd88389a2017-02-21 06:39:13 +0000702 FeatureFastScalarFSQRT,
Craig Topper641e2af2017-08-30 04:34:48 +0000703 FeatureFastSHLDRotate,
Craig Topperef1f7162017-08-30 05:00:35 +0000704 FeatureSlowIncDec,
Craig Topper641e2af2017-08-30 04:34:48 +0000705 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000706]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000707
Craig Topperf730a6b2016-02-13 21:35:37 +0000708class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
709 SNBFeatures.Value, [
Marina Yatsina77a21db2018-01-22 10:07:01 +0000710 FeatureSlowUAMem32,
711 FeaturePOPCNTFalseDeps
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000712]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000713def : SandyBridgeProc<"sandybridge">;
714def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000715
Craig Topperf730a6b2016-02-13 21:35:37 +0000716def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000717 FeatureRDRAND,
718 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000719 FeatureFSGSBase
720]>;
721
Craig Topperf730a6b2016-02-13 21:35:37 +0000722class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
723 IVBFeatures.Value, [
Marina Yatsina77a21db2018-01-22 10:07:01 +0000724 FeatureSlowUAMem32,
725 FeaturePOPCNTFalseDeps
Eric Christopher11e59832015-10-08 20:10:06 +0000726]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000727def : IvyBridgeProc<"ivybridge">;
728def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000729
Craig Topperf730a6b2016-02-13 21:35:37 +0000730def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000731 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000732 FeatureBMI,
733 FeatureBMI2,
Clement Courbet203fc172017-04-21 09:20:50 +0000734 FeatureERMSB,
Eric Christopher11e59832015-10-08 20:10:06 +0000735 FeatureFMA,
Gabor Buellad2f1ab12018-05-25 06:32:05 +0000736 FeatureINVPCID,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000737 FeatureLZCNT,
Simon Pilgrimfd5df632017-12-19 13:16:43 +0000738 FeatureMOVBE,
739 FeatureFastVariableShuffle
Eric Christopher11e59832015-10-08 20:10:06 +0000740]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000741
Craig Topperf730a6b2016-02-13 21:35:37 +0000742class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000743 HSWFeatures.Value, [
Marina Yatsina77a21db2018-01-22 10:07:01 +0000744 ProcIntelHSW,
745 FeaturePOPCNTFalseDeps,
746 FeatureLZCNTFalseDeps
Craig Topper54541c42017-10-13 16:04:08 +0000747]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000748def : HaswellProc<"haswell">;
749def : HaswellProc<"core-avx2">; // Legacy alias.
750
Craig Topperf730a6b2016-02-13 21:35:37 +0000751def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000752 FeatureADX,
Craig Topper67885f52017-12-22 02:41:12 +0000753 FeatureRDSEED,
754 FeaturePRFCHW
Eric Christopher11e59832015-10-08 20:10:06 +0000755]>;
Gadi Haber323f2e12017-10-24 20:19:47 +0000756class BroadwellProc<string Name> : ProcModel<Name, BroadwellModel,
Craig Topper54541c42017-10-13 16:04:08 +0000757 BDWFeatures.Value, [
Marina Yatsina77a21db2018-01-22 10:07:01 +0000758 ProcIntelBDW,
759 FeaturePOPCNTFalseDeps,
760 FeatureLZCNTFalseDeps
Craig Topper54541c42017-10-13 16:04:08 +0000761]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000762def : BroadwellProc<"broadwell">;
763
Craig Topperf730a6b2016-02-13 21:35:37 +0000764def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000765 FeatureMPX,
Eric Christopher58297412017-03-29 07:40:44 +0000766 FeatureRTM,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000767 FeatureXSAVEC,
768 FeatureXSAVES,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000769 FeatureCLFLUSHOPT,
770 FeatureFastVectorFSQRT
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000771]>;
772
Gadi Haber6f8fbf42017-09-19 06:19:27 +0000773class SkylakeClientProc<string Name> : ProcModel<Name, SkylakeClientModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000774 SKLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000775 ProcIntelSKL,
Marina Yatsina77a21db2018-01-22 10:07:01 +0000776 FeatureHasFastGather,
Gabor Buella3eab22d2018-04-10 13:58:57 +0000777 FeaturePOPCNTFalseDeps,
778 FeatureSGX
Craig Topper5805fb32017-10-13 16:06:06 +0000779]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000780def : SkylakeClientProc<"skylake">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000781
Craig Topper5d692912017-10-13 18:10:17 +0000782def KNLFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000783 FeatureAVX512,
784 FeatureERI,
785 FeatureCDI,
786 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000787 FeaturePREFETCHWT1,
788 FeatureADX,
789 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000790 FeatureMOVBE,
791 FeatureLZCNT,
792 FeatureBMI,
793 FeatureBMI2,
Craig Topper67885f52017-12-22 02:41:12 +0000794 FeatureFMA,
795 FeaturePRFCHW
Craig Topper5d692912017-10-13 18:10:17 +0000796]>;
797
798// FIXME: define KNL model
799class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
800 KNLFeatures.Value, [
801 ProcIntelKNL,
Craig Topper62c47a22017-08-29 05:14:27 +0000802 FeatureSlowTwoMemOps,
Craig Topperea37e202017-11-25 18:09:37 +0000803 FeatureFastPartialYMMorZMMWrite,
804 FeatureHasFastGather
Eric Christopher11e59832015-10-08 20:10:06 +0000805]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000806def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000807
Craig Topper5d692912017-10-13 18:10:17 +0000808class KnightsMillProc<string Name> : ProcModel<Name, HaswellModel,
809 KNLFeatures.Value, [
810 ProcIntelKNL,
811 FeatureSlowTwoMemOps,
Craig Topper6fae2ee2017-10-25 17:10:32 +0000812 FeatureFastPartialYMMorZMMWrite,
Craig Topperea37e202017-11-25 18:09:37 +0000813 FeatureHasFastGather,
Craig Topper6fae2ee2017-10-25 17:10:32 +0000814 FeatureVPOPCNTDQ
Craig Topper5d692912017-10-13 18:10:17 +0000815]>;
816def : KnightsMillProc<"knm">; // TODO Add AVX5124FMAPS/AVX5124VNNIW features
817
Craig Topperf730a6b2016-02-13 21:35:37 +0000818def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000819 FeatureAVX512,
820 FeatureCDI,
821 FeatureDQI,
822 FeatureBWI,
823 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000824 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000825 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000826]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000827
Gadi Haber684944b2017-10-08 12:52:54 +0000828class SkylakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000829 SKXFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000830 ProcIntelSKX,
Craig Toppera8f87a32018-01-29 21:56:48 +0000831 FeatureHasFastGather,
832 FeaturePOPCNTFalseDeps
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000833]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000834def : SkylakeServerProc<"skylake-avx512">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000835def : SkylakeServerProc<"skx">; // Legacy alias.
836
Craig Topperd710ada2018-02-21 00:15:48 +0000837def CNLFeatures : ProcessorFeatures<SKLFeatures.Value, [
838 FeatureAVX512,
839 FeatureCDI,
840 FeatureDQI,
841 FeatureBWI,
842 FeatureVLX,
843 FeaturePKU,
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000844 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000845 FeatureIFMA,
Gabor Buella3eab22d2018-04-10 13:58:57 +0000846 FeatureSHA,
847 FeatureSGX
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000848]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000849
Craig Topper9a94dfc2017-11-19 01:25:30 +0000850class CannonlakeProc<string Name> : ProcModel<Name, SkylakeServerModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000851 CNLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000852 ProcIntelCNL,
853 FeatureHasFastGather
Craig Topper5805fb32017-10-13 16:06:06 +0000854]>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000855def : CannonlakeProc<"cannonlake">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000856
Craig Topper81037f32017-11-19 01:12:00 +0000857def ICLFeatures : ProcessorFeatures<CNLFeatures.Value, [
Craig Toppera8905702017-11-21 21:05:18 +0000858 FeatureBITALG,
859 FeatureVAES,
860 FeatureVBMI2,
861 FeatureVNNI,
862 FeatureVPCLMULQDQ,
Coby Tayreed8b17be2017-11-26 09:36:41 +0000863 FeatureVPOPCNTDQ,
Craig Topper55cfa892017-12-27 22:04:04 +0000864 FeatureGFNI,
Craig Topper84b26b92018-01-18 23:52:31 +0000865 FeatureCLWB,
866 FeatureRDPID
Craig Topper81037f32017-11-19 01:12:00 +0000867]>;
868
Gabor Buella213edc42018-04-10 18:59:13 +0000869class IcelakeClientProc<string Name> : ProcModel<Name, SkylakeServerModel,
870 ICLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000871 ProcIntelICL,
872 FeatureHasFastGather
Craig Topper81037f32017-11-19 01:12:00 +0000873]>;
Gabor Buella213edc42018-04-10 18:59:13 +0000874def : IcelakeClientProc<"icelake-client">;
875
876class IcelakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
877 ICLFeatures.Value, [
878 ProcIntelICX,
Gabor Buella2b5e9602018-05-08 06:47:36 +0000879 FeaturePCONFIG,
Gabor Buella2ef36f32018-04-11 20:01:57 +0000880 FeatureWBNOINVD,
Gabor Buella213edc42018-04-10 18:59:13 +0000881 FeatureHasFastGather
882]>;
883def : IcelakeServerProc<"icelake-server">;
Craig Topper81037f32017-11-19 01:12:00 +0000884
Chandler Carruthaf8924032014-12-09 10:58:36 +0000885// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000886
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000887def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
888def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
889def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
Craig Topper38373222017-11-01 22:15:49 +0000890
891foreach P = ["athlon", "athlon-tbird"] in {
Craig Topper505f38a2018-01-10 22:07:16 +0000892 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
893 FeatureNOPL, FeatureSlowSHLD]>;
Craig Topper38373222017-11-01 22:15:49 +0000894}
895
896foreach P = ["athlon-4", "athlon-xp", "athlon-mp"] in {
897 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
Craig Topper505f38a2018-01-10 22:07:16 +0000898 Feature3DNowA, FeatureFXSR, FeatureNOPL, FeatureSlowSHLD]>;
Craig Topper38373222017-11-01 22:15:49 +0000899}
900
901foreach P = ["k8", "opteron", "athlon64", "athlon-fx"] in {
902 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper505f38a2018-01-10 22:07:16 +0000903 FeatureFXSR, FeatureNOPL, Feature64Bit, FeatureSlowSHLD]>;
Craig Topper38373222017-11-01 22:15:49 +0000904}
905
906foreach P = ["k8-sse3", "opteron-sse3", "athlon64-sse3"] in {
907 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper505f38a2018-01-10 22:07:16 +0000908 FeatureFXSR, FeatureNOPL, FeatureCMPXCHG16B, FeatureSlowSHLD]>;
Craig Topper38373222017-11-01 22:15:49 +0000909}
910
911foreach P = ["amdfam10", "barcelona"] in {
912 def : Proc<P, [FeatureX87, FeatureSSE4A, Feature3DNowA, FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000913 FeatureNOPL, FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
Craig Topper38373222017-11-01 22:15:49 +0000914 FeatureSlowSHLD, FeatureLAHFSAHF]>;
915}
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000916
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000917// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000918def : Proc<"btver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000919 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000920 FeatureMMX,
921 FeatureSSSE3,
922 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000923 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000924 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000925 FeatureCMPXCHG16B,
926 FeaturePRFCHW,
927 FeatureLZCNT,
928 FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000929 FeatureSlowSHLD,
Simon Pilgrim02bdac52018-01-29 21:24:31 +0000930 FeatureLAHFSAHF,
931 FeatureFast15ByteNOP
Eric Christopher11e59832015-10-08 20:10:06 +0000932]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000933
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000934// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000935def : ProcessorModel<"btver2", BtVer2Model, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000936 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000937 FeatureMMX,
938 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000939 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000940 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000941 FeatureSSE4A,
942 FeatureCMPXCHG16B,
943 FeaturePRFCHW,
944 FeatureAES,
945 FeaturePCLMUL,
946 FeatureBMI,
947 FeatureF16C,
948 FeatureMOVBE,
949 FeatureLZCNT,
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000950 FeatureFastLZCNT,
Eric Christopher11e59832015-10-08 20:10:06 +0000951 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000952 FeatureXSAVE,
953 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000954 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000955 FeatureLAHFSAHF,
Simon Pilgrim02bdac52018-01-29 21:24:31 +0000956 FeatureFast15ByteNOP,
Amjad Aboud4f977512017-03-03 09:03:24 +0000957 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000958]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000959
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000960// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000961def : Proc<"bdver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000962 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000963 FeatureXOP,
964 FeatureFMA4,
965 FeatureCMPXCHG16B,
966 FeatureAES,
967 FeaturePRFCHW,
968 FeaturePCLMUL,
969 FeatureMMX,
970 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000971 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000972 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000973 FeatureSSE4A,
974 FeatureLZCNT,
975 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000976 FeatureXSAVE,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000977 FeatureLWP,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000978 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +0000979 FeatureLAHFSAHF,
Simon Pilgrim02bdac52018-01-29 21:24:31 +0000980 FeatureFast11ByteNOP,
Craig Topper641e2af2017-08-30 04:34:48 +0000981 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000982]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000983// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000984def : Proc<"bdver2", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000985 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000986 FeatureXOP,
987 FeatureFMA4,
988 FeatureCMPXCHG16B,
989 FeatureAES,
990 FeaturePRFCHW,
991 FeaturePCLMUL,
992 FeatureMMX,
993 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000994 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +0000995 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +0000996 FeatureSSE4A,
997 FeatureF16C,
998 FeatureLZCNT,
999 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +00001000 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +00001001 FeatureBMI,
1002 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +00001003 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +00001004 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +00001005 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +00001006 FeatureLAHFSAHF,
Simon Pilgrim02bdac52018-01-29 21:24:31 +00001007 FeatureFast11ByteNOP,
Craig Topper641e2af2017-08-30 04:34:48 +00001008 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +00001009]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +00001010
1011// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +00001012def : Proc<"bdver3", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +00001013 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +00001014 FeatureXOP,
1015 FeatureFMA4,
1016 FeatureCMPXCHG16B,
1017 FeatureAES,
1018 FeaturePRFCHW,
1019 FeaturePCLMUL,
1020 FeatureMMX,
1021 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +00001022 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +00001023 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +00001024 FeatureSSE4A,
1025 FeatureF16C,
1026 FeatureLZCNT,
1027 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +00001028 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +00001029 FeatureBMI,
1030 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +00001031 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +00001032 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +00001033 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +00001034 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +00001035 FeatureFSGSBase,
Craig Topper641e2af2017-08-30 04:34:48 +00001036 FeatureLAHFSAHF,
Simon Pilgrim02bdac52018-01-29 21:24:31 +00001037 FeatureFast11ByteNOP,
Craig Topper641e2af2017-08-30 04:34:48 +00001038 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +00001039]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +00001040
Benjamin Kramer60045732014-05-02 15:47:07 +00001041// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +00001042def : Proc<"bdver4", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +00001043 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +00001044 FeatureMMX,
1045 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +00001046 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +00001047 FeatureNOPL,
Eric Christopher11e59832015-10-08 20:10:06 +00001048 FeatureXOP,
1049 FeatureFMA4,
1050 FeatureCMPXCHG16B,
1051 FeatureAES,
1052 FeaturePRFCHW,
1053 FeaturePCLMUL,
1054 FeatureF16C,
1055 FeatureLZCNT,
1056 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +00001057 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +00001058 FeatureBMI,
1059 FeatureBMI2,
1060 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +00001061 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +00001062 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +00001063 FeatureXSAVEOPT,
Simon Pilgrim381a0ad2016-07-24 16:00:53 +00001064 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +00001065 FeatureFSGSBase,
Ashutosh Nema348af9c2016-05-18 11:59:12 +00001066 FeatureLAHFSAHF,
Simon Pilgrim02bdac52018-01-29 21:24:31 +00001067 FeatureFast11ByteNOP,
Craig Topper641e2af2017-08-30 04:34:48 +00001068 FeatureMWAITX,
1069 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +00001070]>;
Benjamin Kramer60045732014-05-02 15:47:07 +00001071
Craig Topper106b5b62017-07-19 02:45:14 +00001072// Znver1
1073def: ProcessorModel<"znver1", Znver1Model, [
Craig Topperd55b8312017-01-10 06:01:16 +00001074 FeatureADX,
1075 FeatureAES,
1076 FeatureAVX2,
1077 FeatureBMI,
1078 FeatureBMI2,
1079 FeatureCLFLUSHOPT,
Craig Topper50f3d142017-02-09 04:27:34 +00001080 FeatureCLZERO,
Craig Topperd55b8312017-01-10 06:01:16 +00001081 FeatureCMPXCHG16B,
1082 FeatureF16C,
1083 FeatureFMA,
1084 FeatureFSGSBase,
1085 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +00001086 FeatureNOPL,
Craig Topperd55b8312017-01-10 06:01:16 +00001087 FeatureFastLZCNT,
1088 FeatureLAHFSAHF,
1089 FeatureLZCNT,
Simon Pilgrim02bdac52018-01-29 21:24:31 +00001090 FeatureFast15ByteNOP,
Craig Topper641e2af2017-08-30 04:34:48 +00001091 FeatureMacroFusion,
Craig Topperd55b8312017-01-10 06:01:16 +00001092 FeatureMMX,
1093 FeatureMOVBE,
1094 FeatureMWAITX,
1095 FeaturePCLMUL,
1096 FeaturePOPCNT,
1097 FeaturePRFCHW,
1098 FeatureRDRAND,
1099 FeatureRDSEED,
1100 FeatureSHA,
Craig Topperd55b8312017-01-10 06:01:16 +00001101 FeatureSSE4A,
1102 FeatureSlowSHLD,
1103 FeatureX87,
1104 FeatureXSAVE,
1105 FeatureXSAVEC,
1106 FeatureXSAVEOPT,
1107 FeatureXSAVES]>;
1108
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +00001109def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +00001110
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +00001111def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
1112def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
1113def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
1114def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
1115 FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +00001116
Chandler Carruth32908d72014-05-07 17:37:03 +00001117// We also provide a generic 64-bit specific x86 processor model which tries to
1118// be good for modern chips without enabling instruction set encodings past the
1119// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
1120// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +00001121//
Chandler Carruth32908d72014-05-07 17:37:03 +00001122// We currently use the Sandy Bridge model as the default scheduling model as
1123// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
1124// covers a huge swath of x86 processors. If there are specific scheduling
1125// knobs which need to be tuned differently for AMD chips, we might consider
1126// forming a common base for them.
Chandler Carruth98c51cb2017-08-21 08:45:22 +00001127def : ProcessorModel<"x86-64", SandyBridgeModel, [
1128 FeatureX87,
1129 FeatureMMX,
1130 FeatureSSE2,
1131 FeatureFXSR,
Craig Topper505f38a2018-01-10 22:07:16 +00001132 FeatureNOPL,
Chandler Carruth98c51cb2017-08-21 08:45:22 +00001133 Feature64Bit,
1134 FeatureSlow3OpsLEA,
Craig Topper641e2af2017-08-30 04:34:48 +00001135 FeatureSlowIncDec,
1136 FeatureMacroFusion
Chandler Carruth98c51cb2017-08-21 08:45:22 +00001137]>;
Chandler Carruth32908d72014-05-07 17:37:03 +00001138
Evan Chengff1beda2006-10-06 09:17:41 +00001139//===----------------------------------------------------------------------===//
Chris Lattner5d00a0b2007-02-26 18:17:14 +00001140// Calling Conventions
1141//===----------------------------------------------------------------------===//
1142
1143include "X86CallingConv.td"
1144
1145
1146//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +00001147// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +00001148//===----------------------------------------------------------------------===//
1149
Devang Patel85d684a2012-01-09 19:13:28 +00001150def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +00001151 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +00001152
Chad Rosier9f7a2212013-04-18 22:35:36 +00001153 // Variant name.
1154 string Name = "att";
1155
Daniel Dunbare4318712009-08-11 20:59:47 +00001156 // Discard comments in assembly strings.
1157 string CommentDelimiter = "#";
1158
1159 // Recognize hard coded registers.
1160 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +00001161}
1162
Devang Patel67bf992a2012-01-10 17:51:54 +00001163def IntelAsmParserVariant : AsmParserVariant {
1164 int Variant = 1;
1165
Chad Rosier9f7a2212013-04-18 22:35:36 +00001166 // Variant name.
1167 string Name = "intel";
1168
Devang Patel67bf992a2012-01-10 17:51:54 +00001169 // Discard comments in assembly strings.
1170 string CommentDelimiter = ";";
1171
1172 // Recognize hard coded registers.
1173 string RegisterPrefix = "";
1174}
1175
Jim Grosbach4cf25f52010-10-30 13:48:28 +00001176//===----------------------------------------------------------------------===//
1177// Assembly Printers
1178//===----------------------------------------------------------------------===//
1179
Chris Lattner56832602004-10-03 20:36:57 +00001180// The X86 target supports two different syntaxes for emitting machine code.
1181// This is controlled by the -x86-asm-syntax={att|intel}
1182def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +00001183 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +00001184 int Variant = 0;
1185}
1186def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +00001187 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +00001188 int Variant = 1;
1189}
1190
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001191def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001192 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +00001193 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +00001194 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +00001195 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Geoff Berryf8bf2ec2018-02-23 18:25:08 +00001196 let AllowRegisterRenaming = 1;
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001197}
Clement Courbetb4493792018-04-10 08:16:37 +00001198
1199//===----------------------------------------------------------------------===//
1200// Pfm Counters
1201//===----------------------------------------------------------------------===//
1202
1203include "X86PfmCounters.td"