blob: 8fcc85b4dd6877aa8ded76f7da5009ea80114b56 [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]>;
David Greene206351a2010-01-11 16:29:42 +0000135def FeatureVectorUAMem : SubtargetFeature<"vector-unaligned-mem",
136 "HasVectorUAMem", "true",
137 "Allow unaligned memory operands on vector/SIMD 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]>;
Kevin Enderby0d928a12014-07-31 23:57:38 +0000167def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
168 "Support SGX instructions">;
Michael Liao5173ee02013-03-26 17:47:11 +0000169def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
170 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000171def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
172 "Support RDSEED instruction">;
Robert Khasanov98441b62014-08-21 09:16:12 +0000173def FeatureSMAP : SubtargetFeature<"smap", "HasSMAP", "true",
174 "Support SMAP instructions">;
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000175def FeatureLeaForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
176 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000177def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
178 "HasSlowDivide32", "true",
179 "Use 8-bit divide for positive values less than 256">;
180def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
181 "HasSlowDivide64", "true",
182 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000183def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
184 "PadShortFunctions", "true",
185 "Pad short functions">;
Preston Gurd663e6f92013-03-27 19:14:02 +0000186def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
187 "CallRegIndirect", "true",
188 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000189def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
190 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000191def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
192 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000193def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
194 "INC and DEC instructions are slower than ADD and SUB">;
Sanjay Patel957efc232014-10-24 17:02:16 +0000195def FeatureUseSqrtEst : SubtargetFeature<"use-sqrt-est", "UseSqrtEst", "true",
196 "Use RSQRT* to optimize square root calculations">;
Sanjay Patele2e58922014-11-11 20:51:00 +0000197def FeatureUseRecipEst : SubtargetFeature<"use-recip-est", "UseReciprocalEst",
198 "true", "Use RCP* to optimize division calculations">;
David Greene8f6f72c2009-06-26 22:46:54 +0000199
Evan Chengff1beda2006-10-06 09:17:41 +0000200//===----------------------------------------------------------------------===//
201// X86 processors supported.
202//===----------------------------------------------------------------------===//
203
Andrew Trick8523b162012-02-01 23:20:51 +0000204include "X86Schedule.td"
205
206def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
207 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000208def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
209 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000210
Evan Chengff1beda2006-10-06 09:17:41 +0000211class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000212 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000213
Evan Chengff1beda2006-10-06 09:17:41 +0000214def : Proc<"generic", []>;
215def : Proc<"i386", []>;
216def : Proc<"i486", []>;
Dale Johannesen28106752008-10-14 22:06:33 +0000217def : Proc<"i586", []>;
Evan Chengff1beda2006-10-06 09:17:41 +0000218def : Proc<"pentium", []>;
219def : Proc<"pentium-mmx", [FeatureMMX]>;
220def : Proc<"i686", []>;
Chris Lattnercc8c5812009-09-02 05:53:04 +0000221def : Proc<"pentiumpro", [FeatureCMOV]>;
222def : Proc<"pentium2", [FeatureMMX, FeatureCMOV]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000223def : Proc<"pentium3", [FeatureSSE1]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000224def : Proc<"pentium3m", [FeatureSSE1, FeatureSlowBTMem]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +0000225def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000226def : Proc<"pentium4", [FeatureSSE2]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000227def : Proc<"pentium4m", [FeatureSSE2, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000228
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000229// Intel Core Duo.
230def : ProcessorModel<"yonah", SandyBridgeModel,
231 [FeatureSSE3, FeatureSlowBTMem]>;
232
233// NetBurst.
234def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>;
235def : Proc<"nocona", [FeatureSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
236
237// Intel Core 2 Solo/Duo.
238def : ProcessorModel<"core2", SandyBridgeModel,
239 [FeatureSSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
240def : ProcessorModel<"penryn", SandyBridgeModel,
241 [FeatureSSE41, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
242
243// Atom.
244def : ProcessorModel<"atom", AtomModel,
245 [ProcIntelAtom, FeatureSSSE3, FeatureCMPXCHG16B,
246 FeatureMOVBE, FeatureSlowBTMem, FeatureLeaForSP,
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000247 FeatureSlowDivide32, FeatureSlowDivide64,
Preston Gurd663e6f92013-03-27 19:14:02 +0000248 FeatureCallRegIndirect,
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000249 FeatureLEAUsesAG,
Preston Gurd663e6f92013-03-27 19:14:02 +0000250 FeaturePadShortFunctions]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000251
Preston Gurd3fe264d2013-09-13 19:23:28 +0000252// Atom Silvermont.
253def : ProcessorModel<"slm", SLMModel, [ProcIntelSLM,
254 FeatureSSE42, FeatureCMPXCHG16B,
255 FeatureMOVBE, FeaturePOPCNT,
256 FeaturePCLMUL, FeatureAES,
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000257 FeatureSlowDivide64,
Preston Gurd3fe264d2013-09-13 19:23:28 +0000258 FeatureCallRegIndirect,
259 FeaturePRFCHW,
Alexey Volkov5260dba2014-06-09 11:40:41 +0000260 FeatureSlowLEA, FeatureSlowIncDec,
Alexey Volkov1051f042014-03-07 09:03:49 +0000261 FeatureSlowBTMem, FeatureFastUAMem]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000262// "Arrandale" along with corei3 and corei5
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000263def : ProcessorModel<"corei7", SandyBridgeModel,
264 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
265 FeatureFastUAMem, FeaturePOPCNT, FeatureAES]>;
266
267def : ProcessorModel<"nehalem", SandyBridgeModel,
268 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
269 FeatureFastUAMem, FeaturePOPCNT]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000270// Westmere is a similar machine to nehalem with some additional features.
271// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000272def : ProcessorModel<"westmere", SandyBridgeModel,
273 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
274 FeatureFastUAMem, FeaturePOPCNT, FeatureAES,
275 FeaturePCLMUL]>;
Benjamin Kramer874c5192011-10-10 19:35:07 +0000276// Sandy Bridge
Nate Begeman8b08f522010-12-10 00:26:57 +0000277// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
278// rather than a superset.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000279def : ProcessorModel<"corei7-avx", SandyBridgeModel,
280 [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
Sanjay Patel501890e2014-11-21 17:40:04 +0000281 FeatureSlowUAMem32, FeaturePOPCNT, FeatureAES,
282 FeaturePCLMUL]>;
Benjamin Kramer874c5192011-10-10 19:35:07 +0000283// Ivy Bridge
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000284def : ProcessorModel<"core-avx-i", SandyBridgeModel,
285 [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
Sanjay Patel501890e2014-11-21 17:40:04 +0000286 FeatureSlowUAMem32, FeaturePOPCNT, FeatureAES,
287 FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
288 FeatureFSGSBase]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000289
Craig Topper3657fe42011-10-14 03:21:46 +0000290// Haswell
Nadav Roteme7b6a8a2013-03-28 22:34:46 +0000291def : ProcessorModel<"core-avx2", HaswellModel,
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000292 [FeatureAVX2, FeatureCMPXCHG16B, FeatureFastUAMem,
293 FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
294 FeatureF16C, FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT,
Michael Liaoe344ec92013-03-26 22:46:02 +0000295 FeatureBMI, FeatureBMI2, FeatureFMA, FeatureRTM,
Alexey Volkov7de210b2014-11-17 16:17:51 +0000296 FeatureHLE, FeatureSlowIncDec]>;
Craig Topper3657fe42011-10-14 03:21:46 +0000297
Robert Khasanov98441b62014-08-21 09:16:12 +0000298// Broadwell
299def : ProcessorModel<"broadwell", HaswellModel,
300 [FeatureAVX2, FeatureCMPXCHG16B, FeatureFastUAMem,
301 FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
302 FeatureF16C, FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT,
303 FeatureBMI, FeatureBMI2, FeatureFMA, FeatureRTM,
Alexey Volkov7de210b2014-11-17 16:17:51 +0000304 FeatureHLE, FeatureADX, FeatureRDSEED, FeatureSMAP,
305 FeatureSlowIncDec]>;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000306// KNL
307// FIXME: define KNL model
308def : ProcessorModel<"knl", HaswellModel,
309 [FeatureAVX512, FeatureERI, FeatureCDI, FeaturePFI,
310 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
311 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
312 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
Elena Demikhovsky678bd5b2014-07-02 14:11:05 +0000313 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
314 FeatureSlowIncDec]>;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000315
Robert Khasanovbfa01312014-07-21 14:54:21 +0000316// SKX
317// FIXME: define SKX model
318def : ProcessorModel<"skx", HaswellModel,
319 [FeatureAVX512, FeatureCDI,
320 FeatureDQI, FeatureBWI, FeatureVLX,
321 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
322 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
323 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
324 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
Kevin Enderby0d928a12014-07-31 23:57:38 +0000325 FeatureSlowIncDec, FeatureSGX]>;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000326
Evan Chengff1beda2006-10-06 09:17:41 +0000327def : Proc<"k6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000328def : Proc<"k6-2", [Feature3DNow]>;
329def : Proc<"k6-3", [Feature3DNow]>;
Alexey Volkovbb2f0472014-03-07 08:28:44 +0000330def : Proc<"athlon", [Feature3DNowA, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000331 FeatureSlowSHLD]>;
332def : Proc<"athlon-tbird", [Feature3DNowA, FeatureSlowBTMem,
333 FeatureSlowSHLD]>;
334def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
335 FeatureSlowSHLD]>;
336def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
337 FeatureSlowSHLD]>;
338def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
339 FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000340def : Proc<"k8", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000341 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000342def : Proc<"opteron", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000343 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000344def : Proc<"athlon64", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000345 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000346def : Proc<"athlon-fx", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000347 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000348def : Proc<"k8-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000349 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000350def : Proc<"opteron-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000351 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000352def : Proc<"athlon64-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000353 FeatureSlowBTMem, FeatureSlowSHLD]>;
Craig Topperbae0e9e2012-05-01 06:54:48 +0000354def : Proc<"amdfam10", [FeatureSSE4A,
Benjamin Kramer5feb3da2011-11-30 15:48:16 +0000355 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000356 FeaturePOPCNT, FeatureSlowBTMem,
357 FeatureSlowSHLD]>;
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000358// Bobcat
359def : Proc<"btver1", [FeatureSSSE3, FeatureSSE4A, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000360 FeaturePRFCHW, FeatureLZCNT, FeaturePOPCNT,
361 FeatureSlowSHLD]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000362
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000363// Jaguar
Sanjay Patel1191adf2014-09-09 20:07:07 +0000364def : ProcessorModel<"btver2", BtVer2Model,
365 [FeatureAVX, FeatureSSE4A, FeatureCMPXCHG16B,
366 FeaturePRFCHW, FeatureAES, FeaturePCLMUL,
367 FeatureBMI, FeatureF16C, FeatureMOVBE,
Sanjay Patele57f3c02014-11-28 18:40:18 +0000368 FeatureLZCNT, FeaturePOPCNT, FeatureFastUAMem,
369 FeatureSlowSHLD, FeatureUseSqrtEst, FeatureUseRecipEst]>;
370
371// TODO: We should probably add 'FeatureFastUAMem' to all of the AMD chips.
Sanjay Patel1191adf2014-09-09 20:07:07 +0000372
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000373// Bulldozer
Craig Topperbae0e9e2012-05-01 06:54:48 +0000374def : Proc<"bdver1", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000375 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000376 FeatureAVX, FeatureSSE4A, FeatureLZCNT,
377 FeaturePOPCNT, FeatureSlowSHLD]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000378// Piledriver
Craig Topperbae0e9e2012-05-01 06:54:48 +0000379def : Proc<"bdver2", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000380 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000381 FeatureAVX, FeatureSSE4A, FeatureF16C,
382 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
383 FeatureTBM, FeatureFMA, FeatureSlowSHLD]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000384
385// Steamroller
386def : Proc<"bdver3", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
387 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000388 FeatureAVX, FeatureSSE4A, FeatureF16C,
389 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
390 FeatureTBM, FeatureFMA, FeatureSlowSHLD,
391 FeatureFSGSBase]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000392
Benjamin Kramer60045732014-05-02 15:47:07 +0000393// Excavator
394def : Proc<"bdver4", [FeatureAVX2, FeatureXOP, FeatureFMA4,
395 FeatureCMPXCHG16B, FeatureAES, FeaturePRFCHW,
396 FeaturePCLMUL, FeatureF16C, FeatureLZCNT,
397 FeaturePOPCNT, FeatureBMI, FeatureBMI2,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000398 FeatureTBM, FeatureFMA, FeatureSSE4A,
399 FeatureFSGSBase]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000400
Roman Divackyfd690092012-09-12 14:36:02 +0000401def : Proc<"geode", [Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000402
403def : Proc<"winchip-c6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000404def : Proc<"winchip2", [Feature3DNow]>;
405def : Proc<"c3", [Feature3DNow]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000406def : Proc<"c3-2", [FeatureSSE1]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000407
Chandler Carruth32908d72014-05-07 17:37:03 +0000408// We also provide a generic 64-bit specific x86 processor model which tries to
409// be good for modern chips without enabling instruction set encodings past the
410// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
411// modern 64-bit x86 chip, and enables features that are generally beneficial.
412//
413// We currently use the Sandy Bridge model as the default scheduling model as
414// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
415// covers a huge swath of x86 processors. If there are specific scheduling
416// knobs which need to be tuned differently for AMD chips, we might consider
417// forming a common base for them.
418def : ProcessorModel<"x86-64", SandyBridgeModel,
419 [FeatureSSE2, Feature64Bit, FeatureSlowBTMem,
420 FeatureFastUAMem]>;
421
Evan Chengff1beda2006-10-06 09:17:41 +0000422//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000423// Register File Description
424//===----------------------------------------------------------------------===//
425
426include "X86RegisterInfo.td"
427
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000428//===----------------------------------------------------------------------===//
429// Instruction Descriptions
430//===----------------------------------------------------------------------===//
431
Chris Lattner59a4a912003-08-03 21:54:21 +0000432include "X86InstrInfo.td"
433
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000434def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000435
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000436//===----------------------------------------------------------------------===//
437// Calling Conventions
438//===----------------------------------------------------------------------===//
439
440include "X86CallingConv.td"
441
442
443//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000444// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000445//===----------------------------------------------------------------------===//
446
Daniel Dunbar00331992009-07-29 00:02:19 +0000447def ATTAsmParser : AsmParser {
Devang Patel4a6e7782012-01-12 18:03:40 +0000448 string AsmParserClassName = "AsmParser";
Devang Patel85d684a2012-01-09 19:13:28 +0000449}
450
451def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000452 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000453
Chad Rosier9f7a2212013-04-18 22:35:36 +0000454 // Variant name.
455 string Name = "att";
456
Daniel Dunbare4318712009-08-11 20:59:47 +0000457 // Discard comments in assembly strings.
458 string CommentDelimiter = "#";
459
460 // Recognize hard coded registers.
461 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000462}
463
Devang Patel67bf992a2012-01-10 17:51:54 +0000464def IntelAsmParserVariant : AsmParserVariant {
465 int Variant = 1;
466
Chad Rosier9f7a2212013-04-18 22:35:36 +0000467 // Variant name.
468 string Name = "intel";
469
Devang Patel67bf992a2012-01-10 17:51:54 +0000470 // Discard comments in assembly strings.
471 string CommentDelimiter = ";";
472
473 // Recognize hard coded registers.
474 string RegisterPrefix = "";
475}
476
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000477//===----------------------------------------------------------------------===//
478// Assembly Printers
479//===----------------------------------------------------------------------===//
480
Chris Lattner56832602004-10-03 20:36:57 +0000481// The X86 target supports two different syntaxes for emitting machine code.
482// This is controlled by the -x86-asm-syntax={att|intel}
483def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000484 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000485 int Variant = 0;
486}
487def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000488 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000489 int Variant = 1;
490}
491
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000492def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000493 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000494 let InstructionSet = X86InstrInfo;
Daniel Dunbar00331992009-07-29 00:02:19 +0000495 let AssemblyParsers = [ATTAsmParser];
Devang Patel67bf992a2012-01-10 17:51:54 +0000496 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000497 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000498}