blob: d1afa2cc70533dd65af31df3f6ac336dc14b1134 [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">;
Evan Cheng738b0f92010-04-01 05:58:17 +000082def FeatureFastUAMem : SubtargetFeature<"fast-unaligned-mem",
83 "IsUAMemFast", "true",
84 "Fast unaligned memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +000085def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +000086 "Support SSE 4a instructions",
87 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +000088
Craig Topperf287a452012-01-09 09:02:13 +000089def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
90 "Enable AVX instructions",
91 [FeatureSSE42]>;
92def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +000093 "Enable AVX2 instructions",
94 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +000095def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +000096 "Enable AVX-512 instructions",
97 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +000098def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +000099 "Enable AVX-512 Exponential and Reciprocal Instructions",
100 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000101def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000102 "Enable AVX-512 Conflict Detection Instructions",
103 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000104def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000105 "Enable AVX-512 PreFetch Instructions",
106 [FeatureAVX512]>;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000107def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
108 "Enable AVX-512 Doubleword and Quadword Instructions",
109 [FeatureAVX512]>;
110def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
111 "Enable AVX-512 Byte and Word Instructions",
112 [FeatureAVX512]>;
113def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
114 "Enable AVX-512 Vector Length eXtensions",
115 [FeatureAVX512]>;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000116def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
117 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000118 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000119def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000120 "Enable three-operand fused multiple-add",
121 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000122def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000123 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000124 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000125def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000126 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000127 [FeatureFMA4]>;
David Greene206351a2010-01-11 16:29:42 +0000128def FeatureVectorUAMem : SubtargetFeature<"vector-unaligned-mem",
129 "HasVectorUAMem", "true",
130 "Allow unaligned memory operands on vector/SIMD instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000131def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000132 "Enable AES instructions",
133 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000134def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
135 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000136def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
137 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000138def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000139 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000140def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000141 "Support 16-bit floating point conversion instructions",
142 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000143def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
144 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000145def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
146 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000147def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
148 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000149def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
150 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000151def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
152 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000153def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
154 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000155def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
156 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000157def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
158 "Enable SHA instructions",
159 [FeatureSSE2]>;
Kevin Enderby0d928a12014-07-31 23:57:38 +0000160def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
161 "Support SGX instructions">;
Michael Liao5173ee02013-03-26 17:47:11 +0000162def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
163 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000164def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
165 "Support RDSEED instruction">;
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000166def FeatureLeaForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
167 "Use LEA for adjusting the stack pointer">;
Preston Gurdcdf540d2012-09-04 18:22:17 +0000168def FeatureSlowDivide : SubtargetFeature<"idiv-to-divb",
Preston Gurda01daac2013-01-08 18:27:24 +0000169 "HasSlowDivide", "true",
170 "Use small divide for positive values less than 256">;
171def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
172 "PadShortFunctions", "true",
173 "Pad short functions">;
Preston Gurd663e6f92013-03-27 19:14:02 +0000174def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
175 "CallRegIndirect", "true",
176 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000177def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
178 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000179def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
180 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000181def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
182 "INC and DEC instructions are slower than ADD and SUB">;
David Greene8f6f72c2009-06-26 22:46:54 +0000183
Evan Chengff1beda2006-10-06 09:17:41 +0000184//===----------------------------------------------------------------------===//
185// X86 processors supported.
186//===----------------------------------------------------------------------===//
187
Andrew Trick8523b162012-02-01 23:20:51 +0000188include "X86Schedule.td"
189
190def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
191 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000192def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
193 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000194
Evan Chengff1beda2006-10-06 09:17:41 +0000195class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000196 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000197
Evan Chengff1beda2006-10-06 09:17:41 +0000198def : Proc<"generic", []>;
199def : Proc<"i386", []>;
200def : Proc<"i486", []>;
Dale Johannesen28106752008-10-14 22:06:33 +0000201def : Proc<"i586", []>;
Evan Chengff1beda2006-10-06 09:17:41 +0000202def : Proc<"pentium", []>;
203def : Proc<"pentium-mmx", [FeatureMMX]>;
204def : Proc<"i686", []>;
Chris Lattnercc8c5812009-09-02 05:53:04 +0000205def : Proc<"pentiumpro", [FeatureCMOV]>;
206def : Proc<"pentium2", [FeatureMMX, FeatureCMOV]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000207def : Proc<"pentium3", [FeatureSSE1]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000208def : Proc<"pentium3m", [FeatureSSE1, FeatureSlowBTMem]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +0000209def : Proc<"pentium-m", [FeatureSSE2, FeatureSlowBTMem]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000210def : Proc<"pentium4", [FeatureSSE2]>;
Michael J. Spencer99737382011-05-03 03:42:50 +0000211def : Proc<"pentium4m", [FeatureSSE2, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000212
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000213// Intel Core Duo.
214def : ProcessorModel<"yonah", SandyBridgeModel,
215 [FeatureSSE3, FeatureSlowBTMem]>;
216
217// NetBurst.
218def : Proc<"prescott", [FeatureSSE3, FeatureSlowBTMem]>;
219def : Proc<"nocona", [FeatureSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
220
221// Intel Core 2 Solo/Duo.
222def : ProcessorModel<"core2", SandyBridgeModel,
223 [FeatureSSSE3, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
224def : ProcessorModel<"penryn", SandyBridgeModel,
225 [FeatureSSE41, FeatureCMPXCHG16B, FeatureSlowBTMem]>;
226
227// Atom.
228def : ProcessorModel<"atom", AtomModel,
229 [ProcIntelAtom, FeatureSSSE3, FeatureCMPXCHG16B,
230 FeatureMOVBE, FeatureSlowBTMem, FeatureLeaForSP,
Preston Gurd663e6f92013-03-27 19:14:02 +0000231 FeatureSlowDivide,
232 FeatureCallRegIndirect,
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000233 FeatureLEAUsesAG,
Preston Gurd663e6f92013-03-27 19:14:02 +0000234 FeaturePadShortFunctions]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000235
Preston Gurd3fe264d2013-09-13 19:23:28 +0000236// Atom Silvermont.
237def : ProcessorModel<"slm", SLMModel, [ProcIntelSLM,
238 FeatureSSE42, FeatureCMPXCHG16B,
239 FeatureMOVBE, FeaturePOPCNT,
240 FeaturePCLMUL, FeatureAES,
241 FeatureCallRegIndirect,
242 FeaturePRFCHW,
Alexey Volkov5260dba2014-06-09 11:40:41 +0000243 FeatureSlowLEA, FeatureSlowIncDec,
Alexey Volkov1051f042014-03-07 09:03:49 +0000244 FeatureSlowBTMem, FeatureFastUAMem]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000245// "Arrandale" along with corei3 and corei5
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000246def : ProcessorModel<"corei7", SandyBridgeModel,
247 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
248 FeatureFastUAMem, FeaturePOPCNT, FeatureAES]>;
249
250def : ProcessorModel<"nehalem", SandyBridgeModel,
251 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
252 FeatureFastUAMem, FeaturePOPCNT]>;
Eric Christopher2ef63182010-04-02 21:54:27 +0000253// Westmere is a similar machine to nehalem with some additional features.
254// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000255def : ProcessorModel<"westmere", SandyBridgeModel,
256 [FeatureSSE42, FeatureCMPXCHG16B, FeatureSlowBTMem,
257 FeatureFastUAMem, FeaturePOPCNT, FeatureAES,
258 FeaturePCLMUL]>;
Benjamin Kramer874c5192011-10-10 19:35:07 +0000259// Sandy Bridge
Nate Begeman8b08f522010-12-10 00:26:57 +0000260// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
261// rather than a superset.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000262def : ProcessorModel<"corei7-avx", SandyBridgeModel,
263 [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
264 FeaturePOPCNT, FeatureAES, FeaturePCLMUL]>;
Benjamin Kramer874c5192011-10-10 19:35:07 +0000265// Ivy Bridge
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000266def : ProcessorModel<"core-avx-i", SandyBridgeModel,
267 [FeatureAVX, FeatureCMPXCHG16B, FeatureFastUAMem,
268 FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
269 FeatureF16C, FeatureFSGSBase]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000270
Craig Topper3657fe42011-10-14 03:21:46 +0000271// Haswell
Nadav Roteme7b6a8a2013-03-28 22:34:46 +0000272def : ProcessorModel<"core-avx2", HaswellModel,
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000273 [FeatureAVX2, FeatureCMPXCHG16B, FeatureFastUAMem,
274 FeaturePOPCNT, FeatureAES, FeaturePCLMUL, FeatureRDRAND,
275 FeatureF16C, FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT,
Michael Liaoe344ec92013-03-26 22:46:02 +0000276 FeatureBMI, FeatureBMI2, FeatureFMA, FeatureRTM,
277 FeatureHLE]>;
Craig Topper3657fe42011-10-14 03:21:46 +0000278
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000279// KNL
280// FIXME: define KNL model
281def : ProcessorModel<"knl", HaswellModel,
282 [FeatureAVX512, FeatureERI, FeatureCDI, FeaturePFI,
283 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
284 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
285 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
Elena Demikhovsky678bd5b2014-07-02 14:11:05 +0000286 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
287 FeatureSlowIncDec]>;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000288
Robert Khasanovbfa01312014-07-21 14:54:21 +0000289// SKX
290// FIXME: define SKX model
291def : ProcessorModel<"skx", HaswellModel,
292 [FeatureAVX512, FeatureCDI,
293 FeatureDQI, FeatureBWI, FeatureVLX,
294 FeatureCMPXCHG16B, FeatureFastUAMem, FeaturePOPCNT,
295 FeatureAES, FeaturePCLMUL, FeatureRDRAND, FeatureF16C,
296 FeatureFSGSBase, FeatureMOVBE, FeatureLZCNT, FeatureBMI,
297 FeatureBMI2, FeatureFMA, FeatureRTM, FeatureHLE,
Kevin Enderby0d928a12014-07-31 23:57:38 +0000298 FeatureSlowIncDec, FeatureSGX]>;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000299
Evan Chengff1beda2006-10-06 09:17:41 +0000300def : Proc<"k6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000301def : Proc<"k6-2", [Feature3DNow]>;
302def : Proc<"k6-3", [Feature3DNow]>;
Alexey Volkovbb2f0472014-03-07 08:28:44 +0000303def : Proc<"athlon", [Feature3DNowA, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000304 FeatureSlowSHLD]>;
305def : Proc<"athlon-tbird", [Feature3DNowA, FeatureSlowBTMem,
306 FeatureSlowSHLD]>;
307def : Proc<"athlon-4", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
308 FeatureSlowSHLD]>;
309def : Proc<"athlon-xp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
310 FeatureSlowSHLD]>;
311def : Proc<"athlon-mp", [FeatureSSE1, Feature3DNowA, FeatureSlowBTMem,
312 FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000313def : Proc<"k8", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000314 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000315def : Proc<"opteron", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000316 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000317def : Proc<"athlon64", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000318 FeatureSlowBTMem, FeatureSlowSHLD]>;
Dan Gohman74037512009-02-03 00:04:43 +0000319def : Proc<"athlon-fx", [FeatureSSE2, Feature3DNowA, Feature64Bit,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000320 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000321def : Proc<"k8-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000322 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000323def : Proc<"opteron-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000324 FeatureSlowBTMem, FeatureSlowSHLD]>;
Eli Friedman5e570422011-08-26 21:21:21 +0000325def : Proc<"athlon64-sse3", [FeatureSSE3, Feature3DNowA, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000326 FeatureSlowBTMem, FeatureSlowSHLD]>;
Craig Topperbae0e9e2012-05-01 06:54:48 +0000327def : Proc<"amdfam10", [FeatureSSE4A,
Benjamin Kramer5feb3da2011-11-30 15:48:16 +0000328 Feature3DNowA, FeatureCMPXCHG16B, FeatureLZCNT,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000329 FeaturePOPCNT, FeatureSlowBTMem,
330 FeatureSlowSHLD]>;
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000331// Bobcat
332def : Proc<"btver1", [FeatureSSSE3, FeatureSSE4A, FeatureCMPXCHG16B,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000333 FeaturePRFCHW, FeatureLZCNT, FeaturePOPCNT,
334 FeatureSlowSHLD]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000335// Jaguar
336def : Proc<"btver2", [FeatureAVX, FeatureSSE4A, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000337 FeaturePRFCHW, FeatureAES, FeaturePCLMUL,
338 FeatureBMI, FeatureF16C, FeatureMOVBE,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000339 FeatureLZCNT, FeaturePOPCNT, FeatureSlowSHLD]>;
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000340// Bulldozer
Craig Topperbae0e9e2012-05-01 06:54:48 +0000341def : Proc<"bdver1", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000342 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000343 FeatureLZCNT, FeaturePOPCNT, FeatureSlowSHLD]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000344// Piledriver
Craig Topperbae0e9e2012-05-01 06:54:48 +0000345def : Proc<"bdver2", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
Yunzhong Gaodfc277f2013-10-16 19:04:11 +0000346 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
Craig Topperbae0e9e2012-05-01 06:54:48 +0000347 FeatureF16C, FeatureLZCNT,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000348 FeaturePOPCNT, FeatureBMI, FeatureTBM,
349 FeatureFMA, FeatureSlowSHLD]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000350
351// Steamroller
352def : Proc<"bdver3", [FeatureXOP, FeatureFMA4, FeatureCMPXCHG16B,
353 FeatureAES, FeaturePRFCHW, FeaturePCLMUL,
354 FeatureF16C, FeatureLZCNT,
355 FeaturePOPCNT, FeatureBMI, FeatureTBM,
356 FeatureFMA, FeatureFSGSBase]>;
357
Benjamin Kramer60045732014-05-02 15:47:07 +0000358// Excavator
359def : Proc<"bdver4", [FeatureAVX2, FeatureXOP, FeatureFMA4,
360 FeatureCMPXCHG16B, FeatureAES, FeaturePRFCHW,
361 FeaturePCLMUL, FeatureF16C, FeatureLZCNT,
362 FeaturePOPCNT, FeatureBMI, FeatureBMI2,
363 FeatureTBM, FeatureFMA, FeatureFSGSBase]>;
364
Roman Divackyfd690092012-09-12 14:36:02 +0000365def : Proc<"geode", [Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000366
367def : Proc<"winchip-c6", [FeatureMMX]>;
Michael J. Spencer30088ba2011-04-15 00:32:41 +0000368def : Proc<"winchip2", [Feature3DNow]>;
369def : Proc<"c3", [Feature3DNow]>;
Bill Wendling3fb7fdf2007-05-22 05:15:37 +0000370def : Proc<"c3-2", [FeatureSSE1]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000371
Chandler Carruth32908d72014-05-07 17:37:03 +0000372// We also provide a generic 64-bit specific x86 processor model which tries to
373// be good for modern chips without enabling instruction set encodings past the
374// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
375// modern 64-bit x86 chip, and enables features that are generally beneficial.
376//
377// We currently use the Sandy Bridge model as the default scheduling model as
378// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
379// covers a huge swath of x86 processors. If there are specific scheduling
380// knobs which need to be tuned differently for AMD chips, we might consider
381// forming a common base for them.
382def : ProcessorModel<"x86-64", SandyBridgeModel,
383 [FeatureSSE2, Feature64Bit, FeatureSlowBTMem,
384 FeatureFastUAMem]>;
385
Evan Chengff1beda2006-10-06 09:17:41 +0000386//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000387// Register File Description
388//===----------------------------------------------------------------------===//
389
390include "X86RegisterInfo.td"
391
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000392//===----------------------------------------------------------------------===//
393// Instruction Descriptions
394//===----------------------------------------------------------------------===//
395
Chris Lattner59a4a912003-08-03 21:54:21 +0000396include "X86InstrInfo.td"
397
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000398def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000399
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000400//===----------------------------------------------------------------------===//
401// Calling Conventions
402//===----------------------------------------------------------------------===//
403
404include "X86CallingConv.td"
405
406
407//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000408// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000409//===----------------------------------------------------------------------===//
410
Daniel Dunbar00331992009-07-29 00:02:19 +0000411def ATTAsmParser : AsmParser {
Devang Patel4a6e7782012-01-12 18:03:40 +0000412 string AsmParserClassName = "AsmParser";
Devang Patel85d684a2012-01-09 19:13:28 +0000413}
414
415def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000416 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000417
Chad Rosier9f7a2212013-04-18 22:35:36 +0000418 // Variant name.
419 string Name = "att";
420
Daniel Dunbare4318712009-08-11 20:59:47 +0000421 // Discard comments in assembly strings.
422 string CommentDelimiter = "#";
423
424 // Recognize hard coded registers.
425 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000426}
427
Devang Patel67bf992a2012-01-10 17:51:54 +0000428def IntelAsmParserVariant : AsmParserVariant {
429 int Variant = 1;
430
Chad Rosier9f7a2212013-04-18 22:35:36 +0000431 // Variant name.
432 string Name = "intel";
433
Devang Patel67bf992a2012-01-10 17:51:54 +0000434 // Discard comments in assembly strings.
435 string CommentDelimiter = ";";
436
437 // Recognize hard coded registers.
438 string RegisterPrefix = "";
439}
440
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000441//===----------------------------------------------------------------------===//
442// Assembly Printers
443//===----------------------------------------------------------------------===//
444
Chris Lattner56832602004-10-03 20:36:57 +0000445// The X86 target supports two different syntaxes for emitting machine code.
446// This is controlled by the -x86-asm-syntax={att|intel}
447def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000448 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000449 int Variant = 0;
450}
451def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000452 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000453 int Variant = 1;
454}
455
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000456def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000457 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000458 let InstructionSet = X86InstrInfo;
Daniel Dunbar00331992009-07-29 00:02:19 +0000459 let AssemblyParsers = [ATTAsmParser];
Devang Patel67bf992a2012-01-10 17:51:54 +0000460 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000461 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000462}