blob: 8fcc8e31d5d44152b611f04a6e1d11b1c93acb58 [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
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +000034def FeatureX87 : SubtargetFeature<"x87","HasX87", "true",
35 "Enable X87 float instructions">;
36
Chris Lattnercc8c5812009-09-02 05:53:04 +000037def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
38 "Enable conditional move instructions">;
39
Benjamin Kramer2f489232010-12-04 20:32:23 +000040def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
41 "Support POPCNT instruction">;
42
Craig Topper09b65982015-10-16 06:03:09 +000043def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
44 "Support fxsave/fxrestore instructions">;
45
Amjad Aboud1db6d7a2015-10-12 11:47:46 +000046def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
47 "Support xsave instructions">;
48
49def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
50 "Support xsaveopt instructions">;
51
52def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
53 "Support xsavec instructions">;
54
55def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
56 "Support xsaves instructions">;
57
Bill Wendlinge6182262007-05-04 20:38:40 +000058def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
59 "Enable SSE instructions",
Chris Lattnercc8c5812009-09-02 05:53:04 +000060 // SSE codegen depends on cmovs, and all
Michael J. Spencerb88784c2011-04-14 14:33:36 +000061 // SSE1+ processors support them.
Eric Christopher11e59832015-10-08 20:10:06 +000062 [FeatureCMOV]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000063def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
64 "Enable SSE2 instructions",
65 [FeatureSSE1]>;
66def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
67 "Enable SSE3 instructions",
68 [FeatureSSE2]>;
69def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
70 "Enable SSSE3 instructions",
71 [FeatureSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000072def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
Nate Begemane14fdfa2008-02-03 07:18:54 +000073 "Enable SSE 4.1 instructions",
74 [FeatureSSSE3]>;
Rafael Espindola94a2c562013-08-23 20:21:34 +000075def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
Nate Begemane14fdfa2008-02-03 07:18:54 +000076 "Enable SSE 4.2 instructions",
Craig Topper7bd33052011-12-29 15:51:45 +000077 [FeatureSSE41]>;
Eric Christopher57a6e132015-11-14 03:04:00 +000078// The MMX subtarget feature is separate from the rest of the SSE features
79// because it's important (for odd compatibility reasons) to be able to
80// turn it off explicitly while allowing SSE+ to be on.
81def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
82 "Enable MMX instructions">;
Bill Wendlinge6182262007-05-04 20:38:40 +000083def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
Michael J. Spencer30088ba2011-04-15 00:32:41 +000084 "Enable 3DNow! instructions",
85 [FeatureMMX]>;
Bill Wendlinge6182262007-05-04 20:38:40 +000086def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
Bill Wendlingf985c492007-05-06 07:56:19 +000087 "Enable 3DNow! Athlon instructions",
88 [Feature3DNow]>;
Dan Gohman74037512009-02-03 00:04:43 +000089// All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
90// feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
91// without disabling 64-bit mode.
Bill Wendlingf985c492007-05-06 07:56:19 +000092def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
Chris Lattner77f7dba2010-03-14 22:24:34 +000093 "Support 64-bit instructions",
94 [FeatureCMOV]>;
Nick Lewycky3be42b82013-10-05 20:11:44 +000095def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
Eli Friedman5e570422011-08-26 21:21:21 +000096 "64-bit with cmpxchg16b",
97 [Feature64Bit]>;
Evan Cheng4c91aa32009-01-02 05:35:45 +000098def FeatureSlowBTMem : SubtargetFeature<"slow-bt-mem", "IsBTMemSlow", "true",
99 "Bit testing of memory is slow">;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000100def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
101 "SHLD instruction is slow">;
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000102def FeatureSlowPMULLD : SubtargetFeature<"slow-pmulld", "IsPMULLDSlow", "true",
103 "PMULLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +0000104// FIXME: This should not apply to CPUs that do not have SSE.
105def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
106 "IsUAMem16Slow", "true",
107 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000108def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000109 "IsUAMem32Slow", "true",
110 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000111def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000112 "Support SSE 4a instructions",
113 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000114
Craig Topperf287a452012-01-09 09:02:13 +0000115def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
116 "Enable AVX instructions",
117 [FeatureSSE42]>;
118def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000119 "Enable AVX2 instructions",
120 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000121def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000122 "Enable AVX-512 instructions",
123 [FeatureAVX2]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000124def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000125 "Enable AVX-512 Exponential and Reciprocal Instructions",
126 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000127def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000128 "Enable AVX-512 Conflict Detection Instructions",
129 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000130def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000131 "Enable AVX-512 PreFetch Instructions",
132 [FeatureAVX512]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000133def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPFPREFETCHWT1",
134 "true",
135 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000136def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
137 "Enable AVX-512 Doubleword and Quadword Instructions",
138 [FeatureAVX512]>;
139def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
140 "Enable AVX-512 Byte and Word Instructions",
141 [FeatureAVX512]>;
142def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
143 "Enable AVX-512 Vector Length eXtensions",
144 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000145def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
Craig Topper5c842be2016-11-09 04:50:48 +0000146 "Enable AVX-512 Vector Byte Manipulation Instructions",
147 [FeatureBWI]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000148def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000149 "Enable AVX-512 Integer Fused Multiple-Add",
150 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000151def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
152 "Enable protection keys">;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000153def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
154 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000155 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000156def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000157 "Enable three-operand fused multiple-add",
158 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000159def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000160 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000161 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000162def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000163 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000164 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000165def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
166 "HasSSEUnalignedMem", "true",
167 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000168def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000169 "Enable AES instructions",
170 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000171def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
172 "Enable TBM instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000173def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
174 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000175def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000176 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000177def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000178 "Support 16-bit floating point conversion instructions",
179 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000180def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
181 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000182def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
183 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000184def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
185 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000186def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
187 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000188def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
189 "Support RTM instructions">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000190def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
191 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000192def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
193 "Enable SHA instructions",
194 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000195def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
196 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000197def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
198 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000199def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
200 "Support LAHF and SAHF instructions">;
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000201def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
202 "Enable MONITORX/MWAITX timer functionality">;
Craig Topper50f3d142017-02-09 04:27:34 +0000203def FeatureCLZERO : SubtargetFeature<"clzero", "HasCLZERO", "true",
204 "Enable Cache Line Zero">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000205def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
206 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000207def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000208 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000209def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
210 "HasSlowDivide32", "true",
211 "Use 8-bit divide for positive values less than 256">;
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000212def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divl",
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000213 "HasSlowDivide64", "true",
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000214 "Use 32-bit divide for positive values less than 2^32">;
Preston Gurda01daac2013-01-08 18:27:24 +0000215def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
216 "PadShortFunctions", "true",
217 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000218def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
219 "Enable Software Guard Extensions">;
220def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
221 "Flush A Cache Line Optimized">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000222def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
223 "Cache Line Write Back">;
Michael Kuperstein454d1452015-07-23 12:23:45 +0000224// TODO: This feature ought to be renamed.
Sean Silvae1c6b542015-07-27 00:46:59 +0000225// What it really refers to are CPUs for which certain instructions
226// (which ones besides the example below?) are microcoded.
Michael Kuperstein454d1452015-07-23 12:23:45 +0000227// The best examples of this are the memory forms of CALL and PUSH
228// instructions, which should be avoided in favor of a MOV + register CALL/PUSH.
Preston Gurd663e6f92013-03-27 19:14:02 +0000229def FeatureCallRegIndirect : SubtargetFeature<"call-reg-indirect",
230 "CallRegIndirect", "true",
231 "Call register indirect">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000232def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
233 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000234def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
235 "LEA instruction with certain arguments is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000236def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
237 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000238def FeatureSoftFloat
239 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
240 "Use software floating point features.">;
Amjad Aboud4f977512017-03-03 09:03:24 +0000241// On some X86 processors, there is no performance hazard to writing only the
242// lower parts of a YMM or ZMM register without clearing the upper part.
243def FeatureFastPartialYMMorZMMWrite
244 : SubtargetFeature<"fast-partial-ymm-or-zmm-write",
245 "HasFastPartialYMMorZMMWrite",
246 "true", "Partial writes to YMM/ZMM registers are fast">;
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000247// FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
248// than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
249// vector FSQRT has higher throughput than the corresponding NR code.
250// The idea is that throughput bound code is likely to be vectorized, so for
251// vectorized code we should care about the throughput of SQRT operations.
252// But if the code is scalar that probably means that the code has some kind of
253// dependency and we should care more about reducing the latency.
254def FeatureFastScalarFSQRT
255 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
256 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
257def FeatureFastVectorFSQRT
258 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
259 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000260// If lzcnt has equivalent latency/throughput to most simple integer ops, it can
261// be used to replace test/set sequences.
262def FeatureFastLZCNT
263 : SubtargetFeature<
264 "fast-lzcnt", "HasFastLZCNT", "true",
265 "LZCNT instructions are as fast as most simple integer ops">;
David Greene8f6f72c2009-06-26 22:46:54 +0000266
Craig Topperd88389a2017-02-21 06:39:13 +0000267
268// Sandy Bridge and newer processors can use SHLD with the same source on both
269// inputs to implement rotate to avoid the partial flag update of the normal
270// rotate instructions.
271def FeatureFastSHLDRotate
272 : SubtargetFeature<
273 "fast-shld-rotate", "HasFastSHLDRotate", "true",
274 "SHLD can be used as a faster rotate">;
275
Evan Chengff1beda2006-10-06 09:17:41 +0000276//===----------------------------------------------------------------------===//
277// X86 processors supported.
278//===----------------------------------------------------------------------===//
279
Andrew Trick8523b162012-02-01 23:20:51 +0000280include "X86Schedule.td"
281
282def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
283 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000284def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
285 "Intel Silvermont processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000286
Evan Chengff1beda2006-10-06 09:17:41 +0000287class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000288 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000289
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000290def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
291def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
292def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
293def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
294def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
295def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
296def : Proc<"i686", [FeatureX87, FeatureSlowUAMem16]>;
297def : Proc<"pentiumpro", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
298def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
299 FeatureCMOV, FeatureFXSR]>;
300def : Proc<"pentium3", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
301 FeatureSSE1, FeatureFXSR]>;
302def : Proc<"pentium3m", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
303 FeatureSSE1, FeatureFXSR, FeatureSlowBTMem]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000304
305// Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
306// The intent is to enable it for pentium4 which is the current default
307// processor in a vanilla 32-bit clang compilation when no specific
308// architecture is specified. This generally gives a nice performance
309// increase on silvermont, with largely neutral behavior on other
310// contemporary large core processors.
311// pentium-m, pentium4m, prescott and nocona are included as a preventative
312// measure to avoid performance surprises, in case clang's default cpu
313// changes slightly.
314
315def : ProcessorModel<"pentium-m", GenericPostRAModel,
316 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
317 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
318
319def : ProcessorModel<"pentium4", GenericPostRAModel,
320 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
321 FeatureSSE2, FeatureFXSR]>;
322
323def : ProcessorModel<"pentium4m", GenericPostRAModel,
324 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
325 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000326
Andrey Turetskiy958eb462016-04-01 10:16:15 +0000327// Intel Quark.
328def : Proc<"lakemont", []>;
329
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000330// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000331def : ProcessorModel<"yonah", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000332 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
333 FeatureFXSR, FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000334
335// NetBurst.
Mitch Bodarte60465d2016-04-27 22:52:35 +0000336def : ProcessorModel<"prescott", GenericPostRAModel,
337 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
338 FeatureFXSR, FeatureSlowBTMem]>;
339def : ProcessorModel<"nocona", GenericPostRAModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000340 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000341 FeatureSlowUAMem16,
342 FeatureMMX,
343 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000344 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000345 FeatureCMPXCHG16B,
346 FeatureSlowBTMem
347]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000348
349// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000350def : ProcessorModel<"core2", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000351 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000352 FeatureSlowUAMem16,
353 FeatureMMX,
354 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000355 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000356 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000357 FeatureSlowBTMem,
358 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000359]>;
360def : ProcessorModel<"penryn", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000361 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000362 FeatureSlowUAMem16,
363 FeatureMMX,
364 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000365 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000366 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000367 FeatureSlowBTMem,
368 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000369]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000370
Chandler Carruthaf8924032014-12-09 10:58:36 +0000371// Atom CPUs.
372class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000373 ProcIntelAtom,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000374 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000375 FeatureSlowUAMem16,
376 FeatureMMX,
377 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000378 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000379 FeatureCMPXCHG16B,
380 FeatureMOVBE,
381 FeatureSlowBTMem,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000382 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000383 FeatureSlowDivide32,
384 FeatureSlowDivide64,
385 FeatureCallRegIndirect,
386 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000387 FeaturePadShortFunctions,
388 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000389]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000390def : BonnellProc<"bonnell">;
391def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000392
Chandler Carruthaf8924032014-12-09 10:58:36 +0000393class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000394 ProcIntelSLM,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000395 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000396 FeatureMMX,
397 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000398 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000399 FeatureCMPXCHG16B,
400 FeatureMOVBE,
401 FeaturePOPCNT,
402 FeaturePCLMUL,
403 FeatureAES,
404 FeatureSlowDivide64,
405 FeatureCallRegIndirect,
406 FeaturePRFCHW,
407 FeatureSlowLEA,
408 FeatureSlowIncDec,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000409 FeatureSlowBTMem,
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000410 FeatureSlowPMULLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000411 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000412]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000413def : SilvermontProc<"silvermont">;
414def : SilvermontProc<"slm">; // Legacy alias.
415
Eric Christopher2ef63182010-04-02 21:54:27 +0000416// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000417class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000418 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000419 FeatureMMX,
420 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000421 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000422 FeatureCMPXCHG16B,
423 FeatureSlowBTMem,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000424 FeaturePOPCNT,
425 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000426]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000427def : NehalemProc<"nehalem">;
428def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000429
Eric Christopher2ef63182010-04-02 21:54:27 +0000430// Westmere is a similar machine to nehalem with some additional features.
431// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000432class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000433 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000434 FeatureMMX,
435 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000436 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000437 FeatureCMPXCHG16B,
438 FeatureSlowBTMem,
439 FeaturePOPCNT,
440 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000441 FeaturePCLMUL,
442 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000443]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000444def : WestmereProc<"westmere">;
445
Craig Topperf730a6b2016-02-13 21:35:37 +0000446class ProcessorFeatures<list<SubtargetFeature> Inherited,
447 list<SubtargetFeature> NewFeatures> {
448 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
449}
450
451class ProcModel<string Name, SchedMachineModel Model,
452 list<SubtargetFeature> ProcFeatures,
453 list<SubtargetFeature> OtherFeatures> :
454 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
455
Nate Begeman8b08f522010-12-10 00:26:57 +0000456// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
457// rather than a superset.
Craig Topperf730a6b2016-02-13 21:35:37 +0000458def SNBFeatures : ProcessorFeatures<[], [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000459 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000460 FeatureMMX,
461 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000462 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000463 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000464 FeaturePOPCNT,
465 FeatureAES,
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000466 FeatureSlowDivide64,
Craig Topper0ee35692015-10-14 05:37:38 +0000467 FeaturePCLMUL,
468 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000469 FeatureXSAVEOPT,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000470 FeatureLAHFSAHF,
Craig Topperd88389a2017-02-21 06:39:13 +0000471 FeatureFastScalarFSQRT,
472 FeatureFastSHLDRotate
Eric Christopher11e59832015-10-08 20:10:06 +0000473]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000474
Craig Topperf730a6b2016-02-13 21:35:37 +0000475class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
476 SNBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000477 FeatureSlowBTMem,
478 FeatureSlowUAMem32
479]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000480def : SandyBridgeProc<"sandybridge">;
481def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000482
Craig Topperf730a6b2016-02-13 21:35:37 +0000483def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000484 FeatureRDRAND,
485 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000486 FeatureFSGSBase
487]>;
488
Craig Topperf730a6b2016-02-13 21:35:37 +0000489class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
490 IVBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000491 FeatureSlowBTMem,
492 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000493]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000494def : IvyBridgeProc<"ivybridge">;
495def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000496
Craig Topperf730a6b2016-02-13 21:35:37 +0000497def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000498 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000499 FeatureBMI,
500 FeatureBMI2,
501 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000502 FeatureLZCNT,
503 FeatureMOVBE,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000504 FeatureSlowIncDec
Eric Christopher11e59832015-10-08 20:10:06 +0000505]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000506
Craig Topperf730a6b2016-02-13 21:35:37 +0000507class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
508 HSWFeatures.Value, []>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000509def : HaswellProc<"haswell">;
510def : HaswellProc<"core-avx2">; // Legacy alias.
511
Craig Topperf730a6b2016-02-13 21:35:37 +0000512def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000513 FeatureADX,
Craig Topper86576bd2017-02-09 06:50:59 +0000514 FeatureRDSEED
Eric Christopher11e59832015-10-08 20:10:06 +0000515]>;
Craig Topperf730a6b2016-02-13 21:35:37 +0000516class BroadwellProc<string Name> : ProcModel<Name, HaswellModel,
517 BDWFeatures.Value, []>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000518def : BroadwellProc<"broadwell">;
519
Craig Topperf730a6b2016-02-13 21:35:37 +0000520def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000521 FeatureMPX,
Eric Christopher58297412017-03-29 07:40:44 +0000522 FeatureRTM,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000523 FeatureXSAVEC,
524 FeatureXSAVES,
525 FeatureSGX,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000526 FeatureCLFLUSHOPT,
527 FeatureFastVectorFSQRT
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000528]>;
529
530// FIXME: define SKL model
Craig Topperf730a6b2016-02-13 21:35:37 +0000531class SkylakeClientProc<string Name> : ProcModel<Name, HaswellModel,
532 SKLFeatures.Value, []>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000533def : SkylakeClientProc<"skylake">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000534
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000535// FIXME: define KNL model
Craig Topperf730a6b2016-02-13 21:35:37 +0000536class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
537 IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000538 FeatureAVX512,
539 FeatureERI,
540 FeatureCDI,
541 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000542 FeaturePREFETCHWT1,
543 FeatureADX,
544 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000545 FeatureMOVBE,
546 FeatureLZCNT,
547 FeatureBMI,
548 FeatureBMI2,
Amjad Aboud4f977512017-03-03 09:03:24 +0000549 FeatureFMA,
550 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000551]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000552def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000553
Craig Topperf730a6b2016-02-13 21:35:37 +0000554def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000555 FeatureAVX512,
556 FeatureCDI,
557 FeatureDQI,
558 FeatureBWI,
559 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000560 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000561 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000562]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000563
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000564// FIXME: define SKX model
Craig Topperf730a6b2016-02-13 21:35:37 +0000565class SkylakeServerProc<string Name> : ProcModel<Name, HaswellModel,
566 SKXFeatures.Value, []>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000567def : SkylakeServerProc<"skylake-avx512">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000568def : SkylakeServerProc<"skx">; // Legacy alias.
569
Craig Topperf730a6b2016-02-13 21:35:37 +0000570def CNLFeatures : ProcessorFeatures<SKXFeatures.Value, [
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000571 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000572 FeatureIFMA,
573 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000574]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000575
Craig Topperf730a6b2016-02-13 21:35:37 +0000576class CannonlakeProc<string Name> : ProcModel<Name, HaswellModel,
577 CNLFeatures.Value, []>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000578def : CannonlakeProc<"cannonlake">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000579
580// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000581
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000582def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
583def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
584def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
585def : Proc<"athlon", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000586 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000587def : Proc<"athlon-tbird", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000588 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000589def : Proc<"athlon-4", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
590 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000591 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000592def : Proc<"athlon-xp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
593 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000594 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000595def : Proc<"athlon-mp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
596 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000597 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000598def : Proc<"k8", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
599 Feature3DNowA, FeatureFXSR, Feature64Bit,
600 FeatureSlowBTMem, FeatureSlowSHLD]>;
601def : Proc<"opteron", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
602 Feature3DNowA, FeatureFXSR, Feature64Bit,
603 FeatureSlowBTMem, FeatureSlowSHLD]>;
604def : Proc<"athlon64", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
605 Feature3DNowA, FeatureFXSR, Feature64Bit,
606 FeatureSlowBTMem, FeatureSlowSHLD]>;
607def : Proc<"athlon-fx", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
608 Feature3DNowA, FeatureFXSR, Feature64Bit,
609 FeatureSlowBTMem, FeatureSlowSHLD]>;
610def : Proc<"k8-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
611 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
612 FeatureSlowBTMem, FeatureSlowSHLD]>;
613def : Proc<"opteron-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
614 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
615 FeatureSlowBTMem, FeatureSlowSHLD]>;
616def : Proc<"athlon64-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
617 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
618 FeatureSlowBTMem, FeatureSlowSHLD]>;
619def : Proc<"amdfam10", [FeatureX87, FeatureSSE4A, Feature3DNowA,
620 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
621 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
622 FeatureLAHFSAHF]>;
623def : Proc<"barcelona", [FeatureX87, FeatureSSE4A, Feature3DNowA,
624 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
625 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
626 FeatureLAHFSAHF]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000627
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000628// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000629def : Proc<"btver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000630 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000631 FeatureMMX,
632 FeatureSSSE3,
633 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000634 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000635 FeatureCMPXCHG16B,
636 FeaturePRFCHW,
637 FeatureLZCNT,
638 FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000639 FeatureSlowSHLD,
640 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000641]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000642
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000643// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000644def : ProcessorModel<"btver2", BtVer2Model, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000645 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000646 FeatureMMX,
647 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000648 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000649 FeatureSSE4A,
650 FeatureCMPXCHG16B,
651 FeaturePRFCHW,
652 FeatureAES,
653 FeaturePCLMUL,
654 FeatureBMI,
655 FeatureF16C,
656 FeatureMOVBE,
657 FeatureLZCNT,
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000658 FeatureFastLZCNT,
Eric Christopher11e59832015-10-08 20:10:06 +0000659 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000660 FeatureXSAVE,
661 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000662 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000663 FeatureLAHFSAHF,
Amjad Aboud4f977512017-03-03 09:03:24 +0000664 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000665]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000666
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000667// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000668def : Proc<"bdver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000669 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000670 FeatureXOP,
671 FeatureFMA4,
672 FeatureCMPXCHG16B,
673 FeatureAES,
674 FeaturePRFCHW,
675 FeaturePCLMUL,
676 FeatureMMX,
677 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000678 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000679 FeatureSSE4A,
680 FeatureLZCNT,
681 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000682 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000683 FeatureSlowSHLD,
684 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000685]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000686// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000687def : Proc<"bdver2", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000688 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000689 FeatureXOP,
690 FeatureFMA4,
691 FeatureCMPXCHG16B,
692 FeatureAES,
693 FeaturePRFCHW,
694 FeaturePCLMUL,
695 FeatureMMX,
696 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000697 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000698 FeatureSSE4A,
699 FeatureF16C,
700 FeatureLZCNT,
701 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000702 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000703 FeatureBMI,
704 FeatureTBM,
705 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000706 FeatureSlowSHLD,
707 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000708]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000709
710// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000711def : Proc<"bdver3", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000712 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000713 FeatureXOP,
714 FeatureFMA4,
715 FeatureCMPXCHG16B,
716 FeatureAES,
717 FeaturePRFCHW,
718 FeaturePCLMUL,
719 FeatureMMX,
720 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000721 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000722 FeatureSSE4A,
723 FeatureF16C,
724 FeatureLZCNT,
725 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000726 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000727 FeatureBMI,
728 FeatureTBM,
729 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000730 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000731 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000732 FeatureFSGSBase,
733 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000734]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000735
Benjamin Kramer60045732014-05-02 15:47:07 +0000736// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000737def : Proc<"bdver4", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000738 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000739 FeatureMMX,
740 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000741 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000742 FeatureXOP,
743 FeatureFMA4,
744 FeatureCMPXCHG16B,
745 FeatureAES,
746 FeaturePRFCHW,
747 FeaturePCLMUL,
748 FeatureF16C,
749 FeatureLZCNT,
750 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000751 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000752 FeatureBMI,
753 FeatureBMI2,
754 FeatureTBM,
755 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000756 FeatureXSAVEOPT,
Simon Pilgrim381a0ad2016-07-24 16:00:53 +0000757 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000758 FeatureFSGSBase,
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000759 FeatureLAHFSAHF,
760 FeatureMWAITX
Eric Christopher11e59832015-10-08 20:10:06 +0000761]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000762
Craig Topperd55b8312017-01-10 06:01:16 +0000763// TODO: The scheduler model falls to BTVER2 model.
764// The znver1 model has to be put in place.
765// Zen
766def: ProcessorModel<"znver1", BtVer2Model, [
767 FeatureADX,
768 FeatureAES,
769 FeatureAVX2,
770 FeatureBMI,
771 FeatureBMI2,
772 FeatureCLFLUSHOPT,
Craig Topper50f3d142017-02-09 04:27:34 +0000773 FeatureCLZERO,
Craig Topperd55b8312017-01-10 06:01:16 +0000774 FeatureCMPXCHG16B,
775 FeatureF16C,
776 FeatureFMA,
777 FeatureFSGSBase,
778 FeatureFXSR,
779 FeatureFastLZCNT,
780 FeatureLAHFSAHF,
781 FeatureLZCNT,
782 FeatureMMX,
783 FeatureMOVBE,
784 FeatureMWAITX,
785 FeaturePCLMUL,
786 FeaturePOPCNT,
787 FeaturePRFCHW,
788 FeatureRDRAND,
789 FeatureRDSEED,
790 FeatureSHA,
Craig Topperd55b8312017-01-10 06:01:16 +0000791 FeatureSSE4A,
792 FeatureSlowSHLD,
793 FeatureX87,
794 FeatureXSAVE,
795 FeatureXSAVEC,
796 FeatureXSAVEOPT,
797 FeatureXSAVES]>;
798
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000799def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000800
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000801def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
802def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
803def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
804def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
805 FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000806
Chandler Carruth32908d72014-05-07 17:37:03 +0000807// We also provide a generic 64-bit specific x86 processor model which tries to
808// be good for modern chips without enabling instruction set encodings past the
809// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
810// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000811//
Chandler Carruth32908d72014-05-07 17:37:03 +0000812// We currently use the Sandy Bridge model as the default scheduling model as
813// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
814// covers a huge swath of x86 processors. If there are specific scheduling
815// knobs which need to be tuned differently for AMD chips, we might consider
816// forming a common base for them.
Craig Topper09b65982015-10-16 06:03:09 +0000817def : ProcessorModel<"x86-64", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000818 [FeatureX87, FeatureMMX, FeatureSSE2, FeatureFXSR,
819 Feature64Bit, FeatureSlowBTMem ]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000820
Evan Chengff1beda2006-10-06 09:17:41 +0000821//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000822// Register File Description
823//===----------------------------------------------------------------------===//
824
825include "X86RegisterInfo.td"
Igor Bregerb4442f32017-02-10 07:05:56 +0000826include "X86RegisterBanks.td"
Chris Lattner5da8e802003-08-03 15:47:49 +0000827
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000828//===----------------------------------------------------------------------===//
829// Instruction Descriptions
830//===----------------------------------------------------------------------===//
831
Chris Lattner59a4a912003-08-03 21:54:21 +0000832include "X86InstrInfo.td"
833
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000834def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000835
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000836//===----------------------------------------------------------------------===//
837// Calling Conventions
838//===----------------------------------------------------------------------===//
839
840include "X86CallingConv.td"
841
842
843//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000844// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000845//===----------------------------------------------------------------------===//
846
Devang Patel85d684a2012-01-09 19:13:28 +0000847def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000848 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000849
Chad Rosier9f7a2212013-04-18 22:35:36 +0000850 // Variant name.
851 string Name = "att";
852
Daniel Dunbare4318712009-08-11 20:59:47 +0000853 // Discard comments in assembly strings.
854 string CommentDelimiter = "#";
855
856 // Recognize hard coded registers.
857 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000858}
859
Devang Patel67bf992a2012-01-10 17:51:54 +0000860def IntelAsmParserVariant : AsmParserVariant {
861 int Variant = 1;
862
Chad Rosier9f7a2212013-04-18 22:35:36 +0000863 // Variant name.
864 string Name = "intel";
865
Devang Patel67bf992a2012-01-10 17:51:54 +0000866 // Discard comments in assembly strings.
867 string CommentDelimiter = ";";
868
869 // Recognize hard coded registers.
870 string RegisterPrefix = "";
871}
872
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000873//===----------------------------------------------------------------------===//
874// Assembly Printers
875//===----------------------------------------------------------------------===//
876
Chris Lattner56832602004-10-03 20:36:57 +0000877// The X86 target supports two different syntaxes for emitting machine code.
878// This is controlled by the -x86-asm-syntax={att|intel}
879def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000880 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000881 int Variant = 0;
882}
883def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +0000884 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000885 int Variant = 1;
886}
887
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000888def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000889 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +0000890 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +0000891 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +0000892 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000893}