blob: 9b6fe6893decccf61212698440052d379c366228 [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
Chris Lattnercc8c5812009-09-02 05:53:04 +000037def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
38 "Enable conditional move instructions">;
39
Benjamin Kramer2f489232010-12-04 20:32:23 +000040def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
41 "Support POPCNT instruction">;
42
Craig Topper09b65982015-10-16 06:03:09 +000043def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
44 "Support fxsave/fxrestore instructions">;
45
Amjad Aboud1db6d7a2015-10-12 11:47:46 +000046def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
47 "Support xsave instructions">;
48
49def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
50 "Support xsaveopt instructions">;
51
52def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
53 "Support xsavec instructions">;
54
55def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
56 "Support xsaves instructions">;
57
Bill Wendlinge6182262007-05-04 20:38:40 +000058def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
59 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000060 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000061 // SSE1+ processors support them.
Eric Christopher11e59832015-10-08 20:10:06 +000062 [FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000063def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
64 "Enable SSE2 instructions",
65 [FeatureSSE1]>;
66def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
67 "Enable SSE3 instructions",
68 [FeatureSSE2]>;
69def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
70 "Enable SSSE3 instructions",
71 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000072def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000073 "Enable SSE 4.1 instructions",
74 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000075def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000076 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000077 [FeatureSSE41]>;
Eric Christopher57a6e132015-11-14 03:04:00 +000078// The MMX subtarget feature is separate from the rest of the SSE features
79// because it's important (for odd compatibility reasons) to be able to
80// turn it off explicitly while allowing SSE+ to be on.
81def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
82 "Enable MMX instructions">;
Bill Wendlinge6182262007-05-04 20:38:40 +000083def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000084 "Enable 3DNow! instructions",
85 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000086def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000087 "Enable 3DNow! Athlon instructions",
88 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000089// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
90// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
91// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000092def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000093 "Support 64-bit instructions",
94 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000095def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000096 "64-bit with cmpxchg16b",
97 [Feature64Bit]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000098def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
99 "Bit testing of memory is slow">;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000100def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
101 "SHLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +0000102// FIXME: This should not apply to CPUs that do not have SSE.
103def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
104 "IsUAMem16Slow", "true",
105 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000106def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000107 "IsUAMem32Slow", "true",
108 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000109def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000110 "Support SSE 4a instructions",
111 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000112
Craig Topperf287a452012-01-09 09:02:13 +0000113def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
114 "Enable AVX instructions",
115 [FeatureSSE42]>;
116def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000117 "Enable AVX2 instructions",
118 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000119def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000120 "Enable AVX-512 instructions",
121 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000122def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000123 "Enable AVX-512 Exponential and Reciprocal Instructions",
124 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000125def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000126 "Enable AVX-512 Conflict Detection Instructions",
127 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000128def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000129 "Enable AVX-512 PreFetch Instructions",
130 [FeatureAVX512]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000131def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPFPREFETCHWT1",
132 "true",
133 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000134def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
135 "Enable AVX-512 Doubleword and Quadword Instructions",
136 [FeatureAVX512]>;
137def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
138 "Enable AVX-512 Byte and Word Instructions",
139 [FeatureAVX512]>;
140def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
141 "Enable AVX-512 Vector Length eXtensions",
142 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000143def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
144 "Enable AVX-512 Vector Bit Manipulation Instructions",
145 [FeatureAVX512]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000146def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000147 "Enable AVX-512 Integer Fused Multiple-Add",
148 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000149def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
150 "Enable protection keys">;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000151def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
152 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000153 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000154def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000155 "Enable three-operand fused multiple-add",
156 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000157def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000158 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000159 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000160def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000161 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000162 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000163def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
164 "HasSSEUnalignedMem", "true",
165 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000166def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000167 "Enable AES instructions",
168 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000169def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
170 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000171def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
172 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000173def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000174 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000175def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000176 "Support 16-bit floating point conversion instructions",
177 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000178def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
179 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000180def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
181 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000182def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
183 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000184def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
185 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000186def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
187 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000188def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
189 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000190def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
191 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000192def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
193 "Enable SHA instructions",
194 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000195def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
196 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000197def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
198 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000199def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
200 "Support LAHF and SAHF instructions">;
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000201def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
202 "Enable MONITORX/MWAITX timer functionality">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000203def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
204 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000205def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000206 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000207def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
208 "HasSlowDivide32", "true",
209 "Use 8-bit divide for positive values less than 256">;
210def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
211 "HasSlowDivide64", "true",
212 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000213def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
214 "PadShortFunctions", "true",
215 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000216def FeatureINVPCID : SubtargetFeature<"invpcid", "HasInvPCId", "true",
217 "Invalidate Process-Context Identifier">;
218def FeatureVMFUNC : SubtargetFeature<"vmfunc", "HasVMFUNC", "true",
219 "VM Functions">;
220def FeatureSMAP : SubtargetFeature<"smap", "HasSMAP", "true",
221 "Supervisor Mode Access Protection">;
222def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
223 "Enable Software Guard Extensions">;
224def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
225 "Flush A Cache Line Optimized">;
226def FeaturePCOMMIT : SubtargetFeature<"pcommit", "HasPCOMMIT", "true",
227 "Enable Persistent Commit">;
228def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
229 "Cache Line Write Back">;
Michael Kuperstein454d1452015-07-23 12:23:45 +0000230// TODO: This feature ought to be renamed.
Sean Silvae1c6b542015-07-27 00:46:59 +0000231// What it really refers to are CPUs for which certain instructions
232// (which ones besides the example below?) are microcoded.
Michael Kuperstein454d1452015-07-23 12:23:45 +0000233// The best examples of this are the memory forms of CALL and PUSH
234// instructions, which should be avoided in favor of a MOV + register CALL/PUSH.
Preston Gurd663e6f92013-03-27 19:14:02 +0000235def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
236 "CallRegIndirect", "true",
237 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000238def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
239 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000240def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
241 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000242def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
243 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000244def FeatureSoftFloat
245 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
246 "Use software floating point features.">;
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000247// On at least some AMD processors, there is no performance hazard to writing
248// only the lower parts of a YMM register without clearing the upper part.
249def FeatureFastPartialYMMWrite
250 : SubtargetFeature<"fast-partial-ymm-write", "HasFastPartialYMMWrite",
251 "true", "Partial writes to YMM registers are fast">;
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000252// FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
253// than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
254// vector FSQRT has higher throughput than the corresponding NR code.
255// The idea is that throughput bound code is likely to be vectorized, so for
256// vectorized code we should care about the throughput of SQRT operations.
257// But if the code is scalar that probably means that the code has some kind of
258// dependency and we should care more about reducing the latency.
259def FeatureFastScalarFSQRT
260 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
261 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
262def FeatureFastVectorFSQRT
263 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
264 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
David Greene8f6f72c2009-06-26 22:46:54 +0000265
Evan Chengff1beda2006-10-06 09:17:41 +0000266//===----------------------------------------------------------------------===//
267// X86 processors supported.
268//===----------------------------------------------------------------------===//
269
Andrew Trick8523b162012-02-01 23:20:51 +0000270include "X86Schedule.td"
271
272def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
273 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000274def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
275 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000276
Evan Chengff1beda2006-10-06 09:17:41 +0000277class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000278 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000279
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000280def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
281def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
282def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
283def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
284def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
285def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
286def : Proc<"i686", [FeatureX87, FeatureSlowUAMem16]>;
287def : Proc<"pentiumpro", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
288def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
289 FeatureCMOV, FeatureFXSR]>;
290def : Proc<"pentium3", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
291 FeatureSSE1, FeatureFXSR]>;
292def : Proc<"pentium3m", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
293 FeatureSSE1, FeatureFXSR, FeatureSlowBTMem]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000294
295// Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
296// The intent is to enable it for pentium4 which is the current default
297// processor in a vanilla 32-bit clang compilation when no specific
298// architecture is specified. This generally gives a nice performance
299// increase on silvermont, with largely neutral behavior on other
300// contemporary large core processors.
301// pentium-m, pentium4m, prescott and nocona are included as a preventative
302// measure to avoid performance surprises, in case clang's default cpu
303// changes slightly.
304
305def : ProcessorModel<"pentium-m", GenericPostRAModel,
306 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
307 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
308
309def : ProcessorModel<"pentium4", GenericPostRAModel,
310 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
311 FeatureSSE2, FeatureFXSR]>;
312
313def : ProcessorModel<"pentium4m", GenericPostRAModel,
314 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
315 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000316
Andrey Turetskiy958eb462016-04-01 10:16:15 +0000317// Intel Quark.
318def : Proc<"lakemont", []>;
319
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000320// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000321def : ProcessorModel<"yonah", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000322 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
323 FeatureFXSR, FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000324
325// NetBurst.
Mitch Bodarte60465d2016-04-27 22:52:35 +0000326def : ProcessorModel<"prescott", GenericPostRAModel,
327 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
328 FeatureFXSR, FeatureSlowBTMem]>;
329def : ProcessorModel<"nocona", GenericPostRAModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000330 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000331 FeatureSlowUAMem16,
332 FeatureMMX,
333 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000334 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000335 FeatureCMPXCHG16B,
336 FeatureSlowBTMem
337]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000338
339// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000340def : ProcessorModel<"core2", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000341 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000342 FeatureSlowUAMem16,
343 FeatureMMX,
344 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000345 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000346 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000347 FeatureSlowBTMem,
348 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000349]>;
350def : ProcessorModel<"penryn", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000351 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000352 FeatureSlowUAMem16,
353 FeatureMMX,
354 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000355 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000356 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000357 FeatureSlowBTMem,
358 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000359]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000360
Chandler Carruthaf8924032014-12-09 10:58:36 +0000361// Atom CPUs.
362class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000363 ProcIntelAtom,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000364 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000365 FeatureSlowUAMem16,
366 FeatureMMX,
367 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000368 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000369 FeatureCMPXCHG16B,
370 FeatureMOVBE,
371 FeatureSlowBTMem,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000372 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000373 FeatureSlowDivide32,
374 FeatureSlowDivide64,
375 FeatureCallRegIndirect,
376 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000377 FeaturePadShortFunctions,
378 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000379]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000380def : BonnellProc<"bonnell">;
381def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000382
Chandler Carruthaf8924032014-12-09 10:58:36 +0000383class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000384 ProcIntelSLM,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000385 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000386 FeatureMMX,
387 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000388 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000389 FeatureCMPXCHG16B,
390 FeatureMOVBE,
391 FeaturePOPCNT,
392 FeaturePCLMUL,
393 FeatureAES,
394 FeatureSlowDivide64,
395 FeatureCallRegIndirect,
396 FeaturePRFCHW,
397 FeatureSlowLEA,
398 FeatureSlowIncDec,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000399 FeatureSlowBTMem,
400 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000401]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000402def : SilvermontProc<"silvermont">;
403def : SilvermontProc<"slm">; // Legacy alias.
404
Eric Christopher2ef63182010-04-02 21:54:27 +0000405// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000406class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000407 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000408 FeatureMMX,
409 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000410 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000411 FeatureCMPXCHG16B,
412 FeatureSlowBTMem,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000413 FeaturePOPCNT,
414 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000415]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000416def : NehalemProc<"nehalem">;
417def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000418
Eric Christopher2ef63182010-04-02 21:54:27 +0000419// Westmere is a similar machine to nehalem with some additional features.
420// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000421class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000422 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000423 FeatureMMX,
424 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000425 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000426 FeatureCMPXCHG16B,
427 FeatureSlowBTMem,
428 FeaturePOPCNT,
429 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000430 FeaturePCLMUL,
431 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000432]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000433def : WestmereProc<"westmere">;
434
Craig Topperf730a6b2016-02-13 21:35:37 +0000435class ProcessorFeatures<list<SubtargetFeature> Inherited,
436 list<SubtargetFeature> NewFeatures> {
437 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
438}
439
440class ProcModel<string Name, SchedMachineModel Model,
441 list<SubtargetFeature> ProcFeatures,
442 list<SubtargetFeature> OtherFeatures> :
443 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
444
Nate Begeman8b08f522010-12-10 00:26:57 +0000445// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
446// rather than a superset.
Craig Topperf730a6b2016-02-13 21:35:37 +0000447def SNBFeatures : ProcessorFeatures<[], [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000448 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000449 FeatureMMX,
450 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000451 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000452 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000453 FeaturePOPCNT,
454 FeatureAES,
Craig Topper0ee35692015-10-14 05:37:38 +0000455 FeaturePCLMUL,
456 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000457 FeatureXSAVEOPT,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000458 FeatureLAHFSAHF,
459 FeatureFastScalarFSQRT
Eric Christopher11e59832015-10-08 20:10:06 +0000460]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000461
Craig Topperf730a6b2016-02-13 21:35:37 +0000462class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
463 SNBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000464 FeatureSlowBTMem,
465 FeatureSlowUAMem32
466]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000467def : SandyBridgeProc<"sandybridge">;
468def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000469
Craig Topperf730a6b2016-02-13 21:35:37 +0000470def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000471 FeatureRDRAND,
472 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000473 FeatureFSGSBase
474]>;
475
Craig Topperf730a6b2016-02-13 21:35:37 +0000476class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
477 IVBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000478 FeatureSlowBTMem,
479 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000480]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000481def : IvyBridgeProc<"ivybridge">;
482def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000483
Craig Topperf730a6b2016-02-13 21:35:37 +0000484def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000485 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000486 FeatureBMI,
487 FeatureBMI2,
488 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000489 FeatureLZCNT,
490 FeatureMOVBE,
491 FeatureINVPCID,
492 FeatureVMFUNC,
Eric Christopher11e59832015-10-08 20:10:06 +0000493 FeatureRTM,
494 FeatureHLE,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000495 FeatureSlowIncDec
Eric Christopher11e59832015-10-08 20:10:06 +0000496]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000497
Craig Topperf730a6b2016-02-13 21:35:37 +0000498class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
499 HSWFeatures.Value, []>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000500def : HaswellProc<"haswell">;
501def : HaswellProc<"core-avx2">; // Legacy alias.
502
Craig Topperf730a6b2016-02-13 21:35:37 +0000503def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000504 FeatureADX,
505 FeatureRDSEED,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000506 FeatureSMAP
Eric Christopher11e59832015-10-08 20:10:06 +0000507]>;
Craig Topperf730a6b2016-02-13 21:35:37 +0000508class BroadwellProc<string Name> : ProcModel<Name, HaswellModel,
509 BDWFeatures.Value, []>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000510def : BroadwellProc<"broadwell">;
511
Craig Topperf730a6b2016-02-13 21:35:37 +0000512def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000513 FeatureMPX,
514 FeatureXSAVEC,
515 FeatureXSAVES,
516 FeatureSGX,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000517 FeatureCLFLUSHOPT,
518 FeatureFastVectorFSQRT
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000519]>;
520
521// FIXME: define SKL model
Craig Topperf730a6b2016-02-13 21:35:37 +0000522class SkylakeClientProc<string Name> : ProcModel<Name, HaswellModel,
523 SKLFeatures.Value, []>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000524def : SkylakeClientProc<"skylake">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000525
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000526// FIXME: define KNL model
Craig Topperf730a6b2016-02-13 21:35:37 +0000527class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
528 IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000529 FeatureAVX512,
530 FeatureERI,
531 FeatureCDI,
532 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000533 FeaturePREFETCHWT1,
534 FeatureADX,
535 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000536 FeatureMOVBE,
537 FeatureLZCNT,
538 FeatureBMI,
539 FeatureBMI2,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000540 FeatureFMA
Eric Christopher11e59832015-10-08 20:10:06 +0000541]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000542def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000543
Craig Topperf730a6b2016-02-13 21:35:37 +0000544def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000545 FeatureAVX512,
546 FeatureCDI,
547 FeatureDQI,
548 FeatureBWI,
549 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000550 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000551 FeaturePCOMMIT,
552 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000553]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000554
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000555// FIXME: define SKX model
Craig Topperf730a6b2016-02-13 21:35:37 +0000556class SkylakeServerProc<string Name> : ProcModel<Name, HaswellModel,
557 SKXFeatures.Value, []>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000558def : SkylakeServerProc<"skylake-avx512">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000559def : SkylakeServerProc<"skx">; // Legacy alias.
560
Craig Topperf730a6b2016-02-13 21:35:37 +0000561def CNLFeatures : ProcessorFeatures<SKXFeatures.Value, [
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000562 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000563 FeatureIFMA,
564 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000565]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000566
Craig Topperf730a6b2016-02-13 21:35:37 +0000567class CannonlakeProc<string Name> : ProcModel<Name, HaswellModel,
568 CNLFeatures.Value, []>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000569def : CannonlakeProc<"cannonlake">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000570
571// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000572
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000573def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
574def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
575def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
576def : Proc<"athlon", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000577 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000578def : Proc<"athlon-tbird", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000579 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000580def : Proc<"athlon-4", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
581 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000582 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000583def : Proc<"athlon-xp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
584 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000585 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000586def : Proc<"athlon-mp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
587 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000588 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000589def : Proc<"k8", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
590 Feature3DNowA, FeatureFXSR, Feature64Bit,
591 FeatureSlowBTMem, FeatureSlowSHLD]>;
592def : Proc<"opteron", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
593 Feature3DNowA, FeatureFXSR, Feature64Bit,
594 FeatureSlowBTMem, FeatureSlowSHLD]>;
595def : Proc<"athlon64", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
596 Feature3DNowA, FeatureFXSR, Feature64Bit,
597 FeatureSlowBTMem, FeatureSlowSHLD]>;
598def : Proc<"athlon-fx", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
599 Feature3DNowA, FeatureFXSR, Feature64Bit,
600 FeatureSlowBTMem, FeatureSlowSHLD]>;
601def : Proc<"k8-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
602 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
603 FeatureSlowBTMem, FeatureSlowSHLD]>;
604def : Proc<"opteron-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
605 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
606 FeatureSlowBTMem, FeatureSlowSHLD]>;
607def : Proc<"athlon64-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
608 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
609 FeatureSlowBTMem, FeatureSlowSHLD]>;
610def : Proc<"amdfam10", [FeatureX87, FeatureSSE4A, Feature3DNowA,
611 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
612 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
613 FeatureLAHFSAHF]>;
614def : Proc<"barcelona", [FeatureX87, FeatureSSE4A, Feature3DNowA,
615 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
616 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
617 FeatureLAHFSAHF]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000618
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000619// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000620def : Proc<"btver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000621 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000622 FeatureMMX,
623 FeatureSSSE3,
624 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000625 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000626 FeatureCMPXCHG16B,
627 FeaturePRFCHW,
628 FeatureLZCNT,
629 FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000630 FeatureSlowSHLD,
631 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000632]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000633
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000634// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000635def : ProcessorModel<"btver2", BtVer2Model, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000636 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000637 FeatureMMX,
638 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000639 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000640 FeatureSSE4A,
641 FeatureCMPXCHG16B,
642 FeaturePRFCHW,
643 FeatureAES,
644 FeaturePCLMUL,
645 FeatureBMI,
646 FeatureF16C,
647 FeatureMOVBE,
648 FeatureLZCNT,
649 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000650 FeatureXSAVE,
651 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000652 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000653 FeatureLAHFSAHF,
654 FeatureFastPartialYMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000655]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000656
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000657// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000658def : Proc<"bdver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000659 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000660 FeatureXOP,
661 FeatureFMA4,
662 FeatureCMPXCHG16B,
663 FeatureAES,
664 FeaturePRFCHW,
665 FeaturePCLMUL,
666 FeatureMMX,
667 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000668 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000669 FeatureSSE4A,
670 FeatureLZCNT,
671 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000672 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000673 FeatureSlowSHLD,
674 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000675]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000676// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000677def : Proc<"bdver2", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000678 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000679 FeatureXOP,
680 FeatureFMA4,
681 FeatureCMPXCHG16B,
682 FeatureAES,
683 FeaturePRFCHW,
684 FeaturePCLMUL,
685 FeatureMMX,
686 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000687 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000688 FeatureSSE4A,
689 FeatureF16C,
690 FeatureLZCNT,
691 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000692 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000693 FeatureBMI,
694 FeatureTBM,
695 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000696 FeatureSlowSHLD,
697 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000698]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000699
700// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000701def : Proc<"bdver3", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000702 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000703 FeatureXOP,
704 FeatureFMA4,
705 FeatureCMPXCHG16B,
706 FeatureAES,
707 FeaturePRFCHW,
708 FeaturePCLMUL,
709 FeatureMMX,
710 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000711 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000712 FeatureSSE4A,
713 FeatureF16C,
714 FeatureLZCNT,
715 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000716 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000717 FeatureBMI,
718 FeatureTBM,
719 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000720 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000721 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000722 FeatureFSGSBase,
723 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000724]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000725
Benjamin Kramer60045732014-05-02 15:47:07 +0000726// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000727def : Proc<"bdver4", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000728 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000729 FeatureMMX,
730 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000731 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000732 FeatureXOP,
733 FeatureFMA4,
734 FeatureCMPXCHG16B,
735 FeatureAES,
736 FeaturePRFCHW,
737 FeaturePCLMUL,
738 FeatureF16C,
739 FeatureLZCNT,
740 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000741 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000742 FeatureBMI,
743 FeatureBMI2,
744 FeatureTBM,
745 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000746 FeatureXSAVEOPT,
Simon Pilgrim381a0ad2016-07-24 16:00:53 +0000747 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000748 FeatureFSGSBase,
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000749 FeatureLAHFSAHF,
750 FeatureMWAITX
Eric Christopher11e59832015-10-08 20:10:06 +0000751]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000752
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000753def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000754
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000755def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
756def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
757def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
758def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
759 FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000760
Chandler Carruth32908d72014-05-07 17:37:03 +0000761// We also provide a generic 64-bit specific x86 processor model which tries to
762// be good for modern chips without enabling instruction set encodings past the
763// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
764// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000765//
Chandler Carruth32908d72014-05-07 17:37:03 +0000766// We currently use the Sandy Bridge model as the default scheduling model as
767// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
768// covers a huge swath of x86 processors. If there are specific scheduling
769// knobs which need to be tuned differently for AMD chips, we might consider
770// forming a common base for them.
Craig Topper09b65982015-10-16 06:03:09 +0000771def : ProcessorModel<"x86-64", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000772 [FeatureX87, FeatureMMX, FeatureSSE2, FeatureFXSR,
773 Feature64Bit, FeatureSlowBTMem ]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000774
Evan Chengff1beda2006-10-06 09:17:41 +0000775//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000776// Register File Description
777//===----------------------------------------------------------------------===//
778
779include "X86RegisterInfo.td"
780
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000781//===----------------------------------------------------------------------===//
782// Instruction Descriptions
783//===----------------------------------------------------------------------===//
784
Chris Lattner59a4a912003-08-03 21:54:21 +0000785include "X86InstrInfo.td"
786
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000787def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000788
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000789//===----------------------------------------------------------------------===//
790// Calling Conventions
791//===----------------------------------------------------------------------===//
792
793include "X86CallingConv.td"
794
795
796//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000797// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000798//===----------------------------------------------------------------------===//
799
Devang Patel85d684a2012-01-09 19:13:28 +0000800def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000801 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000802
Chad Rosier9f7a2212013-04-18 22:35:36 +0000803 // Variant name.
804 string Name = "att";
805
Daniel Dunbare4318712009-08-11 20:59:47 +0000806 // Discard comments in assembly strings.
807 string CommentDelimiter = "#";
808
809 // Recognize hard coded registers.
810 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000811}
812
Devang Patel67bf992a2012-01-10 17:51:54 +0000813def IntelAsmParserVariant : AsmParserVariant {
814 int Variant = 1;
815
Chad Rosier9f7a2212013-04-18 22:35:36 +0000816 // Variant name.
817 string Name = "intel";
818
Devang Patel67bf992a2012-01-10 17:51:54 +0000819 // Discard comments in assembly strings.
820 string CommentDelimiter = ";";
821
822 // Recognize hard coded registers.
823 string RegisterPrefix = "";
824}
825
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000826//===----------------------------------------------------------------------===//
827// Assembly Printers
828//===----------------------------------------------------------------------===//
829
Chris Lattner56832602004-10-03 20:36:57 +0000830// The X86 target supports two different syntaxes for emitting machine code.
831// This is controlled by the -x86-asm-syntax={att|intel}
832def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000833 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000834 int Variant = 0;
835}
836def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000837 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000838 int Variant = 1;
839}
840
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000841def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000842 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000843 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +0000844 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000845 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000846}