blob: 3c25f7327e3c5f0a0180e19805268b2b5303552b [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
34def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
35 "Enable conditional move instructions">;
36
Benjamin Kramer2f489232010-12-04 20:32:23 +000037def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
38 "Support POPCNT instruction">;
39
Craig Topper09b65982015-10-16 06:03:09 +000040def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
41 "Support fxsave/fxrestore instructions">;
42
Amjad Aboud1db6d7a2015-10-12 11:47:46 +000043def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
44 "Support xsave instructions">;
45
46def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
47 "Support xsaveopt instructions">;
48
49def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
50 "Support xsavec instructions">;
51
52def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
53 "Support xsaves instructions">;
54
Bill Wendlinge6182262007-05-04 20:38:40 +000055def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
56 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000057 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000058 // SSE1+ processors support them.
Eric Christopher11e59832015-10-08 20:10:06 +000059 [FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000060def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
61 "Enable SSE2 instructions",
62 [FeatureSSE1]>;
63def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
64 "Enable SSE3 instructions",
65 [FeatureSSE2]>;
66def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
67 "Enable SSSE3 instructions",
68 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000069def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000070 "Enable SSE 4.1 instructions",
71 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000072def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000073 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000074 [FeatureSSE41]>;
Eric Christopher57a6e132015-11-14 03:04:00 +000075// The MMX subtarget feature is separate from the rest of the SSE features
76// because it's important (for odd compatibility reasons) to be able to
77// turn it off explicitly while allowing SSE+ to be on.
78def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
79 "Enable MMX instructions">;
Bill Wendlinge6182262007-05-04 20:38:40 +000080def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000081 "Enable 3DNow! instructions",
82 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000083def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000084 "Enable 3DNow! Athlon instructions",
85 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000086// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
87// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
88// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000089def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000090 "Support 64-bit instructions",
91 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000092def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000093 "64-bit with cmpxchg16b",
94 [Feature64Bit]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000095def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
96 "Bit testing of memory is slow">;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +000097def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
98 "SHLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +000099// FIXME: This should not apply to CPUs that do not have SSE.
100def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
101 "IsUAMem16Slow", "true",
102 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000103def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000104 "IsUAMem32Slow", "true",
105 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000106def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000107 "Support SSE 4a instructions",
108 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000109
Craig Topperf287a452012-01-09 09:02:13 +0000110def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
111 "Enable AVX instructions",
112 [FeatureSSE42]>;
113def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000114 "Enable AVX2 instructions",
115 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000116def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000117 "Enable AVX-512 instructions",
118 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000119def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000120 "Enable AVX-512 Exponential and Reciprocal Instructions",
121 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000122def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000123 "Enable AVX-512 Conflict Detection Instructions",
124 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000125def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000126 "Enable AVX-512 PreFetch Instructions",
127 [FeatureAVX512]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000128def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPFPREFETCHWT1",
129 "true",
130 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000131def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
132 "Enable AVX-512 Doubleword and Quadword Instructions",
133 [FeatureAVX512]>;
134def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
135 "Enable AVX-512 Byte and Word Instructions",
136 [FeatureAVX512]>;
137def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
138 "Enable AVX-512 Vector Length eXtensions",
139 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000140def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
141 "Enable AVX-512 Vector Bit Manipulation Instructions",
142 [FeatureAVX512]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000143def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000144 "Enable AVX-512 Integer Fused Multiple-Add",
145 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000146def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
147 "Enable protection keys">;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000148def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
149 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000150 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000151def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000152 "Enable three-operand fused multiple-add",
153 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000154def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000155 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000156 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000157def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000158 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000159 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000160def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
161 "HasSSEUnalignedMem", "true",
162 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000163def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000164 "Enable AES instructions",
165 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000166def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
167 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000168def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
169 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000170def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000171 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000172def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000173 "Support 16-bit floating point conversion instructions",
174 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000175def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
176 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000177def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
178 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000179def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
180 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000181def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
182 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000183def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
184 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000185def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
186 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000187def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
188 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000189def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
190 "Enable SHA instructions",
191 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000192def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
193 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000194def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
195 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000196def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
197 "Support LAHF and SAHF instructions">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000198def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
199 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000200def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000201 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000202def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
203 "HasSlowDivide32", "true",
204 "Use 8-bit divide for positive values less than 256">;
205def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
206 "HasSlowDivide64", "true",
207 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000208def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
209 "PadShortFunctions", "true",
210 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000211def FeatureINVPCID : SubtargetFeature<"invpcid", "HasInvPCId", "true",
212 "Invalidate Process-Context Identifier">;
213def FeatureVMFUNC : SubtargetFeature<"vmfunc", "HasVMFUNC", "true",
214 "VM Functions">;
215def FeatureSMAP : SubtargetFeature<"smap", "HasSMAP", "true",
216 "Supervisor Mode Access Protection">;
217def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
218 "Enable Software Guard Extensions">;
219def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
220 "Flush A Cache Line Optimized">;
221def FeaturePCOMMIT : SubtargetFeature<"pcommit", "HasPCOMMIT", "true",
222 "Enable Persistent Commit">;
223def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
224 "Cache Line Write Back">;
Michael Kuperstein454d1452015-07-23 12:23:45 +0000225// TODO: This feature ought to be renamed.
Sean Silvae1c6b542015-07-27 00:46:59 +0000226// What it really refers to are CPUs for which certain instructions
227// (which ones besides the example below?) are microcoded.
Michael Kuperstein454d1452015-07-23 12:23:45 +0000228// The best examples of this are the memory forms of CALL and PUSH
229// instructions, which should be avoided in favor of a MOV + register CALL/PUSH.
Preston Gurd663e6f92013-03-27 19:14:02 +0000230def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
231 "CallRegIndirect", "true",
232 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000233def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
234 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000235def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
236 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000237def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
238 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000239def FeatureSoftFloat
240 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
241 "Use software floating point features.">;
David Greene8f6f72c2009-06-26 22:46:54 +0000242
Evan Chengff1beda2006-10-06 09:17:41 +0000243//===----------------------------------------------------------------------===//
244// X86 processors supported.
245//===----------------------------------------------------------------------===//
246
Andrew Trick8523b162012-02-01 23:20:51 +0000247include "X86Schedule.td"
248
249def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
250 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000251def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
252 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000253
Evan Chengff1beda2006-10-06 09:17:41 +0000254class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000255 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000256
Sanjay Patel30145672015-09-01 20:51:51 +0000257def : Proc<"generic", [FeatureSlowUAMem16]>;
258def : Proc<"i386", [FeatureSlowUAMem16]>;
259def : Proc<"i486", [FeatureSlowUAMem16]>;
260def : Proc<"i586", [FeatureSlowUAMem16]>;
261def : Proc<"pentium", [FeatureSlowUAMem16]>;
262def : Proc<"pentium-mmx", [FeatureSlowUAMem16, FeatureMMX]>;
263def : Proc<"i686", [FeatureSlowUAMem16]>;
264def : Proc<"pentiumpro", [FeatureSlowUAMem16, FeatureCMOV]>;
Craig Topper09b65982015-10-16 06:03:09 +0000265def : Proc<"pentium2", [FeatureSlowUAMem16, FeatureMMX, FeatureCMOV,
266 FeatureFXSR]>;
267def : Proc<"pentium3", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
268 FeatureFXSR]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000269def : Proc<"pentium3m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
Craig Topper09b65982015-10-16 06:03:09 +0000270 FeatureFXSR, FeatureSlowBTMem]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000271def : Proc<"pentium-m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
Craig Topper09b65982015-10-16 06:03:09 +0000272 FeatureFXSR, FeatureSlowBTMem]>;
273def : Proc<"pentium4", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
274 FeatureFXSR]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000275def : Proc<"pentium4m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
Craig Topper09b65982015-10-16 06:03:09 +0000276 FeatureFXSR, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000277
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000278// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000279def : ProcessorModel<"yonah", SandyBridgeModel,
280 [FeatureSlowUAMem16, FeatureMMX, FeatureSSE3, FeatureFXSR,
281 FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000282
283// NetBurst.
Eric Christopher11e59832015-10-08 20:10:06 +0000284def : Proc<"prescott",
Craig Topper09b65982015-10-16 06:03:09 +0000285 [FeatureSlowUAMem16, FeatureMMX, FeatureSSE3, FeatureFXSR,
286 FeatureSlowBTMem]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000287def : Proc<"nocona", [
288 FeatureSlowUAMem16,
289 FeatureMMX,
290 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000291 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000292 FeatureCMPXCHG16B,
293 FeatureSlowBTMem
294]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000295
296// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000297def : ProcessorModel<"core2", SandyBridgeModel, [
298 FeatureSlowUAMem16,
299 FeatureMMX,
300 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000301 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000302 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000303 FeatureSlowBTMem,
304 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000305]>;
306def : ProcessorModel<"penryn", SandyBridgeModel, [
307 FeatureSlowUAMem16,
308 FeatureMMX,
309 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000310 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000311 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000312 FeatureSlowBTMem,
313 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000314]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000315
Chandler Carruthaf8924032014-12-09 10:58:36 +0000316// Atom CPUs.
317class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000318 ProcIntelAtom,
319 FeatureSlowUAMem16,
320 FeatureMMX,
321 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000322 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000323 FeatureCMPXCHG16B,
324 FeatureMOVBE,
325 FeatureSlowBTMem,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000326 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000327 FeatureSlowDivide32,
328 FeatureSlowDivide64,
329 FeatureCallRegIndirect,
330 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000331 FeaturePadShortFunctions,
332 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000333]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000334def : BonnellProc<"bonnell">;
335def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000336
Chandler Carruthaf8924032014-12-09 10:58:36 +0000337class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000338 ProcIntelSLM,
339 FeatureMMX,
340 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000341 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000342 FeatureCMPXCHG16B,
343 FeatureMOVBE,
344 FeaturePOPCNT,
345 FeaturePCLMUL,
346 FeatureAES,
347 FeatureSlowDivide64,
348 FeatureCallRegIndirect,
349 FeaturePRFCHW,
350 FeatureSlowLEA,
351 FeatureSlowIncDec,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000352 FeatureSlowBTMem,
353 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000354]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000355def : SilvermontProc<"silvermont">;
356def : SilvermontProc<"slm">; // Legacy alias.
357
Eric Christopher2ef63182010-04-02 21:54:27 +0000358// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000359class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000360 FeatureMMX,
361 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000362 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000363 FeatureCMPXCHG16B,
364 FeatureSlowBTMem,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000365 FeaturePOPCNT,
366 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000367]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000368def : NehalemProc<"nehalem">;
369def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000370
Eric Christopher2ef63182010-04-02 21:54:27 +0000371// Westmere is a similar machine to nehalem with some additional features.
372// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000373class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000374 FeatureMMX,
375 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000376 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000377 FeatureCMPXCHG16B,
378 FeatureSlowBTMem,
379 FeaturePOPCNT,
380 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000381 FeaturePCLMUL,
382 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000383]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000384def : WestmereProc<"westmere">;
385
Nate Begeman8b08f522010-12-10 00:26:57 +0000386// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
387// rather than a superset.
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000388def ProcIntelSNB : SubtargetFeature<"snb", "X86ProcFamily", "IntelSNB",
389 " Intel SandyBridge Processor", [
Eric Christopher11e59832015-10-08 20:10:06 +0000390 FeatureMMX,
391 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000392 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000393 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000394 FeaturePOPCNT,
395 FeatureAES,
Craig Topper0ee35692015-10-14 05:37:38 +0000396 FeaturePCLMUL,
397 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000398 FeatureXSAVEOPT,
399 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000400]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000401
402class SandyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
403 ProcIntelSNB,
404 FeatureSlowBTMem,
405 FeatureSlowUAMem32
406]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000407def : SandyBridgeProc<"sandybridge">;
408def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000409
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000410def ProcIntelIVB : SubtargetFeature<"ivb", "X86ProcFamily", "IntelIVB",
411 " Intel IvyBridge Processor", [
412 ProcIntelSNB,
Eric Christopher11e59832015-10-08 20:10:06 +0000413 FeatureRDRAND,
414 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000415 FeatureFSGSBase
416]>;
417
418class IvyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
419 ProcIntelIVB,
420 FeatureSlowBTMem,
421 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000422]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000423def : IvyBridgeProc<"ivybridge">;
424def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000425
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000426def ProcIntelHSW : SubtargetFeature<"hsw", "X86ProcFamily", "IntelHSW",
427 " Intel Haswell Processor", [
428 ProcIntelIVB,
Eric Christopher11e59832015-10-08 20:10:06 +0000429 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000430 FeatureBMI,
431 FeatureBMI2,
432 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000433 FeatureLZCNT,
434 FeatureMOVBE,
435 FeatureINVPCID,
436 FeatureVMFUNC,
Eric Christopher11e59832015-10-08 20:10:06 +0000437 FeatureRTM,
438 FeatureHLE,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000439 FeatureSlowIncDec
Eric Christopher11e59832015-10-08 20:10:06 +0000440]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000441
442class HaswellProc<string Name> : ProcessorModel<Name, HaswellModel,
443 [ProcIntelHSW]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000444def : HaswellProc<"haswell">;
445def : HaswellProc<"core-avx2">; // Legacy alias.
446
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000447def ProcIntelBDW : SubtargetFeature<"bdw", "X86ProcFamily", "IntelBDW",
448 " Intel Broadwell Processor", [
449 ProcIntelHSW,
Eric Christopher11e59832015-10-08 20:10:06 +0000450 FeatureADX,
451 FeatureRDSEED,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000452 FeatureSMAP
Eric Christopher11e59832015-10-08 20:10:06 +0000453]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000454class BroadwellProc<string Name> : ProcessorModel<Name, HaswellModel,
455 [ProcIntelBDW]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000456def : BroadwellProc<"broadwell">;
457
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000458def ProcIntelSKL : SubtargetFeature<"skl", "X86ProcFamily", "IntelSKL",
459 " Intel Skylake Client Processor", [
460 ProcIntelBDW,
461 FeatureMPX,
462 FeatureXSAVEC,
463 FeatureXSAVES,
464 FeatureSGX,
465 FeatureCLFLUSHOPT
466]>;
467
468// FIXME: define SKL model
469class SkylakeClientProc<string Name> : ProcessorModel<Name, HaswellModel,
470 [ProcIntelSKL]>;
471def : SkylakeClientProc<"skl">;
472
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000473// FIXME: define KNL model
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000474class KnightsLandingProc<string Name> : ProcessorModel<Name, HaswellModel,[
475 ProcIntelIVB,
Eric Christopher11e59832015-10-08 20:10:06 +0000476 FeatureAVX512,
477 FeatureERI,
478 FeatureCDI,
479 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000480 FeaturePREFETCHWT1,
481 FeatureADX,
482 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000483 FeatureMOVBE,
484 FeatureLZCNT,
485 FeatureBMI,
486 FeatureBMI2,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000487 FeatureFMA
Eric Christopher11e59832015-10-08 20:10:06 +0000488]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000489def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000490
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000491def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily", "IntelSKX",
492 " Intel Skylake Server Processor", [
493 ProcIntelSKL,
Eric Christopher11e59832015-10-08 20:10:06 +0000494 FeatureAVX512,
495 FeatureCDI,
496 FeatureDQI,
497 FeatureBWI,
498 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000499 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000500 FeaturePCOMMIT,
501 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000502]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000503
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000504// FIXME: define SKX model
505class SkylakeServerProc<string Name> : ProcessorModel<Name, HaswellModel,
506 [ ProcIntelSKX]>;
507def : SkylakeServerProc<"skylake">;
508def : SkylakeServerProc<"skx">; // Legacy alias.
509
510def ProcIntelCNL : SubtargetFeature<"cnl", "X86ProcFamily", "IntelCNL",
511 " Intel Cannonlake Processor", [
512 ProcIntelSKX,
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000513 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000514 FeatureIFMA,
515 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000516]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000517
518class CannonlakeProc<string Name> : ProcessorModel<Name, HaswellModel,
519 [ ProcIntelCNL ]>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000520def : CannonlakeProc<"cannonlake">;
521def : CannonlakeProc<"cnl">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000522
523// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000524
Sanjay Patel30145672015-09-01 20:51:51 +0000525def : Proc<"k6", [FeatureSlowUAMem16, FeatureMMX]>;
526def : Proc<"k6-2", [FeatureSlowUAMem16, Feature3DNow]>;
527def : Proc<"k6-3", [FeatureSlowUAMem16, Feature3DNow]>;
528def : Proc<"athlon", [FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000529 FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000530def : Proc<"athlon-tbird", [FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000531 FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000532def : Proc<"athlon-4", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000533 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000534def : Proc<"athlon-xp", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000535 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000536def : Proc<"athlon-mp", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000537 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000538def : Proc<"k8", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000539 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000540 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000541def : Proc<"opteron", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000542 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000543 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000544def : Proc<"athlon64", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000545 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000546 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000547def : Proc<"athlon-fx", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000548 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000549 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000550def : Proc<"k8-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000551 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000552 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000553def : Proc<"opteron-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000554 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000555 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000556def : Proc<"athlon64-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000557 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000558 FeatureSlowSHLD]>;
Craig Topper09b65982015-10-16 06:03:09 +0000559def : Proc<"amdfam10", [FeatureSSE4A, Feature3DNowA, FeatureFXSR,
560 FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
Hans Wennborgfbf28222015-12-04 23:32:19 +0000561 FeatureSlowBTMem, FeatureSlowSHLD, FeatureLAHFSAHF]>;
Craig Topper09b65982015-10-16 06:03:09 +0000562def : Proc<"barcelona", [FeatureSSE4A, Feature3DNowA, FeatureFXSR,
563 FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000564 FeatureSlowBTMem, FeatureSlowSHLD, FeatureLAHFSAHF]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000565
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000566// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000567def : Proc<"btver1", [
568 FeatureMMX,
569 FeatureSSSE3,
570 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000571 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000572 FeatureCMPXCHG16B,
573 FeaturePRFCHW,
574 FeatureLZCNT,
575 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000576 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000577 FeatureSlowSHLD,
578 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000579]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000580
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000581// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000582def : ProcessorModel<"btver2", BtVer2Model, [
583 FeatureMMX,
584 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000585 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000586 FeatureSSE4A,
587 FeatureCMPXCHG16B,
588 FeaturePRFCHW,
589 FeatureAES,
590 FeaturePCLMUL,
591 FeatureBMI,
592 FeatureF16C,
593 FeatureMOVBE,
594 FeatureLZCNT,
595 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000596 FeatureXSAVE,
597 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000598 FeatureSlowSHLD,
599 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000600]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000601
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000602// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000603def : Proc<"bdver1", [
604 FeatureXOP,
605 FeatureFMA4,
606 FeatureCMPXCHG16B,
607 FeatureAES,
608 FeaturePRFCHW,
609 FeaturePCLMUL,
610 FeatureMMX,
611 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000612 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000613 FeatureSSE4A,
614 FeatureLZCNT,
615 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000616 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000617 FeatureSlowSHLD,
618 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000619]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000620// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000621def : Proc<"bdver2", [
622 FeatureXOP,
623 FeatureFMA4,
624 FeatureCMPXCHG16B,
625 FeatureAES,
626 FeaturePRFCHW,
627 FeaturePCLMUL,
628 FeatureMMX,
629 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000630 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000631 FeatureSSE4A,
632 FeatureF16C,
633 FeatureLZCNT,
634 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000635 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000636 FeatureBMI,
637 FeatureTBM,
638 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000639 FeatureSlowSHLD,
640 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000641]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000642
643// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000644def : Proc<"bdver3", [
645 FeatureXOP,
646 FeatureFMA4,
647 FeatureCMPXCHG16B,
648 FeatureAES,
649 FeaturePRFCHW,
650 FeaturePCLMUL,
651 FeatureMMX,
652 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000653 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000654 FeatureSSE4A,
655 FeatureF16C,
656 FeatureLZCNT,
657 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000658 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000659 FeatureBMI,
660 FeatureTBM,
661 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000662 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000663 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000664 FeatureFSGSBase,
665 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000666]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000667
Benjamin Kramer60045732014-05-02 15:47:07 +0000668// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000669def : Proc<"bdver4", [
670 FeatureMMX,
671 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000672 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000673 FeatureXOP,
674 FeatureFMA4,
675 FeatureCMPXCHG16B,
676 FeatureAES,
677 FeaturePRFCHW,
678 FeaturePCLMUL,
679 FeatureF16C,
680 FeatureLZCNT,
681 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000682 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000683 FeatureBMI,
684 FeatureBMI2,
685 FeatureTBM,
686 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000687 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000688 FeatureFSGSBase,
689 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000690]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000691
Sanjay Patel30145672015-09-01 20:51:51 +0000692def : Proc<"geode", [FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000693
Sanjay Patel30145672015-09-01 20:51:51 +0000694def : Proc<"winchip-c6", [FeatureSlowUAMem16, FeatureMMX]>;
695def : Proc<"winchip2", [FeatureSlowUAMem16, Feature3DNow]>;
696def : Proc<"c3", [FeatureSlowUAMem16, Feature3DNow]>;
Craig Topper09b65982015-10-16 06:03:09 +0000697def : Proc<"c3-2", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000698
Chandler Carruth32908d72014-05-07 17:37:03 +0000699// We also provide a generic 64-bit specific x86 processor model which tries to
700// be good for modern chips without enabling instruction set encodings past the
701// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
702// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000703//
Chandler Carruth32908d72014-05-07 17:37:03 +0000704// We currently use the Sandy Bridge model as the default scheduling model as
705// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
706// covers a huge swath of x86 processors. If there are specific scheduling
707// knobs which need to be tuned differently for AMD chips, we might consider
708// forming a common base for them.
Craig Topper09b65982015-10-16 06:03:09 +0000709def : ProcessorModel<"x86-64", SandyBridgeModel,
710 [FeatureMMX, FeatureSSE2, FeatureFXSR, Feature64Bit,
711 FeatureSlowBTMem ]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000712
Evan Chengff1beda2006-10-06 09:17:41 +0000713//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000714// Register File Description
715//===----------------------------------------------------------------------===//
716
717include "X86RegisterInfo.td"
718
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000719//===----------------------------------------------------------------------===//
720// Instruction Descriptions
721//===----------------------------------------------------------------------===//
722
Chris Lattner59a4a912003-08-03 21:54:21 +0000723include "X86InstrInfo.td"
724
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000725def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000726
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000727//===----------------------------------------------------------------------===//
728// Calling Conventions
729//===----------------------------------------------------------------------===//
730
731include "X86CallingConv.td"
732
733
734//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000735// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000736//===----------------------------------------------------------------------===//
737
Devang Patel85d684a2012-01-09 19:13:28 +0000738def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000739 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000740
Chad Rosier9f7a2212013-04-18 22:35:36 +0000741 // Variant name.
742 string Name = "att";
743
Daniel Dunbare4318712009-08-11 20:59:47 +0000744 // Discard comments in assembly strings.
745 string CommentDelimiter = "#";
746
747 // Recognize hard coded registers.
748 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000749}
750
Devang Patel67bf992a2012-01-10 17:51:54 +0000751def IntelAsmParserVariant : AsmParserVariant {
752 int Variant = 1;
753
Chad Rosier9f7a2212013-04-18 22:35:36 +0000754 // Variant name.
755 string Name = "intel";
756
Devang Patel67bf992a2012-01-10 17:51:54 +0000757 // Discard comments in assembly strings.
758 string CommentDelimiter = ";";
759
760 // Recognize hard coded registers.
761 string RegisterPrefix = "";
762}
763
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000764//===----------------------------------------------------------------------===//
765// Assembly Printers
766//===----------------------------------------------------------------------===//
767
Chris Lattner56832602004-10-03 20:36:57 +0000768// The X86 target supports two different syntaxes for emitting machine code.
769// This is controlled by the -x86-asm-syntax={att|intel}
770def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000771 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000772 int Variant = 0;
773}
774def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000775 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000776 int Variant = 1;
777}
778
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000779def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000780 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000781 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +0000782 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000783 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000784}