blob: 7001910a61e6e6fc0cac80ff26174d513e330407 [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
David Greene206351a2010-01-11 16:29:42 +000040
Bill Wendlinge6182262007-05-04 20:38:40 +000041def FeatureMMX : SubtargetFeature<"mmx","X86SSELevel", "MMX",
42 "Enable MMX instructions">;
43def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
44 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000045 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000046 // SSE1+ processors support them.
Chris Lattnercc8c5812009-09-02 05:53:04 +000047 [FeatureMMX, FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000048def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
49 "Enable SSE2 instructions",
50 [FeatureSSE1]>;
51def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
52 "Enable SSE3 instructions",
53 [FeatureSSE2]>;
54def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
55 "Enable SSSE3 instructions",
56 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000057def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000058 "Enable SSE 4.1 instructions",
59 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000060def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000061 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000062 [FeatureSSE41]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000063def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000064 "Enable 3DNow! instructions",
65 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000066def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000067 "Enable 3DNow! Athlon instructions",
68 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000069// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
70// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
71// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000072def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000073 "Support 64-bit instructions",
74 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000075def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000076 "64-bit with cmpxchg16b",
77 [Feature64Bit]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000078def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
79 "Bit testing of memory is slow">;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +000080def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
81 "SHLD instruction is slow">;
Sanjay Patele57f3c02014-11-28 18:40:18 +000082// FIXME: This is a 16-byte (SSE/AVX) feature; we should rename it to make that
83// explicit. Also, it seems this would be the default state for most chips
84// going forward, so it would probably be better to negate the logic and
85// match the 32-byte "slow mem" feature below.
Evan Cheng738b0f92010-04-01 05:58:17 +000086def FeatureFastUAMem : SubtargetFeature<"fast-unaligned-mem",
87 "IsUAMemFast", "true",
88 "Fast unaligned memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +000089def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
90 "IsUAMem32Slow", "true",
91 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +000092def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +000093 "Support SSE 4a instructions",
94 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +000095
Craig Topperf287a452012-01-09 09:02:13 +000096def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
97 "Enable AVX instructions",
98 [FeatureSSE42]>;
99def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000100 "Enable AVX2 instructions",
101 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000102def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000103 "Enable AVX-512 instructions",
104 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000105def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000106 "Enable AVX-512 Exponential and Reciprocal Instructions",
107 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000108def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000109 "Enable AVX-512 Conflict Detection Instructions",
110 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000111def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000112 "Enable AVX-512 PreFetch Instructions",
113 [FeatureAVX512]>;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000114def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
115 "Enable AVX-512 Doubleword and Quadword Instructions",
116 [FeatureAVX512]>;
117def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
118 "Enable AVX-512 Byte and Word Instructions",
119 [FeatureAVX512]>;
120def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
121 "Enable AVX-512 Vector Length eXtensions",
122 [FeatureAVX512]>;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000123def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
124 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000125 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000126def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000127 "Enable three-operand fused multiple-add",
128 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000129def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000130 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000131 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000132def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000133 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000134 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000135def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
136 "HasSSEUnalignedMem", "true",
137 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000138def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000139 "Enable AES instructions",
140 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000141def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
142 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000143def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
144 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000145def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000146 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000147def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000148 "Support 16-bit floating point conversion instructions",
149 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000150def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
151 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000152def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
153 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000154def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
155 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000156def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
157 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000158def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
159 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000160def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
161 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000162def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
163 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000164def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
165 "Enable SHA instructions",
166 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000167def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
168 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000169def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
170 "Support RDSEED instruction">;
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000171def FeatureLeaForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
172 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000173def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
174 "HasSlowDivide32", "true",
175 "Use 8-bit divide for positive values less than 256">;
176def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
177 "HasSlowDivide64", "true",
178 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000179def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
180 "PadShortFunctions", "true",
181 "Pad short functions">;
Preston Gurd663e6f92013-03-27 19:14:02 +0000182def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
183 "CallRegIndirect", "true",
184 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000185def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
186 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000187def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
188 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000189def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
190 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000191def FeatureSoftFloat
192 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
193 "Use software floating point features.">;
David Greene8f6f72c2009-06-26 22:46:54 +0000194
Evan Chengff1beda2006-10-06 09:17:41 +0000195//===----------------------------------------------------------------------===//
196// X86 processors supported.
197//===----------------------------------------------------------------------===//
198
Andrew Trick8523b162012-02-01 23:20:51 +0000199include "X86Schedule.td"
200
201def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
202 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000203def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
204 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000205
Evan Chengff1beda2006-10-06 09:17:41 +0000206class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000207 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000208
Evan Chengff1beda2006-10-06 09:17:41 +0000209def : Proc<"generic", []>;
210def : Proc<"i386", []>;
211def : Proc<"i486", []>;
Dale Johannesen28106752008-10-14 22:06:33 +0000212def : Proc<"i586", []>;
Evan Chengff1beda2006-10-06 09:17:41 +0000213def : Proc<"pentium", []>;
214def : Proc<"pentium-mmx", [FeatureMMX]>;
215def : Proc<"i686", []>;
Chris Lattnercc8c5812009-09-02 05:53:04 +0000216def : Proc<"pentiumpro", [FeatureCMOV]>;
217def : Proc<"pentium2", [FeatureMMX, FeatureCMOV]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000218def : Proc<"pentium3", [FeatureSSE1]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000219def : Proc<"pentium3m", [FeatureSSE1, FeatureSlowBTMem]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +0000220def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000221def : Proc<"pentium4", [FeatureSSE2]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000222def : Proc<"pentium4m", [FeatureSSE2, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000223
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000224// Intel Core Duo.
225def : ProcessorModel<"yonah", SandyBridgeModel,
226 [FeatureSSE3, FeatureSlowBTMem]>;
227
228// NetBurst.
229def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>;
230def : Proc<"nocona", [FeatureSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
231
232// Intel Core 2 Solo/Duo.
233def : ProcessorModel<"core2", SandyBridgeModel,
234 [FeatureSSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
235def : ProcessorModel<"penryn", SandyBridgeModel,
236 [FeatureSSE41, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
237
Chandler Carruthaf8924032014-12-09 10:58:36 +0000238// Atom CPUs.
239class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
240 ProcIntelAtom,
241 FeatureSSSE3,
242 FeatureCMPXCHG16B,
243 FeatureMOVBE,
244 FeatureSlowBTMem,
245 FeatureLeaForSP,
246 FeatureSlowDivide32,
247 FeatureSlowDivide64,
248 FeatureCallRegIndirect,
249 FeatureLEAUsesAG,
250 FeaturePadShortFunctions
251 ]>;
252def : BonnellProc<"bonnell">;
253def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000254
Chandler Carruthaf8924032014-12-09 10:58:36 +0000255class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
256 ProcIntelSLM,
257 FeatureSSE42,
258 FeatureCMPXCHG16B,
259 FeatureMOVBE,
260 FeaturePOPCNT,
261 FeaturePCLMUL,
262 FeatureAES,
263 FeatureSlowDivide64,
264 FeatureCallRegIndirect,
265 FeaturePRFCHW,
266 FeatureSlowLEA,
267 FeatureSlowIncDec,
268 FeatureSlowBTMem,
269 FeatureFastUAMem
270 ]>;
271def : SilvermontProc<"silvermont">;
272def : SilvermontProc<"slm">; // Legacy alias.
273
Eric Christopher2ef63182010-04-02 21:54:27 +0000274// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000275class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
276 FeatureSSE42,
277 FeatureCMPXCHG16B,
278 FeatureSlowBTMem,
279 FeatureFastUAMem,
280 FeaturePOPCNT
281 ]>;
282def : NehalemProc<"nehalem">;
283def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000284
Eric Christopher2ef63182010-04-02 21:54:27 +0000285// Westmere is a similar machine to nehalem with some additional features.
286// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000287class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
288 FeatureSSE42,
289 FeatureCMPXCHG16B,
290 FeatureSlowBTMem,
291 FeatureFastUAMem,
292 FeaturePOPCNT,
293 FeatureAES,
294 FeaturePCLMUL
295 ]>;
296def : WestmereProc<"westmere">;
297
Nate Begeman8b08f522010-12-10 00:26:57 +0000298// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
299// rather than a superset.
Chandler Carruthaf8924032014-12-09 10:58:36 +0000300class SandyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
301 FeatureAVX,
302 FeatureCMPXCHG16B,
303 FeatureFastUAMem,
304 FeatureSlowUAMem32,
305 FeaturePOPCNT,
306 FeatureAES,
307 FeaturePCLMUL
308 ]>;
309def : SandyBridgeProc<"sandybridge">;
310def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000311
Chandler Carruthaf8924032014-12-09 10:58:36 +0000312class IvyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
313 FeatureAVX,
314 FeatureCMPXCHG16B,
315 FeatureFastUAMem,
316 FeatureSlowUAMem32,
317 FeaturePOPCNT,
318 FeatureAES,
319 FeaturePCLMUL,
320 FeatureRDRAND,
321 FeatureF16C,
322 FeatureFSGSBase
323 ]>;
324def : IvyBridgeProc<"ivybridge">;
325def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000326
Chandler Carruthaf8924032014-12-09 10:58:36 +0000327class HaswellProc<string Name> : ProcessorModel<Name, HaswellModel, [
328 FeatureAVX2,
329 FeatureCMPXCHG16B,
330 FeatureFastUAMem,
331 FeaturePOPCNT,
332 FeatureAES,
333 FeaturePCLMUL,
334 FeatureRDRAND,
335 FeatureF16C,
336 FeatureFSGSBase,
337 FeatureMOVBE,
338 FeatureLZCNT,
339 FeatureBMI,
340 FeatureBMI2,
341 FeatureFMA,
342 FeatureRTM,
343 FeatureHLE,
344 FeatureSlowIncDec
345 ]>;
346def : HaswellProc<"haswell">;
347def : HaswellProc<"core-avx2">; // Legacy alias.
348
349class BroadwellProc<string Name> : ProcessorModel<Name, HaswellModel, [
350 FeatureAVX2,
351 FeatureCMPXCHG16B,
352 FeatureFastUAMem,
353 FeaturePOPCNT,
354 FeatureAES,
355 FeaturePCLMUL,
356 FeatureRDRAND,
357 FeatureF16C,
358 FeatureFSGSBase,
359 FeatureMOVBE,
360 FeatureLZCNT,
361 FeatureBMI,
362 FeatureBMI2,
363 FeatureFMA,
364 FeatureRTM,
365 FeatureHLE,
366 FeatureADX,
367 FeatureRDSEED,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000368 FeatureSlowIncDec
369 ]>;
370def : BroadwellProc<"broadwell">;
371
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000372// FIXME: define KNL model
Chandler Carruthaf8924032014-12-09 10:58:36 +0000373class KnightsLandingProc<string Name> : ProcessorModel<Name, HaswellModel,
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000374 [FeatureAVX512, FeatureERI, FeatureCDI, FeaturePFI,
375 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
376 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
377 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
Elena Demikhovsky678bd5b2014-07-02 14:11:05 +0000378 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
Sanjay Patelffd039b2015-02-03 17:13:04 +0000379 FeatureSlowIncDec]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000380def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000381
Robert Khasanovbfa01312014-07-21 14:54:21 +0000382// FIXME: define SKX model
Chandler Carruthaf8924032014-12-09 10:58:36 +0000383class SkylakeProc<string Name> : ProcessorModel<Name, HaswellModel,
Robert Khasanovbfa01312014-07-21 14:54:21 +0000384 [FeatureAVX512, FeatureCDI,
385 FeatureDQI, FeatureBWI, FeatureVLX,
386 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
387 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
388 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
389 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
Craig Toppera898c2d2015-02-05 08:51:02 +0000390 FeatureSlowIncDec]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000391def : SkylakeProc<"skylake">;
392def : SkylakeProc<"skx">; // Legacy alias.
393
394
395// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000396
Evan Chengff1beda2006-10-06 09:17:41 +0000397def : Proc<"k6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000398def : Proc<"k6-2", [Feature3DNow]>;
399def : Proc<"k6-3", [Feature3DNow]>;
Alexey Volkovbb2f0472014-03-07 08:28:44 +0000400def : Proc<"athlon", [Feature3DNowA, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000401 FeatureSlowSHLD]>;
402def : Proc<"athlon-tbird", [Feature3DNowA, FeatureSlowBTMem,
403 FeatureSlowSHLD]>;
Michael Liao5bf95782014-12-04 05:20:33 +0000404def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000405 FeatureSlowSHLD]>;
406def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
407 FeatureSlowSHLD]>;
408def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
409 FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000410def : Proc<"k8", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000411 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000412def : Proc<"opteron", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000413 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000414def : Proc<"athlon64", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000415 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000416def : Proc<"athlon-fx", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000417 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000418def : Proc<"k8-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000419 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000420def : Proc<"opteron-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000421 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000422def : Proc<"athlon64-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000423 FeatureSlowBTMem, FeatureSlowSHLD]>;
Craig Topperbae0e9e2012-05-01 06:54:48 +0000424def : Proc<"amdfam10", [FeatureSSE4A,
Benjamin Kramer5feb3da2011-11-30 15:48:16 +0000425 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000426 FeaturePOPCNT, FeatureSlowBTMem,
427 FeatureSlowSHLD]>;
Chandler Carruthf57ac3b2014-12-09 14:25:55 +0000428def : Proc<"barcelona", [FeatureSSE4A,
429 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
430 FeaturePOPCNT, FeatureSlowBTMem,
431 FeatureSlowSHLD]>;
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000432// Bobcat
433def : Proc<"btver1", [FeatureSSSE3, FeatureSSE4A, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000434 FeaturePRFCHW, FeatureLZCNT, FeaturePOPCNT,
435 FeatureSlowSHLD]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000436
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000437// Jaguar
Sanjay Patel1191adf2014-09-09 20:07:07 +0000438def : ProcessorModel<"btver2", BtVer2Model,
439 [FeatureAVX, FeatureSSE4A, FeatureCMPXCHG16B,
440 FeaturePRFCHW, FeatureAES, FeaturePCLMUL,
441 FeatureBMI, FeatureF16C, FeatureMOVBE,
Sanjay Patele57f3c02014-11-28 18:40:18 +0000442 FeatureLZCNT, FeaturePOPCNT, FeatureFastUAMem,
Sanjay Patel6f031d82015-06-02 15:28:15 +0000443 FeatureSlowSHLD]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000444
445// TODO: We should probably add 'FeatureFastUAMem' to all of the AMD chips.
Sanjay Patel1191adf2014-09-09 20:07:07 +0000446
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000447// Bulldozer
Craig Topperbae0e9e2012-05-01 06:54:48 +0000448def : Proc<"bdver1", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000449 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000450 FeatureAVX, FeatureSSE4A, FeatureLZCNT,
451 FeaturePOPCNT, FeatureSlowSHLD]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000452// Piledriver
Craig Topperbae0e9e2012-05-01 06:54:48 +0000453def : Proc<"bdver2", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000454 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000455 FeatureAVX, FeatureSSE4A, FeatureF16C,
456 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
457 FeatureTBM, FeatureFMA, FeatureSlowSHLD]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000458
459// Steamroller
460def : Proc<"bdver3", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
461 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000462 FeatureAVX, FeatureSSE4A, FeatureF16C,
463 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
464 FeatureTBM, FeatureFMA, FeatureSlowSHLD,
465 FeatureFSGSBase]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000466
Benjamin Kramer60045732014-05-02 15:47:07 +0000467// Excavator
468def : Proc<"bdver4", [FeatureAVX2, FeatureXOP, FeatureFMA4,
469 FeatureCMPXCHG16B, FeatureAES, FeaturePRFCHW,
470 FeaturePCLMUL, FeatureF16C, FeatureLZCNT,
471 FeaturePOPCNT, FeatureBMI, FeatureBMI2,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000472 FeatureTBM, FeatureFMA, FeatureSSE4A,
473 FeatureFSGSBase]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000474
Roman Divackyfd690092012-09-12 14:36:02 +0000475def : Proc<"geode", [Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000476
477def : Proc<"winchip-c6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000478def : Proc<"winchip2", [Feature3DNow]>;
479def : Proc<"c3", [Feature3DNow]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000480def : Proc<"c3-2", [FeatureSSE1]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000481
Chandler Carruth32908d72014-05-07 17:37:03 +0000482// We also provide a generic 64-bit specific x86 processor model which tries to
483// be good for modern chips without enabling instruction set encodings past the
484// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
485// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000486//
Chandler Carruth32908d72014-05-07 17:37:03 +0000487// We currently use the Sandy Bridge model as the default scheduling model as
488// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
489// covers a huge swath of x86 processors. If there are specific scheduling
490// knobs which need to be tuned differently for AMD chips, we might consider
491// forming a common base for them.
492def : ProcessorModel<"x86-64", SandyBridgeModel,
493 [FeatureSSE2, Feature64Bit, FeatureSlowBTMem,
494 FeatureFastUAMem]>;
495
Evan Chengff1beda2006-10-06 09:17:41 +0000496//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000497// Register File Description
498//===----------------------------------------------------------------------===//
499
500include "X86RegisterInfo.td"
501
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000502//===----------------------------------------------------------------------===//
503// Instruction Descriptions
504//===----------------------------------------------------------------------===//
505
Chris Lattner59a4a912003-08-03 21:54:21 +0000506include "X86InstrInfo.td"
507
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000508def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000509
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000510//===----------------------------------------------------------------------===//
511// Calling Conventions
512//===----------------------------------------------------------------------===//
513
514include "X86CallingConv.td"
515
516
517//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000518// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000519//===----------------------------------------------------------------------===//
520
Daniel Dunbar00331992009-07-29 00:02:19 +0000521def ATTAsmParser : AsmParser {
Devang Patel4a6e7782012-01-12 18:03:40 +0000522 string AsmParserClassName = "AsmParser";
Devang Patel85d684a2012-01-09 19:13:28 +0000523}
524
525def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000526 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000527
Chad Rosier9f7a2212013-04-18 22:35:36 +0000528 // Variant name.
529 string Name = "att";
530
Daniel Dunbare4318712009-08-11 20:59:47 +0000531 // Discard comments in assembly strings.
532 string CommentDelimiter = "#";
533
534 // Recognize hard coded registers.
535 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000536}
537
Devang Patel67bf992a2012-01-10 17:51:54 +0000538def IntelAsmParserVariant : AsmParserVariant {
539 int Variant = 1;
540
Chad Rosier9f7a2212013-04-18 22:35:36 +0000541 // Variant name.
542 string Name = "intel";
543
Devang Patel67bf992a2012-01-10 17:51:54 +0000544 // Discard comments in assembly strings.
545 string CommentDelimiter = ";";
546
547 // Recognize hard coded registers.
548 string RegisterPrefix = "";
549}
550
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000551//===----------------------------------------------------------------------===//
552// Assembly Printers
553//===----------------------------------------------------------------------===//
554
Chris Lattner56832602004-10-03 20:36:57 +0000555// The X86 target supports two different syntaxes for emitting machine code.
556// This is controlled by the -x86-asm-syntax={att|intel}
557def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000558 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000559 int Variant = 0;
560}
561def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000562 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000563 int Variant = 1;
564}
565
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000566def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000567 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000568 let InstructionSet = X86InstrInfo;
Daniel Dunbar00331992009-07-29 00:02:19 +0000569 let AssemblyParsers = [ATTAsmParser];
Devang Patel67bf992a2012-01-10 17:51:54 +0000570 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000571 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000572}