blob: 527c38b918672995989aad0c5fede258de6868df [file] [log] [blame]
Jia Liub22310f2012-02-18 12:03:15 +00001//===-- X86.td - Target definition file for the Intel X86 --*- tablegen -*-===//
Michael J. Spencerb88784c2011-04-14 14:33:36 +00002//
John Criswell29265fe2003-10-21 15:17:13 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Michael J. Spencerb88784c2011-04-14 14:33:36 +00007//
John Criswell29265fe2003-10-21 15:17:13 +00008//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +00009//
Craig Topper271064e2011-10-11 06:44:02 +000010// This is a target description file for the Intel i386 architecture, referred
11// to here as the "X86" architecture.
Chris Lattner5da8e802003-08-03 15:47:49 +000012//
13//===----------------------------------------------------------------------===//
14
Chris Lattner25510802003-08-04 04:59:56 +000015// Get the target-independent interfaces which we are implementing...
Chris Lattner5da8e802003-08-03 15:47:49 +000016//
Evan Cheng977e7be2008-11-24 07:34:46 +000017include "llvm/Target/Target.td"
Chris Lattner5da8e802003-08-03 15:47:49 +000018
19//===----------------------------------------------------------------------===//
Anitha Boyapati426feb62012-08-16 03:50:04 +000020// X86 Subtarget state
Evan Cheng13bcc6c2011-07-07 21:06:52 +000021//
22
23def Mode64Bit : SubtargetFeature<"64bit-mode", "In64BitMode", "true",
24 "64-bit mode (x86_64)">;
Craig Topper3c80d622014-01-06 04:55:54 +000025def Mode32Bit : SubtargetFeature<"32bit-mode", "In32BitMode", "true",
26 "32-bit mode (80386)">;
27def Mode16Bit : SubtargetFeature<"16bit-mode", "In16BitMode", "true",
28 "16-bit mode (i8086)">;
Evan Cheng13bcc6c2011-07-07 21:06:52 +000029
30//===----------------------------------------------------------------------===//
Anitha Boyapati426feb62012-08-16 03:50:04 +000031// X86 Subtarget features
Bill Wendlinge6182262007-05-04 20:38:40 +000032//===----------------------------------------------------------------------===//
Chris Lattnercc8c5812009-09-02 05:53:04 +000033
34def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
35 "Enable conditional move instructions">;
36
Benjamin Kramer2f489232010-12-04 20:32:23 +000037def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
38 "Support POPCNT instruction">;
39
Craig Topper09b65982015-10-16 06:03:09 +000040def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
41 "Support fxsave/fxrestore instructions">;
42
Amjad Aboud1db6d7a2015-10-12 11:47:46 +000043def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
44 "Support xsave instructions">;
45
46def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
47 "Support xsaveopt instructions">;
48
49def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
50 "Support xsavec instructions">;
51
52def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
53 "Support xsaves instructions">;
54
Bill Wendlinge6182262007-05-04 20:38:40 +000055def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
56 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000057 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000058 // SSE1+ processors support them.
Eric Christopher11e59832015-10-08 20:10:06 +000059 [FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000060def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
61 "Enable SSE2 instructions",
62 [FeatureSSE1]>;
63def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
64 "Enable SSE3 instructions",
65 [FeatureSSE2]>;
66def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
67 "Enable SSSE3 instructions",
68 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000069def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000070 "Enable SSE 4.1 instructions",
71 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000072def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000073 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000074 [FeatureSSE41]>;
Eric Christopher57a6e132015-11-14 03:04:00 +000075// The MMX subtarget feature is separate from the rest of the SSE features
76// because it's important (for odd compatibility reasons) to be able to
77// turn it off explicitly while allowing SSE+ to be on.
78def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
79 "Enable MMX instructions">;
Bill Wendlinge6182262007-05-04 20:38:40 +000080def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000081 "Enable 3DNow! instructions",
82 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000083def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000084 "Enable 3DNow! Athlon instructions",
85 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000086// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
87// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
88// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000089def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000090 "Support 64-bit instructions",
91 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000092def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000093 "64-bit with cmpxchg16b",
94 [Feature64Bit]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000095def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
96 "Bit testing of memory is slow">;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +000097def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
98 "SHLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +000099// FIXME: This should not apply to CPUs that do not have SSE.
100def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
101 "IsUAMem16Slow", "true",
102 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000103def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000104 "IsUAMem32Slow", "true",
105 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000106def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000107 "Support SSE 4a instructions",
108 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000109
Craig Topperf287a452012-01-09 09:02:13 +0000110def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
111 "Enable AVX instructions",
112 [FeatureSSE42]>;
113def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000114 "Enable AVX2 instructions",
115 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000116def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000117 "Enable AVX-512 instructions",
118 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000119def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000120 "Enable AVX-512 Exponential and Reciprocal Instructions",
121 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000122def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000123 "Enable AVX-512 Conflict Detection Instructions",
124 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000125def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000126 "Enable AVX-512 PreFetch Instructions",
127 [FeatureAVX512]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000128def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPFPREFETCHWT1",
129 "true",
130 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000131def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
132 "Enable AVX-512 Doubleword and Quadword Instructions",
133 [FeatureAVX512]>;
134def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
135 "Enable AVX-512 Byte and Word Instructions",
136 [FeatureAVX512]>;
137def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
138 "Enable AVX-512 Vector Length eXtensions",
139 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000140def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
141 "Enable AVX-512 Vector Bit Manipulation Instructions",
142 [FeatureAVX512]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000143def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000144 "Enable AVX-512 Integer Fused Multiple-Add",
145 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000146def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
147 "Enable protection keys">;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000148def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
149 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000150 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000151def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000152 "Enable three-operand fused multiple-add",
153 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000154def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000155 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000156 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000157def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000158 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000159 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000160def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
161 "HasSSEUnalignedMem", "true",
162 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000163def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000164 "Enable AES instructions",
165 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000166def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
167 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000168def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
169 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000170def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000171 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000172def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000173 "Support 16-bit floating point conversion instructions",
174 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000175def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
176 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000177def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
178 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000179def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
180 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000181def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
182 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000183def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
184 "Support RTM instructions">;
Michael Liaoe344ec92013-03-26 22:46:02 +0000185def FeatureHLE : SubtargetFeature<"hle", "HasHLE", "true",
186 "Support HLE">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000187def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
188 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000189def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
190 "Enable SHA instructions",
191 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000192def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
193 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000194def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
195 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000196def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
197 "Support LAHF and SAHF instructions">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000198def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
199 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000200def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000201 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000202def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
203 "HasSlowDivide32", "true",
204 "Use 8-bit divide for positive values less than 256">;
205def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divw",
206 "HasSlowDivide64", "true",
207 "Use 16-bit divide for positive values less than 65536">;
Preston Gurda01daac2013-01-08 18:27:24 +0000208def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
209 "PadShortFunctions", "true",
210 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000211def FeatureINVPCID : SubtargetFeature<"invpcid", "HasInvPCId", "true",
212 "Invalidate Process-Context Identifier">;
213def FeatureVMFUNC : SubtargetFeature<"vmfunc", "HasVMFUNC", "true",
214 "VM Functions">;
215def FeatureSMAP : SubtargetFeature<"smap", "HasSMAP", "true",
216 "Supervisor Mode Access Protection">;
217def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
218 "Enable Software Guard Extensions">;
219def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
220 "Flush A Cache Line Optimized">;
221def FeaturePCOMMIT : SubtargetFeature<"pcommit", "HasPCOMMIT", "true",
222 "Enable Persistent Commit">;
223def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
224 "Cache Line Write Back">;
Michael Kuperstein454d1452015-07-23 12:23:45 +0000225// TODO: This feature ought to be renamed.
Sean Silvae1c6b542015-07-27 00:46:59 +0000226// What it really refers to are CPUs for which certain instructions
227// (which ones besides the example below?) are microcoded.
Michael Kuperstein454d1452015-07-23 12:23:45 +0000228// The best examples of this are the memory forms of CALL and PUSH
229// instructions, which should be avoided in favor of a MOV + register CALL/PUSH.
Preston Gurd663e6f92013-03-27 19:14:02 +0000230def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
231 "CallRegIndirect", "true",
232 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000233def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
234 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000235def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
236 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000237def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
238 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000239def FeatureSoftFloat
240 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
241 "Use software floating point features.">;
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000242// On at least some AMD processors, there is no performance hazard to writing
243// only the lower parts of a YMM register without clearing the upper part.
244def FeatureFastPartialYMMWrite
245 : SubtargetFeature<"fast-partial-ymm-write", "HasFastPartialYMMWrite",
246 "true", "Partial writes to YMM registers are fast">;
David Greene8f6f72c2009-06-26 22:46:54 +0000247
Evan Chengff1beda2006-10-06 09:17:41 +0000248//===----------------------------------------------------------------------===//
249// X86 processors supported.
250//===----------------------------------------------------------------------===//
251
Andrew Trick8523b162012-02-01 23:20:51 +0000252include "X86Schedule.td"
253
254def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
255 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000256def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
257 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000258
Evan Chengff1beda2006-10-06 09:17:41 +0000259class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000260 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000261
Sanjay Patel30145672015-09-01 20:51:51 +0000262def : Proc<"generic", [FeatureSlowUAMem16]>;
263def : Proc<"i386", [FeatureSlowUAMem16]>;
264def : Proc<"i486", [FeatureSlowUAMem16]>;
265def : Proc<"i586", [FeatureSlowUAMem16]>;
266def : Proc<"pentium", [FeatureSlowUAMem16]>;
267def : Proc<"pentium-mmx", [FeatureSlowUAMem16, FeatureMMX]>;
268def : Proc<"i686", [FeatureSlowUAMem16]>;
269def : Proc<"pentiumpro", [FeatureSlowUAMem16, FeatureCMOV]>;
Craig Topper09b65982015-10-16 06:03:09 +0000270def : Proc<"pentium2", [FeatureSlowUAMem16, FeatureMMX, FeatureCMOV,
271 FeatureFXSR]>;
272def : Proc<"pentium3", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
273 FeatureFXSR]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000274def : Proc<"pentium3m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
Craig Topper09b65982015-10-16 06:03:09 +0000275 FeatureFXSR, FeatureSlowBTMem]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000276def : Proc<"pentium-m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
Craig Topper09b65982015-10-16 06:03:09 +0000277 FeatureFXSR, FeatureSlowBTMem]>;
278def : Proc<"pentium4", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
279 FeatureFXSR]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000280def : Proc<"pentium4m", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE2,
Craig Topper09b65982015-10-16 06:03:09 +0000281 FeatureFXSR, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000282
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000283// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000284def : ProcessorModel<"yonah", SandyBridgeModel,
285 [FeatureSlowUAMem16, FeatureMMX, FeatureSSE3, FeatureFXSR,
286 FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000287
288// NetBurst.
Eric Christopher11e59832015-10-08 20:10:06 +0000289def : Proc<"prescott",
Craig Topper09b65982015-10-16 06:03:09 +0000290 [FeatureSlowUAMem16, FeatureMMX, FeatureSSE3, FeatureFXSR,
291 FeatureSlowBTMem]>;
Eric Christopher11e59832015-10-08 20:10:06 +0000292def : Proc<"nocona", [
293 FeatureSlowUAMem16,
294 FeatureMMX,
295 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000296 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000297 FeatureCMPXCHG16B,
298 FeatureSlowBTMem
299]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000300
301// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000302def : ProcessorModel<"core2", SandyBridgeModel, [
303 FeatureSlowUAMem16,
304 FeatureMMX,
305 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000306 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000307 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000308 FeatureSlowBTMem,
309 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000310]>;
311def : ProcessorModel<"penryn", SandyBridgeModel, [
312 FeatureSlowUAMem16,
313 FeatureMMX,
314 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000315 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000316 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000317 FeatureSlowBTMem,
318 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000319]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000320
Chandler Carruthaf8924032014-12-09 10:58:36 +0000321// Atom CPUs.
322class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000323 ProcIntelAtom,
324 FeatureSlowUAMem16,
325 FeatureMMX,
326 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000327 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000328 FeatureCMPXCHG16B,
329 FeatureMOVBE,
330 FeatureSlowBTMem,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000331 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000332 FeatureSlowDivide32,
333 FeatureSlowDivide64,
334 FeatureCallRegIndirect,
335 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000336 FeaturePadShortFunctions,
337 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000338]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000339def : BonnellProc<"bonnell">;
340def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000341
Chandler Carruthaf8924032014-12-09 10:58:36 +0000342class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000343 ProcIntelSLM,
344 FeatureMMX,
345 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000346 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000347 FeatureCMPXCHG16B,
348 FeatureMOVBE,
349 FeaturePOPCNT,
350 FeaturePCLMUL,
351 FeatureAES,
352 FeatureSlowDivide64,
353 FeatureCallRegIndirect,
354 FeaturePRFCHW,
355 FeatureSlowLEA,
356 FeatureSlowIncDec,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000357 FeatureSlowBTMem,
358 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000359]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000360def : SilvermontProc<"silvermont">;
361def : SilvermontProc<"slm">; // Legacy alias.
362
Eric Christopher2ef63182010-04-02 21:54:27 +0000363// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000364class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000365 FeatureMMX,
366 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000367 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000368 FeatureCMPXCHG16B,
369 FeatureSlowBTMem,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000370 FeaturePOPCNT,
371 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000372]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000373def : NehalemProc<"nehalem">;
374def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000375
Eric Christopher2ef63182010-04-02 21:54:27 +0000376// Westmere is a similar machine to nehalem with some additional features.
377// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000378class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000379 FeatureMMX,
380 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000381 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000382 FeatureCMPXCHG16B,
383 FeatureSlowBTMem,
384 FeaturePOPCNT,
385 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000386 FeaturePCLMUL,
387 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000388]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000389def : WestmereProc<"westmere">;
390
Nate Begeman8b08f522010-12-10 00:26:57 +0000391// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
392// rather than a superset.
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000393def ProcIntelSNB : SubtargetFeature<"snb", "X86ProcFamily", "IntelSNB",
394 " Intel SandyBridge Processor", [
Eric Christopher11e59832015-10-08 20:10:06 +0000395 FeatureMMX,
396 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000397 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000398 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000399 FeaturePOPCNT,
400 FeatureAES,
Craig Topper0ee35692015-10-14 05:37:38 +0000401 FeaturePCLMUL,
402 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000403 FeatureXSAVEOPT,
404 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000405]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000406
407class SandyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
408 ProcIntelSNB,
409 FeatureSlowBTMem,
410 FeatureSlowUAMem32
411]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000412def : SandyBridgeProc<"sandybridge">;
413def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000414
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000415def ProcIntelIVB : SubtargetFeature<"ivb", "X86ProcFamily", "IntelIVB",
416 " Intel IvyBridge Processor", [
417 ProcIntelSNB,
Eric Christopher11e59832015-10-08 20:10:06 +0000418 FeatureRDRAND,
419 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000420 FeatureFSGSBase
421]>;
422
423class IvyBridgeProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
424 ProcIntelIVB,
425 FeatureSlowBTMem,
426 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000427]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000428def : IvyBridgeProc<"ivybridge">;
429def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000430
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000431def ProcIntelHSW : SubtargetFeature<"hsw", "X86ProcFamily", "IntelHSW",
432 " Intel Haswell Processor", [
433 ProcIntelIVB,
Eric Christopher11e59832015-10-08 20:10:06 +0000434 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000435 FeatureBMI,
436 FeatureBMI2,
437 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000438 FeatureLZCNT,
439 FeatureMOVBE,
440 FeatureINVPCID,
441 FeatureVMFUNC,
Eric Christopher11e59832015-10-08 20:10:06 +0000442 FeatureRTM,
443 FeatureHLE,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000444 FeatureSlowIncDec
Eric Christopher11e59832015-10-08 20:10:06 +0000445]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000446
447class HaswellProc<string Name> : ProcessorModel<Name, HaswellModel,
448 [ProcIntelHSW]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000449def : HaswellProc<"haswell">;
450def : HaswellProc<"core-avx2">; // Legacy alias.
451
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000452def ProcIntelBDW : SubtargetFeature<"bdw", "X86ProcFamily", "IntelBDW",
453 " Intel Broadwell Processor", [
454 ProcIntelHSW,
Eric Christopher11e59832015-10-08 20:10:06 +0000455 FeatureADX,
456 FeatureRDSEED,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000457 FeatureSMAP
Eric Christopher11e59832015-10-08 20:10:06 +0000458]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000459class BroadwellProc<string Name> : ProcessorModel<Name, HaswellModel,
460 [ProcIntelBDW]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000461def : BroadwellProc<"broadwell">;
462
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000463def ProcIntelSKL : SubtargetFeature<"skl", "X86ProcFamily", "IntelSKL",
464 " Intel Skylake Client Processor", [
465 ProcIntelBDW,
466 FeatureMPX,
467 FeatureXSAVEC,
468 FeatureXSAVES,
469 FeatureSGX,
470 FeatureCLFLUSHOPT
471]>;
472
473// FIXME: define SKL model
474class SkylakeClientProc<string Name> : ProcessorModel<Name, HaswellModel,
475 [ProcIntelSKL]>;
476def : SkylakeClientProc<"skl">;
477
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000478// FIXME: define KNL model
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000479class KnightsLandingProc<string Name> : ProcessorModel<Name, HaswellModel,[
480 ProcIntelIVB,
Eric Christopher11e59832015-10-08 20:10:06 +0000481 FeatureAVX512,
482 FeatureERI,
483 FeatureCDI,
484 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000485 FeaturePREFETCHWT1,
486 FeatureADX,
487 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000488 FeatureMOVBE,
489 FeatureLZCNT,
490 FeatureBMI,
491 FeatureBMI2,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000492 FeatureFMA
Eric Christopher11e59832015-10-08 20:10:06 +0000493]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000494def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000495
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000496def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily", "IntelSKX",
497 " Intel Skylake Server Processor", [
498 ProcIntelSKL,
Eric Christopher11e59832015-10-08 20:10:06 +0000499 FeatureAVX512,
500 FeatureCDI,
501 FeatureDQI,
502 FeatureBWI,
503 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000504 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000505 FeaturePCOMMIT,
506 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000507]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000508
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000509// FIXME: define SKX model
510class SkylakeServerProc<string Name> : ProcessorModel<Name, HaswellModel,
511 [ ProcIntelSKX]>;
512def : SkylakeServerProc<"skylake">;
513def : SkylakeServerProc<"skx">; // Legacy alias.
514
515def ProcIntelCNL : SubtargetFeature<"cnl", "X86ProcFamily", "IntelCNL",
516 " Intel Cannonlake Processor", [
517 ProcIntelSKX,
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000518 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000519 FeatureIFMA,
520 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000521]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000522
523class CannonlakeProc<string Name> : ProcessorModel<Name, HaswellModel,
524 [ ProcIntelCNL ]>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000525def : CannonlakeProc<"cannonlake">;
526def : CannonlakeProc<"cnl">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000527
528// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000529
Sanjay Patel30145672015-09-01 20:51:51 +0000530def : Proc<"k6", [FeatureSlowUAMem16, FeatureMMX]>;
531def : Proc<"k6-2", [FeatureSlowUAMem16, Feature3DNow]>;
532def : Proc<"k6-3", [FeatureSlowUAMem16, Feature3DNow]>;
533def : Proc<"athlon", [FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000534 FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000535def : Proc<"athlon-tbird", [FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000536 FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000537def : Proc<"athlon-4", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000538 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000539def : Proc<"athlon-xp", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000540 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000541def : Proc<"athlon-mp", [FeatureSlowUAMem16, FeatureSSE1, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000542 FeatureFXSR, FeatureSlowBTMem, FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000543def : Proc<"k8", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000544 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000545 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000546def : Proc<"opteron", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000547 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000548 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000549def : Proc<"athlon64", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000550 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000551 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000552def : Proc<"athlon-fx", [FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000553 FeatureFXSR, Feature64Bit, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000554 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000555def : Proc<"k8-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000556 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000557 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000558def : Proc<"opteron-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000559 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000560 FeatureSlowSHLD]>;
Sanjay Patel30145672015-09-01 20:51:51 +0000561def : Proc<"athlon64-sse3", [FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
Craig Topper09b65982015-10-16 06:03:09 +0000562 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowBTMem,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000563 FeatureSlowSHLD]>;
Craig Topper09b65982015-10-16 06:03:09 +0000564def : Proc<"amdfam10", [FeatureSSE4A, Feature3DNowA, FeatureFXSR,
565 FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
Hans Wennborgfbf28222015-12-04 23:32:19 +0000566 FeatureSlowBTMem, FeatureSlowSHLD, FeatureLAHFSAHF]>;
Craig Topper09b65982015-10-16 06:03:09 +0000567def : Proc<"barcelona", [FeatureSSE4A, Feature3DNowA, FeatureFXSR,
568 FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000569 FeatureSlowBTMem, FeatureSlowSHLD, FeatureLAHFSAHF]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000570
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000571// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000572def : Proc<"btver1", [
573 FeatureMMX,
574 FeatureSSSE3,
575 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000576 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000577 FeatureCMPXCHG16B,
578 FeaturePRFCHW,
579 FeatureLZCNT,
580 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000581 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000582 FeatureSlowSHLD,
583 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000584]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000585
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000586// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000587def : ProcessorModel<"btver2", BtVer2Model, [
588 FeatureMMX,
589 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000590 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000591 FeatureSSE4A,
592 FeatureCMPXCHG16B,
593 FeaturePRFCHW,
594 FeatureAES,
595 FeaturePCLMUL,
596 FeatureBMI,
597 FeatureF16C,
598 FeatureMOVBE,
599 FeatureLZCNT,
600 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000601 FeatureXSAVE,
602 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000603 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000604 FeatureLAHFSAHF,
605 FeatureFastPartialYMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000606]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000607
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000608// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000609def : Proc<"bdver1", [
610 FeatureXOP,
611 FeatureFMA4,
612 FeatureCMPXCHG16B,
613 FeatureAES,
614 FeaturePRFCHW,
615 FeaturePCLMUL,
616 FeatureMMX,
617 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000618 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000619 FeatureSSE4A,
620 FeatureLZCNT,
621 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000622 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000623 FeatureSlowSHLD,
624 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000625]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000626// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000627def : Proc<"bdver2", [
628 FeatureXOP,
629 FeatureFMA4,
630 FeatureCMPXCHG16B,
631 FeatureAES,
632 FeaturePRFCHW,
633 FeaturePCLMUL,
634 FeatureMMX,
635 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000636 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000637 FeatureSSE4A,
638 FeatureF16C,
639 FeatureLZCNT,
640 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000641 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000642 FeatureBMI,
643 FeatureTBM,
644 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000645 FeatureSlowSHLD,
646 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000647]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000648
649// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000650def : Proc<"bdver3", [
651 FeatureXOP,
652 FeatureFMA4,
653 FeatureCMPXCHG16B,
654 FeatureAES,
655 FeaturePRFCHW,
656 FeaturePCLMUL,
657 FeatureMMX,
658 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000659 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000660 FeatureSSE4A,
661 FeatureF16C,
662 FeatureLZCNT,
663 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000664 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000665 FeatureBMI,
666 FeatureTBM,
667 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000668 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000669 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000670 FeatureFSGSBase,
671 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000672]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000673
Benjamin Kramer60045732014-05-02 15:47:07 +0000674// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000675def : Proc<"bdver4", [
676 FeatureMMX,
677 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000678 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000679 FeatureXOP,
680 FeatureFMA4,
681 FeatureCMPXCHG16B,
682 FeatureAES,
683 FeaturePRFCHW,
684 FeaturePCLMUL,
685 FeatureF16C,
686 FeatureLZCNT,
687 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000688 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000689 FeatureBMI,
690 FeatureBMI2,
691 FeatureTBM,
692 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000693 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000694 FeatureFSGSBase,
695 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000696]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000697
Sanjay Patel30145672015-09-01 20:51:51 +0000698def : Proc<"geode", [FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000699
Sanjay Patel30145672015-09-01 20:51:51 +0000700def : Proc<"winchip-c6", [FeatureSlowUAMem16, FeatureMMX]>;
701def : Proc<"winchip2", [FeatureSlowUAMem16, Feature3DNow]>;
702def : Proc<"c3", [FeatureSlowUAMem16, Feature3DNow]>;
Craig Topper09b65982015-10-16 06:03:09 +0000703def : Proc<"c3-2", [FeatureSlowUAMem16, FeatureMMX, FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000704
Chandler Carruth32908d72014-05-07 17:37:03 +0000705// We also provide a generic 64-bit specific x86 processor model which tries to
706// be good for modern chips without enabling instruction set encodings past the
707// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
708// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000709//
Chandler Carruth32908d72014-05-07 17:37:03 +0000710// We currently use the Sandy Bridge model as the default scheduling model as
711// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
712// covers a huge swath of x86 processors. If there are specific scheduling
713// knobs which need to be tuned differently for AMD chips, we might consider
714// forming a common base for them.
Craig Topper09b65982015-10-16 06:03:09 +0000715def : ProcessorModel<"x86-64", SandyBridgeModel,
716 [FeatureMMX, FeatureSSE2, FeatureFXSR, Feature64Bit,
717 FeatureSlowBTMem ]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000718
Evan Chengff1beda2006-10-06 09:17:41 +0000719//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000720// Register File Description
721//===----------------------------------------------------------------------===//
722
723include "X86RegisterInfo.td"
724
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000725//===----------------------------------------------------------------------===//
726// Instruction Descriptions
727//===----------------------------------------------------------------------===//
728
Chris Lattner59a4a912003-08-03 21:54:21 +0000729include "X86InstrInfo.td"
730
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000731def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000732
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000733//===----------------------------------------------------------------------===//
734// Calling Conventions
735//===----------------------------------------------------------------------===//
736
737include "X86CallingConv.td"
738
739
740//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000741// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000742//===----------------------------------------------------------------------===//
743
Devang Patel85d684a2012-01-09 19:13:28 +0000744def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000745 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000746
Chad Rosier9f7a2212013-04-18 22:35:36 +0000747 // Variant name.
748 string Name = "att";
749
Daniel Dunbare4318712009-08-11 20:59:47 +0000750 // Discard comments in assembly strings.
751 string CommentDelimiter = "#";
752
753 // Recognize hard coded registers.
754 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000755}
756
Devang Patel67bf992a2012-01-10 17:51:54 +0000757def IntelAsmParserVariant : AsmParserVariant {
758 int Variant = 1;
759
Chad Rosier9f7a2212013-04-18 22:35:36 +0000760 // Variant name.
761 string Name = "intel";
762
Devang Patel67bf992a2012-01-10 17:51:54 +0000763 // Discard comments in assembly strings.
764 string CommentDelimiter = ";";
765
766 // Recognize hard coded registers.
767 string RegisterPrefix = "";
768}
769
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000770//===----------------------------------------------------------------------===//
771// Assembly Printers
772//===----------------------------------------------------------------------===//
773
Chris Lattner56832602004-10-03 20:36:57 +0000774// The X86 target supports two different syntaxes for emitting machine code.
775// This is controlled by the -x86-asm-syntax={att|intel}
776def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000777 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000778 int Variant = 0;
779}
780def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000781 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000782 int Variant = 1;
783}
784
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000785def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000786 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000787 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +0000788 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000789 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000790}