blob: 7e7c35569093478fb8a891da5f633623f9f2ad60 [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]>;
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +000098def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
99 "SHLD instruction is slow">;
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000100def FeatureSlowPMULLD : SubtargetFeature<"slow-pmulld", "IsPMULLDSlow", "true",
101 "PMULLD instruction is slow">;
Sanjay Patel30145672015-09-01 20:51:51 +0000102// FIXME: This should not apply to CPUs that do not have SSE.
103def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
104 "IsUAMem16Slow", "true",
105 "Slow unaligned 16-byte memory access">;
Sanjay Patel501890e2014-11-21 17:40:04 +0000106def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000107 "IsUAMem32Slow", "true",
108 "Slow unaligned 32-byte memory access">;
Stefanus Du Toit96180b52009-05-26 21:04:35 +0000109def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000110 "Support SSE 4a instructions",
111 [FeatureSSE3]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000112
Craig Topperf287a452012-01-09 09:02:13 +0000113def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
114 "Enable AVX instructions",
115 [FeatureSSE42]>;
116def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
Craig Topper228d9132011-10-30 19:57:21 +0000117 "Enable AVX2 instructions",
118 [FeatureAVX]>;
Craig Toppercb6c3862017-11-06 22:49:01 +0000119def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
120 "Enable three-operand fused multiple-add",
121 [FeatureAVX]>;
Craig Topper428a4e62017-11-06 22:49:04 +0000122def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
123 "Support 16-bit floating point conversion instructions",
124 [FeatureAVX]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000125def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000126 "Enable AVX-512 instructions",
Craig Topper428a4e62017-11-06 22:49:04 +0000127 [FeatureAVX2, FeatureFMA, FeatureF16C]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000128def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000129 "Enable AVX-512 Exponential and Reciprocal Instructions",
130 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000131def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000132 "Enable AVX-512 Conflict Detection Instructions",
133 [FeatureAVX512]>;
Oren Ben Simhon7bf27f02017-05-25 13:45:23 +0000134def FeatureVPOPCNTDQ : SubtargetFeature<"avx512vpopcntdq", "HasVPOPCNTDQ",
135 "true", "Enable AVX-512 Population Count Instructions",
136 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000137def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000138 "Enable AVX-512 PreFetch Instructions",
139 [FeatureAVX512]>;
Craig Toppere2685982017-12-22 02:30:30 +0000140def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPREFETCHWT1",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000141 "true",
142 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000143def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
144 "Enable AVX-512 Doubleword and Quadword Instructions",
145 [FeatureAVX512]>;
146def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
147 "Enable AVX-512 Byte and Word Instructions",
148 [FeatureAVX512]>;
149def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
150 "Enable AVX-512 Vector Length eXtensions",
151 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000152def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
Craig Topper5c842be2016-11-09 04:50:48 +0000153 "Enable AVX-512 Vector Byte Manipulation Instructions",
154 [FeatureBWI]>;
Coby Tayree71e37cc2017-11-21 09:48:44 +0000155def FeatureVBMI2 : SubtargetFeature<"avx512vbmi2", "HasVBMI2", "true",
156 "Enable AVX-512 further Vector Byte Manipulation Instructions",
157 [FeatureBWI]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000158def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000159 "Enable AVX-512 Integer Fused Multiple-Add",
160 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000161def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
162 "Enable protection keys">;
Coby Tayree3880f2a2017-11-21 10:04:28 +0000163def FeatureVNNI : SubtargetFeature<"avx512vnni", "HasVNNI", "true",
164 "Enable AVX-512 Vector Neural Network Instructions",
165 [FeatureAVX512]>;
Coby Tayree5c7fe5d2017-11-21 10:32:42 +0000166def FeatureBITALG : SubtargetFeature<"avx512bitalg", "HasBITALG", "true",
167 "Enable AVX-512 Bit Algorithms",
168 [FeatureBWI]>;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000169def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
170 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000171 [FeatureSSE2]>;
Coby Tayreed8b17be2017-11-26 09:36:41 +0000172def FeatureGFNI : SubtargetFeature<"gfni", "HasGFNI", "true",
173 "Enable Galois Field Arithmetic Instructions",
174 [FeatureSSE2]>;
Coby Tayree7ca5e5872017-11-21 09:30:33 +0000175def FeatureVPCLMULQDQ : SubtargetFeature<"vpclmulqdq", "HasVPCLMULQDQ", "true",
176 "Enable vpclmulqdq instructions",
177 [FeatureAVX, FeaturePCLMUL]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000178def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000179 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000180 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000181def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000182 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000183 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000184def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
185 "HasSSEUnalignedMem", "true",
186 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000187def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000188 "Enable AES instructions",
189 [FeatureSSE2]>;
Coby Tayree2a1c02f2017-11-21 09:11:41 +0000190def FeatureVAES : SubtargetFeature<"vaes", "HasVAES", "true",
191 "Promote selected AES instructions to AVX512/AVX registers",
192 [FeatureAVX, FeatureAES]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000193def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
194 "Enable TBM instructions">;
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000195def FeatureLWP : SubtargetFeature<"lwp", "HasLWP", "true",
196 "Enable LWP instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000197def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
198 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000199def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000200 "Support RDRAND instruction">;
Craig Topper228d9132011-10-30 19:57:21 +0000201def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
202 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000203def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
204 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000205def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
206 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000207def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
208 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000209def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
210 "Support RTM instructions">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000211def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
212 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000213def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
214 "Enable SHA instructions",
215 [FeatureSSE2]>;
Oren Ben Simhonfa582b02017-11-26 13:02:45 +0000216def FeatureSHSTK : SubtargetFeature<"shstk", "HasSHSTK", "true",
217 "Support CET Shadow-Stack instructions">;
218def FeatureIBT : SubtargetFeature<"ibt", "HasIBT", "true",
219 "Support CET Indirect-Branch-Tracking instructions">;
Michael Liao5173ee02013-03-26 17:47:11 +0000220def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
221 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000222def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
223 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000224def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
225 "Support LAHF and SAHF instructions">;
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000226def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
227 "Enable MONITORX/MWAITX timer functionality">;
Craig Topper50f3d142017-02-09 04:27:34 +0000228def FeatureCLZERO : SubtargetFeature<"clzero", "HasCLZERO", "true",
229 "Enable Cache Line Zero">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000230def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
231 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000232def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000233 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000234def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
235 "HasSlowDivide32", "true",
236 "Use 8-bit divide for positive values less than 256">;
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000237def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divl",
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000238 "HasSlowDivide64", "true",
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000239 "Use 32-bit divide for positive values less than 2^32">;
Preston Gurda01daac2013-01-08 18:27:24 +0000240def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
241 "PadShortFunctions", "true",
242 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000243def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
244 "Enable Software Guard Extensions">;
245def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
246 "Flush A Cache Line Optimized">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000247def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
248 "Cache Line Write Back">;
Craig Topper62c47a22017-08-29 05:14:27 +0000249// On some processors, instructions that implicitly take two memory operands are
250// slow. In practice, this means that CALL, PUSH, and POP with memory operands
251// should be avoided in favor of a MOV + register CALL/PUSH/POP.
252def FeatureSlowTwoMemOps : SubtargetFeature<"slow-two-mem-ops",
253 "SlowTwoMemOps", "true",
254 "Two memory operand instructions are slow">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000255def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
256 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000257def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
258 "LEA instruction with certain arguments is slow">;
Lama Saba2ea271b2017-05-18 08:11:50 +0000259def FeatureSlow3OpsLEA : SubtargetFeature<"slow-3ops-lea", "Slow3OpsLEA", "true",
260 "LEA instruction with 3 ops or certain registers is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000261def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
262 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000263def FeatureSoftFloat
264 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
265 "Use software floating point features.">;
Simon Pilgrimfd5df632017-12-19 13:16:43 +0000266// On recent X86 (port bound) processors, its preferable to combine to a single shuffle
267// using a variable mask over multiple fixed shuffles.
268def FeatureFastVariableShuffle
269 : SubtargetFeature<"fast-variable-shuffle",
270 "HasFastVariableShuffle",
271 "true", "Shuffles with variable masks are fast">;
Amjad Aboud4f977512017-03-03 09:03:24 +0000272// On some X86 processors, there is no performance hazard to writing only the
273// lower parts of a YMM or ZMM register without clearing the upper part.
274def FeatureFastPartialYMMorZMMWrite
275 : SubtargetFeature<"fast-partial-ymm-or-zmm-write",
276 "HasFastPartialYMMorZMMWrite",
277 "true", "Partial writes to YMM/ZMM registers are fast">;
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000278// FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
279// than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
280// vector FSQRT has higher throughput than the corresponding NR code.
281// The idea is that throughput bound code is likely to be vectorized, so for
282// vectorized code we should care about the throughput of SQRT operations.
283// But if the code is scalar that probably means that the code has some kind of
284// dependency and we should care more about reducing the latency.
285def FeatureFastScalarFSQRT
286 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
287 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
288def FeatureFastVectorFSQRT
289 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
290 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000291// If lzcnt has equivalent latency/throughput to most simple integer ops, it can
292// be used to replace test/set sequences.
293def FeatureFastLZCNT
294 : SubtargetFeature<
295 "fast-lzcnt", "HasFastLZCNT", "true",
296 "LZCNT instructions are as fast as most simple integer ops">;
David Greene8f6f72c2009-06-26 22:46:54 +0000297
Craig Topperd88389a2017-02-21 06:39:13 +0000298
299// Sandy Bridge and newer processors can use SHLD with the same source on both
300// inputs to implement rotate to avoid the partial flag update of the normal
301// rotate instructions.
302def FeatureFastSHLDRotate
303 : SubtargetFeature<
304 "fast-shld-rotate", "HasFastSHLDRotate", "true",
305 "SHLD can be used as a faster rotate">;
306
Clement Courbet203fc172017-04-21 09:20:50 +0000307// Ivy Bridge and newer processors have enhanced REP MOVSB and STOSB (aka
308// "string operations"). See "REP String Enhancement" in the Intel Software
Clement Courbet41b43332017-04-21 09:21:05 +0000309// Development Manual. This feature essentially means that REP MOVSB will copy
Clement Courbet203fc172017-04-21 09:20:50 +0000310// using the largest available size instead of copying bytes one by one, making
311// it at least as fast as REPMOVS{W,D,Q}.
312def FeatureERMSB
Clement Courbet1ce3b822017-04-21 09:20:39 +0000313 : SubtargetFeature<
Clement Courbet203fc172017-04-21 09:20:50 +0000314 "ermsb", "HasERMSB", "true",
Clement Courbet1ce3b822017-04-21 09:20:39 +0000315 "REP MOVS/STOS are fast">;
316
Craig Topper641e2af2017-08-30 04:34:48 +0000317// Sandy Bridge and newer processors have many instructions that can be
318// fused with conditional branches and pass through the CPU as a single
319// operation.
320def FeatureMacroFusion
321 : SubtargetFeature<"macrofusion", "HasMacroFusion", "true",
322 "Various instructions can be fused with conditional branches">;
323
Craig Topperea37e202017-11-25 18:09:37 +0000324// Gather is available since Haswell (AVX2 set). So technically, we can
325// generate Gathers on all AVX2 processors. But the overhead on HSW is high.
326// Skylake Client processor has faster Gathers than HSW and performance is
327// similar to Skylake Server (AVX-512).
328def FeatureHasFastGather
329 : SubtargetFeature<"fast-gather", "HasFastGather", "true",
330 "Indicates if gather is reasonably fast.">;
331
Evan Chengff1beda2006-10-06 09:17:41 +0000332//===----------------------------------------------------------------------===//
Craig Topper57c28152017-12-10 17:42:36 +0000333// Register File Description
334//===----------------------------------------------------------------------===//
335
336include "X86RegisterInfo.td"
337include "X86RegisterBanks.td"
338
339//===----------------------------------------------------------------------===//
340// Instruction Descriptions
Evan Chengff1beda2006-10-06 09:17:41 +0000341//===----------------------------------------------------------------------===//
342
Andrew Trick8523b162012-02-01 23:20:51 +0000343include "X86Schedule.td"
Craig Topper57c28152017-12-10 17:42:36 +0000344include "X86InstrInfo.td"
345
346def X86InstrInfo : InstrInfo;
347
348//===----------------------------------------------------------------------===//
349// X86 processors supported.
350//===----------------------------------------------------------------------===//
351
352include "X86ScheduleAtom.td"
353include "X86SchedSandyBridge.td"
354include "X86SchedHaswell.td"
355include "X86SchedBroadwell.td"
356include "X86ScheduleSLM.td"
357include "X86ScheduleZnver1.td"
358include "X86ScheduleBtVer2.td"
359include "X86SchedSkylakeClient.td"
360include "X86SchedSkylakeServer.td"
Andrew Trick8523b162012-02-01 23:20:51 +0000361
362def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
363 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000364def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
365 "Intel Silvermont processors">;
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000366def ProcIntelGLM : SubtargetFeature<"glm", "X86ProcFamily", "IntelGLM",
367 "Intel Goldmont processors">;
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000368def ProcIntelHSW : SubtargetFeature<"haswell", "X86ProcFamily",
369 "IntelHaswell", "Intel Haswell processors">;
370def ProcIntelBDW : SubtargetFeature<"broadwell", "X86ProcFamily",
371 "IntelBroadwell", "Intel Broadwell processors">;
372def ProcIntelSKL : SubtargetFeature<"skylake", "X86ProcFamily",
373 "IntelSkylake", "Intel Skylake processors">;
374def ProcIntelKNL : SubtargetFeature<"knl", "X86ProcFamily",
375 "IntelKNL", "Intel Knights Landing processors">;
376def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily",
377 "IntelSKX", "Intel Skylake Server processors">;
378def ProcIntelCNL : SubtargetFeature<"cannonlake", "X86ProcFamily",
379 "IntelCannonlake", "Intel Cannonlake processors">;
Craig Topper81037f32017-11-19 01:12:00 +0000380def ProcIntelICL : SubtargetFeature<"icelake", "X86ProcFamily",
381 "IntelIcelake", "Intel Icelake processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000382
Evan Chengff1beda2006-10-06 09:17:41 +0000383class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000384 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000385
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000386def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
387def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
388def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
389def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
390def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
391def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
Craig Topper38373222017-11-01 22:15:49 +0000392
393foreach P = ["i686", "pentiumpro"] in {
394 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
395}
396
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000397def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
398 FeatureCMOV, FeatureFXSR]>;
Craig Topper38373222017-11-01 22:15:49 +0000399
400foreach P = ["pentium3", "pentium3m"] in {
401 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
402 FeatureFXSR]>;
403}
Mitch Bodarte60465d2016-04-27 22:52:35 +0000404
405// Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
406// The intent is to enable it for pentium4 which is the current default
407// processor in a vanilla 32-bit clang compilation when no specific
408// architecture is specified. This generally gives a nice performance
409// increase on silvermont, with largely neutral behavior on other
410// contemporary large core processors.
411// pentium-m, pentium4m, prescott and nocona are included as a preventative
412// measure to avoid performance surprises, in case clang's default cpu
413// changes slightly.
414
415def : ProcessorModel<"pentium-m", GenericPostRAModel,
416 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
Craig Topper27381172017-10-15 16:57:33 +0000417 FeatureSSE2, FeatureFXSR]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000418
Craig Topper38373222017-11-01 22:15:49 +0000419foreach P = ["pentium4", "pentium4m"] in {
420 def : ProcessorModel<P, GenericPostRAModel,
421 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
422 FeatureSSE2, FeatureFXSR]>;
423}
Chandler Carruth32908d72014-05-07 17:37:03 +0000424
Andrey Turetskiy958eb462016-04-01 10:16:15 +0000425// Intel Quark.
426def : Proc<"lakemont", []>;
427
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000428// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000429def : ProcessorModel<"yonah", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000430 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
Craig Topper27381172017-10-15 16:57:33 +0000431 FeatureFXSR]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000432
433// NetBurst.
Mitch Bodarte60465d2016-04-27 22:52:35 +0000434def : ProcessorModel<"prescott", GenericPostRAModel,
435 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
Craig Topper27381172017-10-15 16:57:33 +0000436 FeatureFXSR]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000437def : ProcessorModel<"nocona", GenericPostRAModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000438 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000439 FeatureSlowUAMem16,
440 FeatureMMX,
441 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000442 FeatureFXSR,
Craig Topper27381172017-10-15 16:57:33 +0000443 FeatureCMPXCHG16B
Eric Christopher11e59832015-10-08 20:10:06 +0000444]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000445
446// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000447def : ProcessorModel<"core2", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000448 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000449 FeatureSlowUAMem16,
450 FeatureMMX,
451 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000452 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000453 FeatureCMPXCHG16B,
Craig Topper641e2af2017-08-30 04:34:48 +0000454 FeatureLAHFSAHF,
455 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000456]>;
457def : ProcessorModel<"penryn", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000458 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000459 FeatureSlowUAMem16,
460 FeatureMMX,
461 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000462 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000463 FeatureCMPXCHG16B,
Craig Topper641e2af2017-08-30 04:34:48 +0000464 FeatureLAHFSAHF,
465 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000466]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000467
Chandler Carruthaf8924032014-12-09 10:58:36 +0000468// Atom CPUs.
469class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000470 ProcIntelAtom,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000471 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000472 FeatureSlowUAMem16,
473 FeatureMMX,
474 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000475 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000476 FeatureCMPXCHG16B,
477 FeatureMOVBE,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000478 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000479 FeatureSlowDivide32,
480 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000481 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000482 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000483 FeaturePadShortFunctions,
484 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000485]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000486def : BonnellProc<"bonnell">;
487def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000488
Chandler Carruthaf8924032014-12-09 10:58:36 +0000489class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000490 ProcIntelSLM,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000491 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000492 FeatureMMX,
493 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000494 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000495 FeatureCMPXCHG16B,
496 FeatureMOVBE,
497 FeaturePOPCNT,
498 FeaturePCLMUL,
499 FeatureAES,
500 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000501 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000502 FeaturePRFCHW,
503 FeatureSlowLEA,
504 FeatureSlowIncDec,
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000505 FeatureSlowPMULLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000506 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000507]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000508def : SilvermontProc<"silvermont">;
509def : SilvermontProc<"slm">; // Legacy alias.
510
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000511class GoldmontProc<string Name> : ProcessorModel<Name, SLMModel, [
512 ProcIntelGLM,
513 FeatureX87,
514 FeatureMMX,
515 FeatureSSE42,
516 FeatureFXSR,
517 FeatureCMPXCHG16B,
518 FeatureMOVBE,
519 FeaturePOPCNT,
520 FeaturePCLMUL,
521 FeatureAES,
522 FeaturePRFCHW,
Craig Topper62c47a22017-08-29 05:14:27 +0000523 FeatureSlowTwoMemOps,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000524 FeatureSlowLEA,
525 FeatureSlowIncDec,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000526 FeatureLAHFSAHF,
527 FeatureMPX,
528 FeatureSHA,
Craig Toppera4c5caf2017-07-04 05:33:19 +0000529 FeatureRDRAND,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000530 FeatureRDSEED,
531 FeatureXSAVE,
532 FeatureXSAVEOPT,
533 FeatureXSAVEC,
534 FeatureXSAVES,
Michael Zuckermanac1d20d2017-09-25 13:45:31 +0000535 FeatureCLFLUSHOPT,
536 FeatureFSGSBase
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000537]>;
538def : GoldmontProc<"goldmont">;
539
Eric Christopher2ef63182010-04-02 21:54:27 +0000540// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000541class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000542 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000543 FeatureMMX,
544 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000545 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000546 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000547 FeaturePOPCNT,
Craig Topper641e2af2017-08-30 04:34:48 +0000548 FeatureLAHFSAHF,
549 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000550]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000551def : NehalemProc<"nehalem">;
552def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000553
Eric Christopher2ef63182010-04-02 21:54:27 +0000554// Westmere is a similar machine to nehalem with some additional features.
555// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000556class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000557 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000558 FeatureMMX,
559 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000560 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000561 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000562 FeaturePOPCNT,
563 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000564 FeaturePCLMUL,
Craig Topper641e2af2017-08-30 04:34:48 +0000565 FeatureLAHFSAHF,
566 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000567]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000568def : WestmereProc<"westmere">;
569
Craig Topperf730a6b2016-02-13 21:35:37 +0000570class ProcessorFeatures<list<SubtargetFeature> Inherited,
571 list<SubtargetFeature> NewFeatures> {
572 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
573}
574
575class ProcModel<string Name, SchedMachineModel Model,
576 list<SubtargetFeature> ProcFeatures,
577 list<SubtargetFeature> OtherFeatures> :
578 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
579
Nate Begeman8b08f522010-12-10 00:26:57 +0000580// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
581// rather than a superset.
Craig Topperf730a6b2016-02-13 21:35:37 +0000582def SNBFeatures : ProcessorFeatures<[], [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000583 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000584 FeatureMMX,
585 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000586 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000587 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000588 FeaturePOPCNT,
589 FeatureAES,
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000590 FeatureSlowDivide64,
Craig Topper0ee35692015-10-14 05:37:38 +0000591 FeaturePCLMUL,
592 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000593 FeatureXSAVEOPT,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000594 FeatureLAHFSAHF,
Lama Saba2ea271b2017-05-18 08:11:50 +0000595 FeatureSlow3OpsLEA,
Craig Topperd88389a2017-02-21 06:39:13 +0000596 FeatureFastScalarFSQRT,
Craig Topper641e2af2017-08-30 04:34:48 +0000597 FeatureFastSHLDRotate,
Craig Topperef1f7162017-08-30 05:00:35 +0000598 FeatureSlowIncDec,
Craig Topper641e2af2017-08-30 04:34:48 +0000599 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000600]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000601
Craig Topperf730a6b2016-02-13 21:35:37 +0000602class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
603 SNBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000604 FeatureSlowUAMem32
605]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000606def : SandyBridgeProc<"sandybridge">;
607def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000608
Craig Topperf730a6b2016-02-13 21:35:37 +0000609def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000610 FeatureRDRAND,
611 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000612 FeatureFSGSBase
613]>;
614
Craig Topperf730a6b2016-02-13 21:35:37 +0000615class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
616 IVBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000617 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000618]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000619def : IvyBridgeProc<"ivybridge">;
620def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000621
Craig Topperf730a6b2016-02-13 21:35:37 +0000622def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000623 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000624 FeatureBMI,
625 FeatureBMI2,
Clement Courbet203fc172017-04-21 09:20:50 +0000626 FeatureERMSB,
Eric Christopher11e59832015-10-08 20:10:06 +0000627 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000628 FeatureLZCNT,
Simon Pilgrimfd5df632017-12-19 13:16:43 +0000629 FeatureMOVBE,
630 FeatureFastVariableShuffle
Eric Christopher11e59832015-10-08 20:10:06 +0000631]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000632
Craig Topperf730a6b2016-02-13 21:35:37 +0000633class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000634 HSWFeatures.Value, [
Craig Topper27381172017-10-15 16:57:33 +0000635 ProcIntelHSW
Craig Topper54541c42017-10-13 16:04:08 +0000636]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000637def : HaswellProc<"haswell">;
638def : HaswellProc<"core-avx2">; // Legacy alias.
639
Craig Topperf730a6b2016-02-13 21:35:37 +0000640def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000641 FeatureADX,
Craig Topper67885f52017-12-22 02:41:12 +0000642 FeatureRDSEED,
643 FeaturePRFCHW
Eric Christopher11e59832015-10-08 20:10:06 +0000644]>;
Gadi Haber323f2e12017-10-24 20:19:47 +0000645class BroadwellProc<string Name> : ProcModel<Name, BroadwellModel,
Craig Topper54541c42017-10-13 16:04:08 +0000646 BDWFeatures.Value, [
Craig Topper27381172017-10-15 16:57:33 +0000647 ProcIntelBDW
Craig Topper54541c42017-10-13 16:04:08 +0000648]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000649def : BroadwellProc<"broadwell">;
650
Craig Topperf730a6b2016-02-13 21:35:37 +0000651def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000652 FeatureMPX,
Eric Christopher58297412017-03-29 07:40:44 +0000653 FeatureRTM,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000654 FeatureXSAVEC,
655 FeatureXSAVES,
656 FeatureSGX,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000657 FeatureCLFLUSHOPT,
658 FeatureFastVectorFSQRT
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000659]>;
660
Gadi Haber6f8fbf42017-09-19 06:19:27 +0000661class SkylakeClientProc<string Name> : ProcModel<Name, SkylakeClientModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000662 SKLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000663 ProcIntelSKL,
664 FeatureHasFastGather
Craig Topper5805fb32017-10-13 16:06:06 +0000665]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000666def : SkylakeClientProc<"skylake">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000667
Craig Topper5d692912017-10-13 18:10:17 +0000668def KNLFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000669 FeatureAVX512,
670 FeatureERI,
671 FeatureCDI,
672 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000673 FeaturePREFETCHWT1,
674 FeatureADX,
675 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000676 FeatureMOVBE,
677 FeatureLZCNT,
678 FeatureBMI,
679 FeatureBMI2,
Craig Topper67885f52017-12-22 02:41:12 +0000680 FeatureFMA,
681 FeaturePRFCHW
Craig Topper5d692912017-10-13 18:10:17 +0000682]>;
683
684// FIXME: define KNL model
685class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
686 KNLFeatures.Value, [
687 ProcIntelKNL,
Craig Topper62c47a22017-08-29 05:14:27 +0000688 FeatureSlowTwoMemOps,
Craig Topperea37e202017-11-25 18:09:37 +0000689 FeatureFastPartialYMMorZMMWrite,
690 FeatureHasFastGather
Eric Christopher11e59832015-10-08 20:10:06 +0000691]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000692def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000693
Craig Topper5d692912017-10-13 18:10:17 +0000694class KnightsMillProc<string Name> : ProcModel<Name, HaswellModel,
695 KNLFeatures.Value, [
696 ProcIntelKNL,
697 FeatureSlowTwoMemOps,
Craig Topper6fae2ee2017-10-25 17:10:32 +0000698 FeatureFastPartialYMMorZMMWrite,
Craig Topperea37e202017-11-25 18:09:37 +0000699 FeatureHasFastGather,
Craig Topper6fae2ee2017-10-25 17:10:32 +0000700 FeatureVPOPCNTDQ
Craig Topper5d692912017-10-13 18:10:17 +0000701]>;
702def : KnightsMillProc<"knm">; // TODO Add AVX5124FMAPS/AVX5124VNNIW features
703
Craig Topperf730a6b2016-02-13 21:35:37 +0000704def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000705 FeatureAVX512,
706 FeatureCDI,
707 FeatureDQI,
708 FeatureBWI,
709 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000710 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000711 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000712]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000713
Gadi Haber684944b2017-10-08 12:52:54 +0000714class SkylakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000715 SKXFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000716 ProcIntelSKX,
717 FeatureHasFastGather
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000718]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000719def : SkylakeServerProc<"skylake-avx512">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000720def : SkylakeServerProc<"skx">; // Legacy alias.
721
Craig Topperf730a6b2016-02-13 21:35:37 +0000722def CNLFeatures : ProcessorFeatures<SKXFeatures.Value, [
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000723 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000724 FeatureIFMA,
725 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000726]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000727
Craig Topper9a94dfc2017-11-19 01:25:30 +0000728class CannonlakeProc<string Name> : ProcModel<Name, SkylakeServerModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000729 CNLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000730 ProcIntelCNL,
731 FeatureHasFastGather
Craig Topper5805fb32017-10-13 16:06:06 +0000732]>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000733def : CannonlakeProc<"cannonlake">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000734
Craig Topper81037f32017-11-19 01:12:00 +0000735def ICLFeatures : ProcessorFeatures<CNLFeatures.Value, [
Craig Toppera8905702017-11-21 21:05:18 +0000736 FeatureBITALG,
737 FeatureVAES,
738 FeatureVBMI2,
739 FeatureVNNI,
740 FeatureVPCLMULQDQ,
Coby Tayreed8b17be2017-11-26 09:36:41 +0000741 FeatureVPOPCNTDQ,
742 FeatureGFNI
Craig Topper81037f32017-11-19 01:12:00 +0000743]>;
744
745class IcelakeProc<string Name> : ProcModel<Name, SkylakeServerModel,
746 ICLFeatures.Value, [
Craig Topperea37e202017-11-25 18:09:37 +0000747 ProcIntelICL,
748 FeatureHasFastGather
Craig Topper81037f32017-11-19 01:12:00 +0000749]>;
750def : IcelakeProc<"icelake">;
751
Chandler Carruthaf8924032014-12-09 10:58:36 +0000752// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000753
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000754def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
755def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
756def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
Craig Topper38373222017-11-01 22:15:49 +0000757
758foreach P = ["athlon", "athlon-tbird"] in {
759 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, Feature3DNowA, FeatureSlowSHLD]>;
760}
761
762foreach P = ["athlon-4", "athlon-xp", "athlon-mp"] in {
763 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
764 Feature3DNowA, FeatureFXSR, FeatureSlowSHLD]>;
765}
766
767foreach P = ["k8", "opteron", "athlon64", "athlon-fx"] in {
768 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
769 FeatureFXSR, Feature64Bit, FeatureSlowSHLD]>;
770}
771
772foreach P = ["k8-sse3", "opteron-sse3", "athlon64-sse3"] in {
773 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
774 FeatureFXSR, FeatureCMPXCHG16B, FeatureSlowSHLD]>;
775}
776
777foreach P = ["amdfam10", "barcelona"] in {
778 def : Proc<P, [FeatureX87, FeatureSSE4A, Feature3DNowA, FeatureFXSR,
779 FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
780 FeatureSlowSHLD, FeatureLAHFSAHF]>;
781}
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000782
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000783// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000784def : Proc<"btver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000785 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000786 FeatureMMX,
787 FeatureSSSE3,
788 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000789 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000790 FeatureCMPXCHG16B,
791 FeaturePRFCHW,
792 FeatureLZCNT,
793 FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000794 FeatureSlowSHLD,
795 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000796]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000797
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000798// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000799def : ProcessorModel<"btver2", BtVer2Model, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000800 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000801 FeatureMMX,
802 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000803 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000804 FeatureSSE4A,
805 FeatureCMPXCHG16B,
806 FeaturePRFCHW,
807 FeatureAES,
808 FeaturePCLMUL,
809 FeatureBMI,
810 FeatureF16C,
811 FeatureMOVBE,
812 FeatureLZCNT,
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000813 FeatureFastLZCNT,
Eric Christopher11e59832015-10-08 20:10:06 +0000814 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000815 FeatureXSAVE,
816 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000817 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000818 FeatureLAHFSAHF,
Amjad Aboud4f977512017-03-03 09:03:24 +0000819 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000820]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000821
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000822// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000823def : Proc<"bdver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000824 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000825 FeatureXOP,
826 FeatureFMA4,
827 FeatureCMPXCHG16B,
828 FeatureAES,
829 FeaturePRFCHW,
830 FeaturePCLMUL,
831 FeatureMMX,
832 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000833 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000834 FeatureSSE4A,
835 FeatureLZCNT,
836 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000837 FeatureXSAVE,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000838 FeatureLWP,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000839 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +0000840 FeatureLAHFSAHF,
841 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000842]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000843// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000844def : Proc<"bdver2", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000845 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000846 FeatureXOP,
847 FeatureFMA4,
848 FeatureCMPXCHG16B,
849 FeatureAES,
850 FeaturePRFCHW,
851 FeaturePCLMUL,
852 FeatureMMX,
853 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000854 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000855 FeatureSSE4A,
856 FeatureF16C,
857 FeatureLZCNT,
858 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000859 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000860 FeatureBMI,
861 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000862 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000863 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000864 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +0000865 FeatureLAHFSAHF,
866 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000867]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000868
869// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000870def : Proc<"bdver3", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000871 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000872 FeatureXOP,
873 FeatureFMA4,
874 FeatureCMPXCHG16B,
875 FeatureAES,
876 FeaturePRFCHW,
877 FeaturePCLMUL,
878 FeatureMMX,
879 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000880 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000881 FeatureSSE4A,
882 FeatureF16C,
883 FeatureLZCNT,
884 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000885 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000886 FeatureBMI,
887 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000888 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000889 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000890 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000891 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000892 FeatureFSGSBase,
Craig Topper641e2af2017-08-30 04:34:48 +0000893 FeatureLAHFSAHF,
894 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000895]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000896
Benjamin Kramer60045732014-05-02 15:47:07 +0000897// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000898def : Proc<"bdver4", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000899 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000900 FeatureMMX,
901 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000902 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000903 FeatureXOP,
904 FeatureFMA4,
905 FeatureCMPXCHG16B,
906 FeatureAES,
907 FeaturePRFCHW,
908 FeaturePCLMUL,
909 FeatureF16C,
910 FeatureLZCNT,
911 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000912 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000913 FeatureBMI,
914 FeatureBMI2,
915 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000916 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000917 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000918 FeatureXSAVEOPT,
Simon Pilgrim381a0ad2016-07-24 16:00:53 +0000919 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000920 FeatureFSGSBase,
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000921 FeatureLAHFSAHF,
Craig Topper641e2af2017-08-30 04:34:48 +0000922 FeatureMWAITX,
923 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000924]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000925
Craig Topper106b5b62017-07-19 02:45:14 +0000926// Znver1
927def: ProcessorModel<"znver1", Znver1Model, [
Craig Topperd55b8312017-01-10 06:01:16 +0000928 FeatureADX,
929 FeatureAES,
930 FeatureAVX2,
931 FeatureBMI,
932 FeatureBMI2,
933 FeatureCLFLUSHOPT,
Craig Topper50f3d142017-02-09 04:27:34 +0000934 FeatureCLZERO,
Craig Topperd55b8312017-01-10 06:01:16 +0000935 FeatureCMPXCHG16B,
936 FeatureF16C,
937 FeatureFMA,
938 FeatureFSGSBase,
939 FeatureFXSR,
940 FeatureFastLZCNT,
941 FeatureLAHFSAHF,
942 FeatureLZCNT,
Craig Topper641e2af2017-08-30 04:34:48 +0000943 FeatureMacroFusion,
Craig Topperd55b8312017-01-10 06:01:16 +0000944 FeatureMMX,
945 FeatureMOVBE,
946 FeatureMWAITX,
947 FeaturePCLMUL,
948 FeaturePOPCNT,
949 FeaturePRFCHW,
950 FeatureRDRAND,
951 FeatureRDSEED,
952 FeatureSHA,
Craig Topperd55b8312017-01-10 06:01:16 +0000953 FeatureSSE4A,
954 FeatureSlowSHLD,
955 FeatureX87,
956 FeatureXSAVE,
957 FeatureXSAVEC,
958 FeatureXSAVEOPT,
959 FeatureXSAVES]>;
960
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000961def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000962
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000963def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
964def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
965def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
966def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
967 FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000968
Chandler Carruth32908d72014-05-07 17:37:03 +0000969// We also provide a generic 64-bit specific x86 processor model which tries to
970// be good for modern chips without enabling instruction set encodings past the
971// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
972// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000973//
Chandler Carruth32908d72014-05-07 17:37:03 +0000974// We currently use the Sandy Bridge model as the default scheduling model as
975// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
976// covers a huge swath of x86 processors. If there are specific scheduling
977// knobs which need to be tuned differently for AMD chips, we might consider
978// forming a common base for them.
Chandler Carruth98c51cb2017-08-21 08:45:22 +0000979def : ProcessorModel<"x86-64", SandyBridgeModel, [
980 FeatureX87,
981 FeatureMMX,
982 FeatureSSE2,
983 FeatureFXSR,
984 Feature64Bit,
985 FeatureSlow3OpsLEA,
Craig Topper641e2af2017-08-30 04:34:48 +0000986 FeatureSlowIncDec,
987 FeatureMacroFusion
Chandler Carruth98c51cb2017-08-21 08:45:22 +0000988]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000989
Evan Chengff1beda2006-10-06 09:17:41 +0000990//===----------------------------------------------------------------------===//
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000991// Calling Conventions
992//===----------------------------------------------------------------------===//
993
994include "X86CallingConv.td"
995
996
997//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000998// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000999//===----------------------------------------------------------------------===//
1000
Devang Patel85d684a2012-01-09 19:13:28 +00001001def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +00001002 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +00001003
Chad Rosier9f7a2212013-04-18 22:35:36 +00001004 // Variant name.
1005 string Name = "att";
1006
Daniel Dunbare4318712009-08-11 20:59:47 +00001007 // Discard comments in assembly strings.
1008 string CommentDelimiter = "#";
1009
1010 // Recognize hard coded registers.
1011 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +00001012}
1013
Devang Patel67bf992a2012-01-10 17:51:54 +00001014def IntelAsmParserVariant : AsmParserVariant {
1015 int Variant = 1;
1016
Chad Rosier9f7a2212013-04-18 22:35:36 +00001017 // Variant name.
1018 string Name = "intel";
1019
Devang Patel67bf992a2012-01-10 17:51:54 +00001020 // Discard comments in assembly strings.
1021 string CommentDelimiter = ";";
1022
1023 // Recognize hard coded registers.
1024 string RegisterPrefix = "";
1025}
1026
Jim Grosbach4cf25f52010-10-30 13:48:28 +00001027//===----------------------------------------------------------------------===//
1028// Assembly Printers
1029//===----------------------------------------------------------------------===//
1030
Chris Lattner56832602004-10-03 20:36:57 +00001031// The X86 target supports two different syntaxes for emitting machine code.
1032// This is controlled by the -x86-asm-syntax={att|intel}
1033def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +00001034 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +00001035 int Variant = 0;
1036}
1037def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +00001038 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +00001039 int Variant = 1;
1040}
1041
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001042def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001043 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +00001044 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +00001045 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +00001046 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001047}