blob: d00a1113e2e4085962f57ebf48a7ee500427f4fc [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 Patel9e916dc2015-08-21 20:17:26 +000082def FeatureSlowUAMem : SubtargetFeature<"slow-unaligned-mem-under-32",
83 "IsUAMemUnder32Slow", "true",
84 "Slow unaligned 16-byte-or-less memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +000085def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +000086 "IsUAMem32Slow", "true",
87 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +000088def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +000089 "Support SSE 4a instructions",
90 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +000091
Craig Topperf287a452012-01-09 09:02:13 +000092def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
93 "Enable AVX instructions",
94 [FeatureSSE42]>;
95def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +000096 "Enable AVX2 instructions",
97 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +000098def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +000099 "Enable AVX-512 instructions",
100 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000101def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000102 "Enable AVX-512 Exponential and Reciprocal Instructions",
103 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000104def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000105 "Enable AVX-512 Conflict Detection Instructions",
106 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000107def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000108 "Enable AVX-512 PreFetch Instructions",
109 [FeatureAVX512]>;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000110def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
111 "Enable AVX-512 Doubleword and Quadword Instructions",
112 [FeatureAVX512]>;
113def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
114 "Enable AVX-512 Byte and Word Instructions",
115 [FeatureAVX512]>;
116def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
117 "Enable AVX-512 Vector Length eXtensions",
118 [FeatureAVX512]>;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000119def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
120 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000121 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000122def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000123 "Enable three-operand fused multiple-add",
124 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000125def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000126 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000127 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000128def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000129 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000130 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000131def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
132 "HasSSEUnalignedMem", "true",
133 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000134def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000135 "Enable AES instructions",
136 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000137def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
138 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000139def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
140 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000141def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000142 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000143def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000144 "Support 16-bit floating point conversion instructions",
145 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000146def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
147 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000148def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
149 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000150def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
151 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000152def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
153 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000154def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
155 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000156def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
157 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000158def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
159 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000160def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
161 "Enable SHA instructions",
162 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000163def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
164 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000165def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
166 "Support RDSEED instruction">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000167def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
168 "Support MPX instructions">;
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000169def FeatureLeaForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
170 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000171def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
172 "HasSlowDivide32", "true",
173 "Use 8-bit divide for positive values less than 256">;
174def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
175 "HasSlowDivide64", "true",
176 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000177def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
178 "PadShortFunctions", "true",
179 "Pad short functions">;
Michael Kuperstein454d1452015-07-23 12:23:45 +0000180// TODO: This feature ought to be renamed.
Sean Silvae1c6b542015-07-27 00:46:59 +0000181// What it really refers to are CPUs for which certain instructions
182// (which ones besides the example below?) are microcoded.
Michael Kuperstein454d1452015-07-23 12:23:45 +0000183// The best examples of this are the memory forms of CALL and PUSH
184// instructions, which should be avoided in favor of a MOV + register CALL/PUSH.
Preston Gurd663e6f92013-03-27 19:14:02 +0000185def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
186 "CallRegIndirect", "true",
187 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000188def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
189 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000190def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
191 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000192def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
193 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000194def FeatureSoftFloat
195 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
196 "Use software floating point features.">;
David Greene8f6f72c2009-06-26 22:46:54 +0000197
Evan Chengff1beda2006-10-06 09:17:41 +0000198//===----------------------------------------------------------------------===//
199// X86 processors supported.
200//===----------------------------------------------------------------------===//
201
Andrew Trick8523b162012-02-01 23:20:51 +0000202include "X86Schedule.td"
203
204def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
205 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000206def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
207 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000208
Evan Chengff1beda2006-10-06 09:17:41 +0000209class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000210 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000211
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000212def : Proc<"generic", [FeatureSlowUAMem]>;
213def : Proc<"i386", [FeatureSlowUAMem]>;
214def : Proc<"i486", [FeatureSlowUAMem]>;
215def : Proc<"i586", [FeatureSlowUAMem]>;
216def : Proc<"pentium", [FeatureSlowUAMem]>;
217def : Proc<"pentium-mmx", [FeatureSlowUAMem, FeatureMMX]>;
218def : Proc<"i686", [FeatureSlowUAMem]>;
219def : Proc<"pentiumpro", [FeatureSlowUAMem, FeatureCMOV]>;
220def : Proc<"pentium2", [FeatureSlowUAMem, FeatureMMX, FeatureCMOV]>;
221def : Proc<"pentium3", [FeatureSlowUAMem, FeatureSSE1]>;
222def : Proc<"pentium3m", [FeatureSlowUAMem, FeatureSSE1, FeatureSlowBTMem]>;
223def : Proc<"pentium-m", [FeatureSlowUAMem, FeatureSSE2, FeatureSlowBTMem]>;
224def : Proc<"pentium4", [FeatureSlowUAMem, FeatureSSE2]>;
225def : Proc<"pentium4m", [FeatureSlowUAMem, FeatureSSE2, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000226
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000227// Intel Core Duo.
228def : ProcessorModel<"yonah", SandyBridgeModel,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000229 [FeatureSlowUAMem, FeatureSSE3, FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000230
231// NetBurst.
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000232def : Proc<"prescott", [FeatureSlowUAMem, FeatureSSE3, FeatureSlowBTMem]>;
233def : Proc<"nocona", [FeatureSlowUAMem, FeatureSSE3, FeatureCMPXCHG16B,
234 FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000235
236// Intel Core 2 Solo/Duo.
237def : ProcessorModel<"core2", SandyBridgeModel,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000238 [FeatureSlowUAMem, FeatureSSSE3, FeatureCMPXCHG16B,
239 FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000240def : ProcessorModel<"penryn", SandyBridgeModel,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000241 [FeatureSlowUAMem, FeatureSSE41, FeatureCMPXCHG16B,
242 FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000243
Chandler Carruthaf8924032014-12-09 10:58:36 +0000244// Atom CPUs.
245class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
246 ProcIntelAtom,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000247 FeatureSlowUAMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000248 FeatureSSSE3,
249 FeatureCMPXCHG16B,
250 FeatureMOVBE,
251 FeatureSlowBTMem,
252 FeatureLeaForSP,
253 FeatureSlowDivide32,
254 FeatureSlowDivide64,
255 FeatureCallRegIndirect,
256 FeatureLEAUsesAG,
257 FeaturePadShortFunctions
258 ]>;
259def : BonnellProc<"bonnell">;
260def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000261
Chandler Carruthaf8924032014-12-09 10:58:36 +0000262class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
263 ProcIntelSLM,
264 FeatureSSE42,
265 FeatureCMPXCHG16B,
266 FeatureMOVBE,
267 FeaturePOPCNT,
268 FeaturePCLMUL,
269 FeatureAES,
270 FeatureSlowDivide64,
271 FeatureCallRegIndirect,
272 FeaturePRFCHW,
273 FeatureSlowLEA,
274 FeatureSlowIncDec,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000275 FeatureSlowBTMem
Chandler Carruthaf8924032014-12-09 10:58:36 +0000276 ]>;
277def : SilvermontProc<"silvermont">;
278def : SilvermontProc<"slm">; // Legacy alias.
279
Eric Christopher2ef63182010-04-02 21:54:27 +0000280// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000281class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
282 FeatureSSE42,
283 FeatureCMPXCHG16B,
284 FeatureSlowBTMem,
Craig Topper3611d9b2015-03-30 06:31:11 +0000285 FeaturePOPCNT
286 ]>;
287def : NehalemProc<"nehalem">;
288def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000289
Eric Christopher2ef63182010-04-02 21:54:27 +0000290// Westmere is a similar machine to nehalem with some additional features.
291// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000292class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
293 FeatureSSE42,
294 FeatureCMPXCHG16B,
295 FeatureSlowBTMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000296 FeaturePOPCNT,
297 FeatureAES,
298 FeaturePCLMUL
299 ]>;
300def : WestmereProc<"westmere">;
301
Nate Begeman8b08f522010-12-10 00:26:57 +0000302// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
303// rather than a superset.
Chandler Carruthaf8924032014-12-09 10:58:36 +0000304class SandyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
305 FeatureAVX,
306 FeatureCMPXCHG16B,
Craig Topper01dd4ea2015-08-08 07:20:04 +0000307 FeatureSlowBTMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000308 FeatureSlowUAMem32,
309 FeaturePOPCNT,
310 FeatureAES,
311 FeaturePCLMUL
312 ]>;
313def : SandyBridgeProc<"sandybridge">;
314def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000315
Chandler Carruthaf8924032014-12-09 10:58:36 +0000316class IvyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
317 FeatureAVX,
318 FeatureCMPXCHG16B,
Craig Topper01dd4ea2015-08-08 07:20:04 +0000319 FeatureSlowBTMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000320 FeatureSlowUAMem32,
321 FeaturePOPCNT,
322 FeatureAES,
323 FeaturePCLMUL,
324 FeatureRDRAND,
325 FeatureF16C,
326 FeatureFSGSBase
327 ]>;
328def : IvyBridgeProc<"ivybridge">;
329def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000330
Chandler Carruthaf8924032014-12-09 10:58:36 +0000331class HaswellProc<string Name> : ProcessorModel<Name, HaswellModel, [
332 FeatureAVX2,
333 FeatureCMPXCHG16B,
Craig Topper01dd4ea2015-08-08 07:20:04 +0000334 FeatureSlowBTMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000335 FeaturePOPCNT,
336 FeatureAES,
337 FeaturePCLMUL,
338 FeatureRDRAND,
339 FeatureF16C,
340 FeatureFSGSBase,
341 FeatureMOVBE,
342 FeatureLZCNT,
343 FeatureBMI,
344 FeatureBMI2,
345 FeatureFMA,
346 FeatureRTM,
347 FeatureHLE,
348 FeatureSlowIncDec
349 ]>;
350def : HaswellProc<"haswell">;
351def : HaswellProc<"core-avx2">; // Legacy alias.
352
353class BroadwellProc<string Name> : ProcessorModel<Name, HaswellModel, [
354 FeatureAVX2,
355 FeatureCMPXCHG16B,
Craig Topper01dd4ea2015-08-08 07:20:04 +0000356 FeatureSlowBTMem,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000357 FeaturePOPCNT,
358 FeatureAES,
359 FeaturePCLMUL,
360 FeatureRDRAND,
361 FeatureF16C,
362 FeatureFSGSBase,
363 FeatureMOVBE,
364 FeatureLZCNT,
365 FeatureBMI,
366 FeatureBMI2,
367 FeatureFMA,
368 FeatureRTM,
369 FeatureHLE,
370 FeatureADX,
371 FeatureRDSEED,
Chandler Carruthaf8924032014-12-09 10:58:36 +0000372 FeatureSlowIncDec
373 ]>;
374def : BroadwellProc<"broadwell">;
375
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000376// FIXME: define KNL model
Chandler Carruthaf8924032014-12-09 10:58:36 +0000377class KnightsLandingProc<string Name> : ProcessorModel<Name, HaswellModel,
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000378 [FeatureAVX512, FeatureERI, FeatureCDI, FeaturePFI,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000379 FeatureCMPXCHG16B, FeaturePOPCNT,
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000380 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
381 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
Elena Demikhovsky678bd5b2014-07-02 14:11:05 +0000382 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000383 FeatureSlowIncDec, FeatureMPX]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000384def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000385
Robert Khasanovbfa01312014-07-21 14:54:21 +0000386// FIXME: define SKX model
Chandler Carruthaf8924032014-12-09 10:58:36 +0000387class SkylakeProc<string Name> : ProcessorModel<Name, HaswellModel,
Robert Khasanovbfa01312014-07-21 14:54:21 +0000388 [FeatureAVX512, FeatureCDI,
389 FeatureDQI, FeatureBWI, FeatureVLX,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000390 FeatureCMPXCHG16B, FeatureSlowBTMem,
Craig Topper01dd4ea2015-08-08 07:20:04 +0000391 FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
392 FeatureF16C, FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT,
393 FeatureBMI, FeatureBMI2, FeatureFMA, FeatureRTM,
Craig Toppercb1f6012015-08-08 07:31:15 +0000394 FeatureHLE, FeatureADX, FeatureRDSEED, FeatureSlowIncDec,
395 FeatureMPX]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000396def : SkylakeProc<"skylake">;
397def : SkylakeProc<"skx">; // Legacy alias.
398
399
400// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000401
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000402def : Proc<"k6", [FeatureSlowUAMem, FeatureMMX]>;
403def : Proc<"k6-2", [FeatureSlowUAMem, Feature3DNow]>;
404def : Proc<"k6-3", [FeatureSlowUAMem, Feature3DNow]>;
405def : Proc<"athlon", [FeatureSlowUAMem, Feature3DNowA,
406 FeatureSlowBTMem, FeatureSlowSHLD]>;
407def : Proc<"athlon-tbird", [FeatureSlowUAMem, Feature3DNowA,
408 FeatureSlowBTMem, FeatureSlowSHLD]>;
409def : Proc<"athlon-4", [FeatureSlowUAMem, FeatureSSE1, Feature3DNowA,
410 FeatureSlowBTMem, FeatureSlowSHLD]>;
411def : Proc<"athlon-xp", [FeatureSlowUAMem, FeatureSSE1, Feature3DNowA,
412 FeatureSlowBTMem, FeatureSlowSHLD]>;
413def : Proc<"athlon-mp", [FeatureSlowUAMem, FeatureSSE1, Feature3DNowA,
414 FeatureSlowBTMem, FeatureSlowSHLD]>;
415def : Proc<"k8", [FeatureSlowUAMem, FeatureSSE2, Feature3DNowA,
416 Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000417 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000418def : Proc<"opteron", [FeatureSlowUAMem, FeatureSSE2, Feature3DNowA,
419 Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000420 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000421def : Proc<"athlon64", [FeatureSlowUAMem, FeatureSSE2, Feature3DNowA,
422 Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000423 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000424def : Proc<"athlon-fx", [FeatureSlowUAMem, FeatureSSE2, Feature3DNowA,
425 Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000426 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000427def : Proc<"k8-sse3", [FeatureSlowUAMem, FeatureSSE3, Feature3DNowA,
428 FeatureCMPXCHG16B, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000429 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000430def : Proc<"opteron-sse3", [FeatureSlowUAMem, FeatureSSE3, Feature3DNowA,
431 FeatureCMPXCHG16B, FeatureSlowBTMem,
432 FeatureSlowSHLD]>;
433def : Proc<"athlon64-sse3", [FeatureSlowUAMem, FeatureSSE3, Feature3DNowA,
434 FeatureCMPXCHG16B, FeatureSlowBTMem,
435 FeatureSlowSHLD]>;
Sanjay Pateldddad102015-08-21 20:39:17 +0000436def : Proc<"amdfam10", [FeatureSSE4A,
Benjamin Kramer5feb3da2011-11-30 15:48:16 +0000437 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000438 FeaturePOPCNT, FeatureSlowBTMem,
439 FeatureSlowSHLD]>;
Sanjay Pateldddad102015-08-21 20:39:17 +0000440def : Proc<"barcelona", [FeatureSSE4A,
Chandler Carruthf57ac3b2014-12-09 14:25:55 +0000441 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
442 FeaturePOPCNT, FeatureSlowBTMem,
443 FeatureSlowSHLD]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000444
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000445// Bobcat
446def : Proc<"btver1", [FeatureSSSE3, FeatureSSE4A, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000447 FeaturePRFCHW, FeatureLZCNT, FeaturePOPCNT,
Sanjay Pateldddad102015-08-21 20:39:17 +0000448 FeatureSlowSHLD]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000449
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000450// Jaguar
Sanjay Patel1191adf2014-09-09 20:07:07 +0000451def : ProcessorModel<"btver2", BtVer2Model,
452 [FeatureAVX, FeatureSSE4A, FeatureCMPXCHG16B,
453 FeaturePRFCHW, FeatureAES, FeaturePCLMUL,
454 FeatureBMI, FeatureF16C, FeatureMOVBE,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000455 FeatureLZCNT, FeaturePOPCNT,
Sanjay Patel667a7e22015-06-04 01:32:35 +0000456 FeatureSlowSHLD]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000457
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000458// Bulldozer
Craig Topperbae0e9e2012-05-01 06:54:48 +0000459def : Proc<"bdver1", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000460 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000461 FeatureAVX, FeatureSSE4A, FeatureLZCNT,
Sanjay Pateldddad102015-08-21 20:39:17 +0000462 FeaturePOPCNT, FeatureSlowSHLD]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000463// Piledriver
Craig Topperbae0e9e2012-05-01 06:54:48 +0000464def : Proc<"bdver2", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000465 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000466 FeatureAVX, FeatureSSE4A, FeatureF16C,
467 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
Sanjay Pateldddad102015-08-21 20:39:17 +0000468 FeatureTBM, FeatureFMA, FeatureSlowSHLD]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000469
470// Steamroller
471def : Proc<"bdver3", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
472 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000473 FeatureAVX, FeatureSSE4A, FeatureF16C,
474 FeatureLZCNT, FeaturePOPCNT, FeatureBMI,
475 FeatureTBM, FeatureFMA, FeatureSlowSHLD,
Sanjay Pateldddad102015-08-21 20:39:17 +0000476 FeatureFSGSBase]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000477
Benjamin Kramer60045732014-05-02 15:47:07 +0000478// Excavator
479def : Proc<"bdver4", [FeatureAVX2, FeatureXOP, FeatureFMA4,
480 FeatureCMPXCHG16B, FeatureAES, FeaturePRFCHW,
481 FeaturePCLMUL, FeatureF16C, FeatureLZCNT,
482 FeaturePOPCNT, FeatureBMI, FeatureBMI2,
Andrea Di Biagiof5b34e52014-11-04 21:18:09 +0000483 FeatureTBM, FeatureFMA, FeatureSSE4A,
Sanjay Pateldddad102015-08-21 20:39:17 +0000484 FeatureFSGSBase]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000485
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000486def : Proc<"geode", [FeatureSlowUAMem, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000487
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000488def : Proc<"winchip-c6", [FeatureSlowUAMem, FeatureMMX]>;
489def : Proc<"winchip2", [FeatureSlowUAMem, Feature3DNow]>;
490def : Proc<"c3", [FeatureSlowUAMem, Feature3DNow]>;
491def : Proc<"c3-2", [FeatureSlowUAMem, FeatureSSE1]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000492
Chandler Carruth32908d72014-05-07 17:37:03 +0000493// We also provide a generic 64-bit specific x86 processor model which tries to
494// be good for modern chips without enabling instruction set encodings past the
495// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
496// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000497//
Chandler Carruth32908d72014-05-07 17:37:03 +0000498// We currently use the Sandy Bridge model as the default scheduling model as
499// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
500// covers a huge swath of x86 processors. If there are specific scheduling
501// knobs which need to be tuned differently for AMD chips, we might consider
502// forming a common base for them.
503def : ProcessorModel<"x86-64", SandyBridgeModel,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000504 [FeatureSSE2, Feature64Bit, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000505
Evan Chengff1beda2006-10-06 09:17:41 +0000506//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000507// Register File Description
508//===----------------------------------------------------------------------===//
509
510include "X86RegisterInfo.td"
511
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000512//===----------------------------------------------------------------------===//
513// Instruction Descriptions
514//===----------------------------------------------------------------------===//
515
Chris Lattner59a4a912003-08-03 21:54:21 +0000516include "X86InstrInfo.td"
517
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000518def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000519
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000520//===----------------------------------------------------------------------===//
521// Calling Conventions
522//===----------------------------------------------------------------------===//
523
524include "X86CallingConv.td"
525
526
527//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000528// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000529//===----------------------------------------------------------------------===//
530
Daniel Dunbar00331992009-07-29 00:02:19 +0000531def ATTAsmParser : AsmParser {
Devang Patel4a6e7782012-01-12 18:03:40 +0000532 string AsmParserClassName = "AsmParser";
Devang Patel85d684a2012-01-09 19:13:28 +0000533}
534
535def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000536 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000537
Chad Rosier9f7a2212013-04-18 22:35:36 +0000538 // Variant name.
539 string Name = "att";
540
Daniel Dunbare4318712009-08-11 20:59:47 +0000541 // Discard comments in assembly strings.
542 string CommentDelimiter = "#";
543
544 // Recognize hard coded registers.
545 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000546}
547
Devang Patel67bf992a2012-01-10 17:51:54 +0000548def IntelAsmParserVariant : AsmParserVariant {
549 int Variant = 1;
550
Chad Rosier9f7a2212013-04-18 22:35:36 +0000551 // Variant name.
552 string Name = "intel";
553
Devang Patel67bf992a2012-01-10 17:51:54 +0000554 // Discard comments in assembly strings.
555 string CommentDelimiter = ";";
556
557 // Recognize hard coded registers.
558 string RegisterPrefix = "";
559}
560
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000561//===----------------------------------------------------------------------===//
562// Assembly Printers
563//===----------------------------------------------------------------------===//
564
Chris Lattner56832602004-10-03 20:36:57 +0000565// The X86 target supports two different syntaxes for emitting machine code.
566// This is controlled by the -x86-asm-syntax={att|intel}
567def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000568 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000569 int Variant = 0;
570}
571def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000572 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000573 int Variant = 1;
574}
575
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000576def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000577 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000578 let InstructionSet = X86InstrInfo;
Daniel Dunbar00331992009-07-29 00:02:19 +0000579 let AssemblyParsers = [ATTAsmParser];
Devang Patel67bf992a2012-01-10 17:51:54 +0000580 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000581 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000582}