blob: 2e7902a606472a62df7b59f3c0d0b5c8f79b5e2e [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]>;
Oren Ben Simhon7bf27f02017-05-25 13:45:23 +0000130def FeatureVPOPCNTDQ : SubtargetFeature<"avx512vpopcntdq", "HasVPOPCNTDQ",
131 "true", "Enable AVX-512 Population Count Instructions",
132 [FeatureAVX512]>;
Craig Topper5c94bb82013-08-21 03:57:57 +0000133def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
Elena Demikhovsky003e7d72013-07-28 08:28:38 +0000134 "Enable AVX-512 PreFetch Instructions",
135 [FeatureAVX512]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000136def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPFPREFETCHWT1",
137 "true",
138 "Prefetch with Intent to Write and T1 Hint">;
Robert Khasanovbfa01312014-07-21 14:54:21 +0000139def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
140 "Enable AVX-512 Doubleword and Quadword Instructions",
141 [FeatureAVX512]>;
142def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
143 "Enable AVX-512 Byte and Word Instructions",
144 [FeatureAVX512]>;
145def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
146 "Enable AVX-512 Vector Length eXtensions",
147 [FeatureAVX512]>;
Michael Zuckerman97b6a6922016-01-17 13:42:12 +0000148def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
Craig Topper5c842be2016-11-09 04:50:48 +0000149 "Enable AVX-512 Vector Byte Manipulation Instructions",
150 [FeatureBWI]>;
Craig Topper3bb3f732016-02-08 01:23:15 +0000151def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000152 "Enable AVX-512 Integer Fused Multiple-Add",
153 [FeatureAVX512]>;
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000154def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
155 "Enable protection keys">;
Benjamin Kramera0396e42012-05-31 14:34:17 +0000156def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
157 "Enable packed carry-less multiplication instructions",
Craig Topper29dd1482012-05-01 05:28:32 +0000158 [FeatureSSE2]>;
Craig Topper79dbb0c2012-06-03 18:58:46 +0000159def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
Craig Toppere1bd0512011-12-29 19:46:19 +0000160 "Enable three-operand fused multiple-add",
161 [FeatureAVX]>;
David Greene8f6f72c2009-06-26 22:46:54 +0000162def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
Craig Toppera5d1fc22011-12-30 07:16:00 +0000163 "Enable four-operand fused multiple-add",
Craig Topperbae0e9e2012-05-01 06:54:48 +0000164 [FeatureAVX, FeatureSSE4A]>;
Craig Toppera5d1fc22011-12-30 07:16:00 +0000165def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
Craig Topper43518cc2012-05-01 05:41:41 +0000166 "Enable XOP instructions",
Anitha Boyapatiaf3e9832012-08-16 04:04:02 +0000167 [FeatureFMA4]>;
Sanjay Patelffd039b2015-02-03 17:13:04 +0000168def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
169 "HasSSEUnalignedMem", "true",
170 "Allow unaligned memory operands with SSE instructions">;
Eric Christopher2ef63182010-04-02 21:54:27 +0000171def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
Craig Topper29dd1482012-05-01 05:28:32 +0000172 "Enable AES instructions",
173 [FeatureSSE2]>;
Yunzhong Gaodd36e932013-09-24 18:21:52 +0000174def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
175 "Enable TBM instructions">;
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000176def FeatureLWP : SubtargetFeature<"lwp", "HasLWP", "true",
177 "Enable LWP instructions">;
Craig Topper786bdb92011-10-03 17:28:23 +0000178def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
179 "Support MOVBE instruction">;
Rafael Espindola94a2c562013-08-23 20:21:34 +0000180def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
Craig Topper786bdb92011-10-03 17:28:23 +0000181 "Support RDRAND instruction">;
Craig Topperfe9179f2011-10-09 07:31:39 +0000182def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
Craig Toppera6d204e2013-09-16 04:29:58 +0000183 "Support 16-bit floating point conversion instructions",
184 [FeatureAVX]>;
Craig Topper228d9132011-10-30 19:57:21 +0000185def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
186 "Support FS/GS Base instructions">;
Craig Topper271064e2011-10-11 06:44:02 +0000187def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
188 "Support LZCNT instruction">;
Craig Topper3657fe42011-10-14 03:21:46 +0000189def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
190 "Support BMI instructions">;
Craig Topperaea148c2011-10-16 07:55:05 +0000191def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
192 "Support BMI2 instructions">;
Michael Liao73cffdd2012-11-08 07:28:54 +0000193def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
194 "Support RTM instructions">;
Kay Tiong Khoof809c642013-02-14 19:08:21 +0000195def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
196 "Support ADX instructions">;
Ben Langmuir16501752013-09-12 15:51:31 +0000197def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
198 "Enable SHA instructions",
199 [FeatureSSE2]>;
Michael Liao5173ee02013-03-26 17:47:11 +0000200def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
201 "Support PRFCHW instructions">;
Michael Liaoa486a112013-03-28 23:41:26 +0000202def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
203 "Support RDSEED instruction">;
Hans Wennborg5000ce82015-12-04 23:00:33 +0000204def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
205 "Support LAHF and SAHF instructions">;
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000206def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
207 "Enable MONITORX/MWAITX timer functionality">;
Craig Topper50f3d142017-02-09 04:27:34 +0000208def FeatureCLZERO : SubtargetFeature<"clzero", "HasCLZERO", "true",
209 "Enable Cache Line Zero">;
Elena Demikhovskyf7e641c2015-06-03 10:30:57 +0000210def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
211 "Support MPX instructions">;
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000212def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
Evan Cheng1b81fdd2012-02-07 22:50:41 +0000213 "Use LEA for adjusting the stack pointer">;
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000214def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
215 "HasSlowDivide32", "true",
216 "Use 8-bit divide for positive values less than 256">;
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000217def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divl",
Alexey Volkovfd1731d2014-11-21 11:19:34 +0000218 "HasSlowDivide64", "true",
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000219 "Use 32-bit divide for positive values less than 2^32">;
Preston Gurda01daac2013-01-08 18:27:24 +0000220def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
221 "PadShortFunctions", "true",
222 "Pad short functions">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000223def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
224 "Enable Software Guard Extensions">;
225def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
226 "Flush A Cache Line Optimized">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000227def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
228 "Cache Line Write Back">;
Craig Topper62c47a22017-08-29 05:14:27 +0000229// On some processors, instructions that implicitly take two memory operands are
230// slow. In practice, this means that CALL, PUSH, and POP with memory operands
231// should be avoided in favor of a MOV + register CALL/PUSH/POP.
232def FeatureSlowTwoMemOps : SubtargetFeature<"slow-two-mem-ops",
233 "SlowTwoMemOps", "true",
234 "Two memory operand instructions are slow">;
Preston Gurd8b7ab4b2013-04-25 20:29:37 +0000235def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
236 "LEA instruction needs inputs at AG stage">;
Alexey Volkov6226de62014-05-20 08:55:50 +0000237def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
238 "LEA instruction with certain arguments is slow">;
Lama Saba2ea271b2017-05-18 08:11:50 +0000239def FeatureSlow3OpsLEA : SubtargetFeature<"slow-3ops-lea", "Slow3OpsLEA", "true",
240 "LEA instruction with 3 ops or certain registers is slow">;
Alexey Volkov5260dba2014-06-09 11:40:41 +0000241def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
242 "INC and DEC instructions are slower than ADD and SUB">;
Eric Christopher824f42f2015-05-12 01:26:05 +0000243def FeatureSoftFloat
244 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
245 "Use software floating point features.">;
Amjad Aboud4f977512017-03-03 09:03:24 +0000246// On some X86 processors, there is no performance hazard to writing only the
247// lower parts of a YMM or ZMM register without clearing the upper part.
248def FeatureFastPartialYMMorZMMWrite
249 : SubtargetFeature<"fast-partial-ymm-or-zmm-write",
250 "HasFastPartialYMMorZMMWrite",
251 "true", "Partial writes to YMM/ZMM registers are fast">;
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000252// FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
253// than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
254// vector FSQRT has higher throughput than the corresponding NR code.
255// The idea is that throughput bound code is likely to be vectorized, so for
256// vectorized code we should care about the throughput of SQRT operations.
257// But if the code is scalar that probably means that the code has some kind of
258// dependency and we should care more about reducing the latency.
259def FeatureFastScalarFSQRT
260 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
261 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
262def FeatureFastVectorFSQRT
263 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
264 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000265// If lzcnt has equivalent latency/throughput to most simple integer ops, it can
266// be used to replace test/set sequences.
267def FeatureFastLZCNT
268 : SubtargetFeature<
269 "fast-lzcnt", "HasFastLZCNT", "true",
270 "LZCNT instructions are as fast as most simple integer ops">;
David Greene8f6f72c2009-06-26 22:46:54 +0000271
Craig Topperd88389a2017-02-21 06:39:13 +0000272
273// Sandy Bridge and newer processors can use SHLD with the same source on both
274// inputs to implement rotate to avoid the partial flag update of the normal
275// rotate instructions.
276def FeatureFastSHLDRotate
277 : SubtargetFeature<
278 "fast-shld-rotate", "HasFastSHLDRotate", "true",
279 "SHLD can be used as a faster rotate">;
280
Clement Courbet203fc172017-04-21 09:20:50 +0000281// Ivy Bridge and newer processors have enhanced REP MOVSB and STOSB (aka
282// "string operations"). See "REP String Enhancement" in the Intel Software
Clement Courbet41b43332017-04-21 09:21:05 +0000283// Development Manual. This feature essentially means that REP MOVSB will copy
Clement Courbet203fc172017-04-21 09:20:50 +0000284// using the largest available size instead of copying bytes one by one, making
285// it at least as fast as REPMOVS{W,D,Q}.
286def FeatureERMSB
Clement Courbet1ce3b822017-04-21 09:20:39 +0000287 : SubtargetFeature<
Clement Courbet203fc172017-04-21 09:20:50 +0000288 "ermsb", "HasERMSB", "true",
Clement Courbet1ce3b822017-04-21 09:20:39 +0000289 "REP MOVS/STOS are fast">;
290
Craig Topper641e2af2017-08-30 04:34:48 +0000291// Sandy Bridge and newer processors have many instructions that can be
292// fused with conditional branches and pass through the CPU as a single
293// operation.
294def FeatureMacroFusion
295 : SubtargetFeature<"macrofusion", "HasMacroFusion", "true",
296 "Various instructions can be fused with conditional branches">;
297
Evan Chengff1beda2006-10-06 09:17:41 +0000298//===----------------------------------------------------------------------===//
299// X86 processors supported.
300//===----------------------------------------------------------------------===//
301
Andrew Trick8523b162012-02-01 23:20:51 +0000302include "X86Schedule.td"
303
304def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
305 "Intel Atom processors">;
Preston Gurd3fe264d2013-09-13 19:23:28 +0000306def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
307 "Intel Silvermont processors">;
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000308def ProcIntelGLM : SubtargetFeature<"glm", "X86ProcFamily", "IntelGLM",
309 "Intel Goldmont processors">;
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000310def ProcIntelHSW : SubtargetFeature<"haswell", "X86ProcFamily",
311 "IntelHaswell", "Intel Haswell processors">;
312def ProcIntelBDW : SubtargetFeature<"broadwell", "X86ProcFamily",
313 "IntelBroadwell", "Intel Broadwell processors">;
314def ProcIntelSKL : SubtargetFeature<"skylake", "X86ProcFamily",
315 "IntelSkylake", "Intel Skylake processors">;
316def ProcIntelKNL : SubtargetFeature<"knl", "X86ProcFamily",
317 "IntelKNL", "Intel Knights Landing processors">;
318def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily",
319 "IntelSKX", "Intel Skylake Server processors">;
320def ProcIntelCNL : SubtargetFeature<"cannonlake", "X86ProcFamily",
321 "IntelCannonlake", "Intel Cannonlake processors">;
Andrew Trick8523b162012-02-01 23:20:51 +0000322
Evan Chengff1beda2006-10-06 09:17:41 +0000323class Proc<string Name, list<SubtargetFeature> Features>
Andrew Trick87255e32012-07-07 04:00:00 +0000324 : ProcessorModel<Name, GenericModel, Features>;
Andrew Trick8523b162012-02-01 23:20:51 +0000325
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000326def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
327def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
328def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
329def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
330def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
331def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
332def : Proc<"i686", [FeatureX87, FeatureSlowUAMem16]>;
333def : Proc<"pentiumpro", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
334def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
335 FeatureCMOV, FeatureFXSR]>;
336def : Proc<"pentium3", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
337 FeatureSSE1, FeatureFXSR]>;
338def : Proc<"pentium3m", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
339 FeatureSSE1, FeatureFXSR, FeatureSlowBTMem]>;
Mitch Bodarte60465d2016-04-27 22:52:35 +0000340
341// Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
342// The intent is to enable it for pentium4 which is the current default
343// processor in a vanilla 32-bit clang compilation when no specific
344// architecture is specified. This generally gives a nice performance
345// increase on silvermont, with largely neutral behavior on other
346// contemporary large core processors.
347// pentium-m, pentium4m, prescott and nocona are included as a preventative
348// measure to avoid performance surprises, in case clang's default cpu
349// changes slightly.
350
351def : ProcessorModel<"pentium-m", GenericPostRAModel,
352 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
353 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
354
355def : ProcessorModel<"pentium4", GenericPostRAModel,
356 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
357 FeatureSSE2, FeatureFXSR]>;
358
359def : ProcessorModel<"pentium4m", GenericPostRAModel,
360 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
361 FeatureSSE2, FeatureFXSR, FeatureSlowBTMem]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000362
Andrey Turetskiy958eb462016-04-01 10:16:15 +0000363// Intel Quark.
364def : Proc<"lakemont", []>;
365
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000366// Intel Core Duo.
Craig Topper09b65982015-10-16 06:03:09 +0000367def : ProcessorModel<"yonah", SandyBridgeModel,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000368 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
369 FeatureFXSR, FeatureSlowBTMem]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000370
371// NetBurst.
Mitch Bodarte60465d2016-04-27 22:52:35 +0000372def : ProcessorModel<"prescott", GenericPostRAModel,
373 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
374 FeatureFXSR, FeatureSlowBTMem]>;
375def : ProcessorModel<"nocona", GenericPostRAModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000376 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000377 FeatureSlowUAMem16,
378 FeatureMMX,
379 FeatureSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000380 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000381 FeatureCMPXCHG16B,
382 FeatureSlowBTMem
383]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000384
385// Intel Core 2 Solo/Duo.
Eric Christopher11e59832015-10-08 20:10:06 +0000386def : ProcessorModel<"core2", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000387 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000388 FeatureSlowUAMem16,
389 FeatureMMX,
390 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000391 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000392 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000393 FeatureSlowBTMem,
Craig Topper641e2af2017-08-30 04:34:48 +0000394 FeatureLAHFSAHF,
395 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000396]>;
397def : ProcessorModel<"penryn", SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000398 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000399 FeatureSlowUAMem16,
400 FeatureMMX,
401 FeatureSSE41,
Craig Topper09b65982015-10-16 06:03:09 +0000402 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000403 FeatureCMPXCHG16B,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000404 FeatureSlowBTMem,
Craig Topper641e2af2017-08-30 04:34:48 +0000405 FeatureLAHFSAHF,
406 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000407]>;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000408
Chandler Carruthaf8924032014-12-09 10:58:36 +0000409// Atom CPUs.
410class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000411 ProcIntelAtom,
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000412 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000413 FeatureSlowUAMem16,
414 FeatureMMX,
415 FeatureSSSE3,
Craig Topper09b65982015-10-16 06:03:09 +0000416 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000417 FeatureCMPXCHG16B,
418 FeatureMOVBE,
419 FeatureSlowBTMem,
Sanjay Patel53d1d8b2015-10-12 15:24:01 +0000420 FeatureLEAForSP,
Eric Christopher11e59832015-10-08 20:10:06 +0000421 FeatureSlowDivide32,
422 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000423 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000424 FeatureLEAUsesAG,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000425 FeaturePadShortFunctions,
426 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000427]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000428def : BonnellProc<"bonnell">;
429def : BonnellProc<"atom">; // Pin the generic name to the baseline.
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000430
Chandler Carruthaf8924032014-12-09 10:58:36 +0000431class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
Eric Christopher11e59832015-10-08 20:10:06 +0000432 ProcIntelSLM,
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 FeatureMOVBE,
439 FeaturePOPCNT,
440 FeaturePCLMUL,
441 FeatureAES,
442 FeatureSlowDivide64,
Craig Topper62c47a22017-08-29 05:14:27 +0000443 FeatureSlowTwoMemOps,
Eric Christopher11e59832015-10-08 20:10:06 +0000444 FeaturePRFCHW,
445 FeatureSlowLEA,
446 FeatureSlowIncDec,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000447 FeatureSlowBTMem,
Zvi Rackover8bc7e4d2016-12-06 19:35:20 +0000448 FeatureSlowPMULLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000449 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000450]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000451def : SilvermontProc<"silvermont">;
452def : SilvermontProc<"slm">; // Legacy alias.
453
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000454class GoldmontProc<string Name> : ProcessorModel<Name, SLMModel, [
455 ProcIntelGLM,
456 FeatureX87,
457 FeatureMMX,
458 FeatureSSE42,
459 FeatureFXSR,
460 FeatureCMPXCHG16B,
461 FeatureMOVBE,
462 FeaturePOPCNT,
463 FeaturePCLMUL,
464 FeatureAES,
465 FeaturePRFCHW,
Craig Topper62c47a22017-08-29 05:14:27 +0000466 FeatureSlowTwoMemOps,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000467 FeatureSlowLEA,
468 FeatureSlowIncDec,
469 FeatureSlowBTMem,
470 FeatureLAHFSAHF,
471 FeatureMPX,
472 FeatureSHA,
Craig Toppera4c5caf2017-07-04 05:33:19 +0000473 FeatureRDRAND,
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000474 FeatureRDSEED,
475 FeatureXSAVE,
476 FeatureXSAVEOPT,
477 FeatureXSAVEC,
478 FeatureXSAVES,
Michael Zuckermanac1d20d2017-09-25 13:45:31 +0000479 FeatureCLFLUSHOPT,
480 FeatureFSGSBase
Michael Zuckerman4bcb9c32017-06-29 10:00:33 +0000481]>;
482def : GoldmontProc<"goldmont">;
483
Eric Christopher2ef63182010-04-02 21:54:27 +0000484// "Arrandale" along with corei3 and corei5
Craig Topper3611d9b2015-03-30 06:31:11 +0000485class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000486 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000487 FeatureMMX,
488 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000489 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000490 FeatureCMPXCHG16B,
491 FeatureSlowBTMem,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000492 FeaturePOPCNT,
Craig Topper641e2af2017-08-30 04:34:48 +0000493 FeatureLAHFSAHF,
494 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000495]>;
Craig Topper3611d9b2015-03-30 06:31:11 +0000496def : NehalemProc<"nehalem">;
497def : NehalemProc<"corei7">;
Jakob Stoklund Olesen1ac7e662013-03-26 22:19:12 +0000498
Eric Christopher2ef63182010-04-02 21:54:27 +0000499// Westmere is a similar machine to nehalem with some additional features.
500// Westmere is the corei3/i5/i7 path from nehalem to sandybridge
Chandler Carruthaf8924032014-12-09 10:58:36 +0000501class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000502 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000503 FeatureMMX,
504 FeatureSSE42,
Craig Topper09b65982015-10-16 06:03:09 +0000505 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000506 FeatureCMPXCHG16B,
507 FeatureSlowBTMem,
508 FeaturePOPCNT,
509 FeatureAES,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000510 FeaturePCLMUL,
Craig Topper641e2af2017-08-30 04:34:48 +0000511 FeatureLAHFSAHF,
512 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000513]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000514def : WestmereProc<"westmere">;
515
Craig Topperf730a6b2016-02-13 21:35:37 +0000516class ProcessorFeatures<list<SubtargetFeature> Inherited,
517 list<SubtargetFeature> NewFeatures> {
518 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
519}
520
521class ProcModel<string Name, SchedMachineModel Model,
522 list<SubtargetFeature> ProcFeatures,
523 list<SubtargetFeature> OtherFeatures> :
524 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
525
Nate Begeman8b08f522010-12-10 00:26:57 +0000526// SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
527// rather than a superset.
Craig Topperf730a6b2016-02-13 21:35:37 +0000528def SNBFeatures : ProcessorFeatures<[], [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000529 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000530 FeatureMMX,
531 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000532 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000533 FeatureCMPXCHG16B,
Eric Christopher11e59832015-10-08 20:10:06 +0000534 FeaturePOPCNT,
535 FeatureAES,
Nikolai Bozhenov6bdf92c2017-01-12 19:34:15 +0000536 FeatureSlowDivide64,
Craig Topper0ee35692015-10-14 05:37:38 +0000537 FeaturePCLMUL,
538 FeatureXSAVE,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000539 FeatureXSAVEOPT,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000540 FeatureLAHFSAHF,
Lama Saba2ea271b2017-05-18 08:11:50 +0000541 FeatureSlow3OpsLEA,
Craig Topperd88389a2017-02-21 06:39:13 +0000542 FeatureFastScalarFSQRT,
Craig Topper641e2af2017-08-30 04:34:48 +0000543 FeatureFastSHLDRotate,
Craig Topperef1f7162017-08-30 05:00:35 +0000544 FeatureSlowIncDec,
Craig Topper641e2af2017-08-30 04:34:48 +0000545 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000546]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000547
Craig Topperf730a6b2016-02-13 21:35:37 +0000548class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
549 SNBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000550 FeatureSlowBTMem,
551 FeatureSlowUAMem32
552]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000553def : SandyBridgeProc<"sandybridge">;
554def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
Evan Chengff1beda2006-10-06 09:17:41 +0000555
Craig Topperf730a6b2016-02-13 21:35:37 +0000556def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000557 FeatureRDRAND,
558 FeatureF16C,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000559 FeatureFSGSBase
560]>;
561
Craig Topperf730a6b2016-02-13 21:35:37 +0000562class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
563 IVBFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000564 FeatureSlowBTMem,
565 FeatureSlowUAMem32
Eric Christopher11e59832015-10-08 20:10:06 +0000566]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000567def : IvyBridgeProc<"ivybridge">;
568def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
Craig Topper3657fe42011-10-14 03:21:46 +0000569
Craig Topperf730a6b2016-02-13 21:35:37 +0000570def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000571 FeatureAVX2,
Eric Christopher11e59832015-10-08 20:10:06 +0000572 FeatureBMI,
573 FeatureBMI2,
Clement Courbet203fc172017-04-21 09:20:50 +0000574 FeatureERMSB,
Eric Christopher11e59832015-10-08 20:10:06 +0000575 FeatureFMA,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000576 FeatureLZCNT,
Craig Topperef1f7162017-08-30 05:00:35 +0000577 FeatureMOVBE
Eric Christopher11e59832015-10-08 20:10:06 +0000578]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000579
Craig Topperf730a6b2016-02-13 21:35:37 +0000580class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000581 HSWFeatures.Value, [
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000582 ProcIntelHSW,
583 FeatureSlowBTMem
Craig Topper54541c42017-10-13 16:04:08 +0000584]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000585def : HaswellProc<"haswell">;
586def : HaswellProc<"core-avx2">; // Legacy alias.
587
Craig Topperf730a6b2016-02-13 21:35:37 +0000588def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000589 FeatureADX,
Craig Topper86576bd2017-02-09 06:50:59 +0000590 FeatureRDSEED
Eric Christopher11e59832015-10-08 20:10:06 +0000591]>;
Craig Topperf730a6b2016-02-13 21:35:37 +0000592class BroadwellProc<string Name> : ProcModel<Name, HaswellModel,
Craig Topper54541c42017-10-13 16:04:08 +0000593 BDWFeatures.Value, [
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000594 ProcIntelBDW,
595 FeatureSlowBTMem
Craig Topper54541c42017-10-13 16:04:08 +0000596]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000597def : BroadwellProc<"broadwell">;
598
Craig Topperf730a6b2016-02-13 21:35:37 +0000599def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000600 FeatureMPX,
Eric Christopher58297412017-03-29 07:40:44 +0000601 FeatureRTM,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000602 FeatureXSAVEC,
603 FeatureXSAVES,
604 FeatureSGX,
Nikolai Bozhenovf6795302016-08-04 12:47:28 +0000605 FeatureCLFLUSHOPT,
606 FeatureFastVectorFSQRT
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000607]>;
608
Gadi Haber6f8fbf42017-09-19 06:19:27 +0000609class SkylakeClientProc<string Name> : ProcModel<Name, SkylakeClientModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000610 SKLFeatures.Value, [
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000611 ProcIntelSKL,
612 FeatureSlowBTMem
Craig Topper5805fb32017-10-13 16:06:06 +0000613]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000614def : SkylakeClientProc<"skylake">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000615
Craig Topper5d692912017-10-13 18:10:17 +0000616def KNLFeatures : ProcessorFeatures<IVBFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000617 FeatureAVX512,
618 FeatureERI,
619 FeatureCDI,
620 FeaturePFI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000621 FeaturePREFETCHWT1,
622 FeatureADX,
623 FeatureRDSEED,
Eric Christopher11e59832015-10-08 20:10:06 +0000624 FeatureMOVBE,
625 FeatureLZCNT,
626 FeatureBMI,
627 FeatureBMI2,
Craig Topper5d692912017-10-13 18:10:17 +0000628 FeatureFMA
629]>;
630
631// FIXME: define KNL model
632class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
633 KNLFeatures.Value, [
634 ProcIntelKNL,
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000635 FeatureSlowBTMem,
Craig Topper62c47a22017-08-29 05:14:27 +0000636 FeatureSlowTwoMemOps,
Amjad Aboud4f977512017-03-03 09:03:24 +0000637 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000638]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000639def : KnightsLandingProc<"knl">;
Elena Demikhovsky8cfb43f2013-07-24 11:02:47 +0000640
Craig Topper5d692912017-10-13 18:10:17 +0000641class KnightsMillProc<string Name> : ProcModel<Name, HaswellModel,
642 KNLFeatures.Value, [
643 ProcIntelKNL,
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000644 FeatureSlowBTMem,
Craig Topper5d692912017-10-13 18:10:17 +0000645 FeatureSlowTwoMemOps,
646 FeatureFastPartialYMMorZMMWrite
647]>;
648def : KnightsMillProc<"knm">; // TODO Add AVX5124FMAPS/AVX5124VNNIW features
649
Craig Topperf730a6b2016-02-13 21:35:37 +0000650def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
Eric Christopher11e59832015-10-08 20:10:06 +0000651 FeatureAVX512,
652 FeatureCDI,
653 FeatureDQI,
654 FeatureBWI,
655 FeatureVLX,
Asaf Badouh5acf66f2015-12-15 13:35:29 +0000656 FeaturePKU,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000657 FeatureCLWB
Eric Christopher11e59832015-10-08 20:10:06 +0000658]>;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000659
Gadi Haber684944b2017-10-08 12:52:54 +0000660class SkylakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000661 SKXFeatures.Value, [
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000662 ProcIntelSKX,
663 FeatureSlowBTMem
664]>;
Sanjoy Dasaa63dc02016-02-21 17:12:03 +0000665def : SkylakeServerProc<"skylake-avx512">;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000666def : SkylakeServerProc<"skx">; // Legacy alias.
667
Craig Topperf730a6b2016-02-13 21:35:37 +0000668def CNLFeatures : ProcessorFeatures<SKXFeatures.Value, [
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000669 FeatureVBMI,
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000670 FeatureIFMA,
671 FeatureSHA
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000672]>;
Elena Demikhovsky29cde352016-01-24 10:41:28 +0000673
Craig Topperf730a6b2016-02-13 21:35:37 +0000674class CannonlakeProc<string Name> : ProcModel<Name, HaswellModel,
Mohammed Agabariae9aebf22017-09-13 09:00:27 +0000675 CNLFeatures.Value, [
Craig Toppera1f9c9dd2017-10-15 16:41:15 +0000676 ProcIntelCNL,
677 FeatureSlowBTMem
Craig Topper5805fb32017-10-13 16:06:06 +0000678]>;
Elena Demikhovsky9242ea82016-01-18 13:00:31 +0000679def : CannonlakeProc<"cannonlake">;
Chandler Carruthaf8924032014-12-09 10:58:36 +0000680
681// AMD CPUs.
Robert Khasanovbfa01312014-07-21 14:54:21 +0000682
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000683def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
684def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
685def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
686def : Proc<"athlon", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000687 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000688def : Proc<"athlon-tbird", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000689 FeatureSlowBTMem, FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000690def : Proc<"athlon-4", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
691 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000692 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000693def : Proc<"athlon-xp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
694 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000695 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000696def : Proc<"athlon-mp", [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
697 Feature3DNowA, FeatureFXSR, FeatureSlowBTMem,
Ekaterina Romanovad5fa5542013-11-21 23:21:26 +0000698 FeatureSlowSHLD]>;
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000699def : Proc<"k8", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
700 Feature3DNowA, FeatureFXSR, Feature64Bit,
701 FeatureSlowBTMem, FeatureSlowSHLD]>;
702def : Proc<"opteron", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
703 Feature3DNowA, FeatureFXSR, Feature64Bit,
704 FeatureSlowBTMem, FeatureSlowSHLD]>;
705def : Proc<"athlon64", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
706 Feature3DNowA, FeatureFXSR, Feature64Bit,
707 FeatureSlowBTMem, FeatureSlowSHLD]>;
708def : Proc<"athlon-fx", [FeatureX87, FeatureSlowUAMem16, FeatureSSE2,
709 Feature3DNowA, FeatureFXSR, Feature64Bit,
710 FeatureSlowBTMem, FeatureSlowSHLD]>;
711def : Proc<"k8-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
712 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
713 FeatureSlowBTMem, FeatureSlowSHLD]>;
714def : Proc<"opteron-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
715 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
716 FeatureSlowBTMem, FeatureSlowSHLD]>;
717def : Proc<"athlon64-sse3", [FeatureX87, FeatureSlowUAMem16, FeatureSSE3,
718 Feature3DNowA, FeatureFXSR, FeatureCMPXCHG16B,
719 FeatureSlowBTMem, FeatureSlowSHLD]>;
720def : Proc<"amdfam10", [FeatureX87, FeatureSSE4A, Feature3DNowA,
721 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
722 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
723 FeatureLAHFSAHF]>;
724def : Proc<"barcelona", [FeatureX87, FeatureSSE4A, Feature3DNowA,
725 FeatureFXSR, FeatureCMPXCHG16B, FeatureLZCNT,
726 FeaturePOPCNT, FeatureSlowBTMem, FeatureSlowSHLD,
727 FeatureLAHFSAHF]>;
Sanjay Patel9e916dc2015-08-21 20:17:26 +0000728
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000729// Bobcat
Eric Christopher11e59832015-10-08 20:10:06 +0000730def : Proc<"btver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000731 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000732 FeatureMMX,
733 FeatureSSSE3,
734 FeatureSSE4A,
Craig Topper09b65982015-10-16 06:03:09 +0000735 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000736 FeatureCMPXCHG16B,
737 FeaturePRFCHW,
738 FeatureLZCNT,
739 FeaturePOPCNT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000740 FeatureSlowSHLD,
741 FeatureLAHFSAHF
Eric Christopher11e59832015-10-08 20:10:06 +0000742]>;
Sanjay Patel1191adf2014-09-09 20:07:07 +0000743
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000744// Jaguar
Eric Christopher11e59832015-10-08 20:10:06 +0000745def : ProcessorModel<"btver2", BtVer2Model, [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000746 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000747 FeatureMMX,
748 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000749 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000750 FeatureSSE4A,
751 FeatureCMPXCHG16B,
752 FeaturePRFCHW,
753 FeatureAES,
754 FeaturePCLMUL,
755 FeatureBMI,
756 FeatureF16C,
757 FeatureMOVBE,
758 FeatureLZCNT,
Pierre Gousseaub6d652a2016-10-14 16:41:38 +0000759 FeatureFastLZCNT,
Eric Christopher11e59832015-10-08 20:10:06 +0000760 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000761 FeatureXSAVE,
762 FeatureXSAVEOPT,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000763 FeatureSlowSHLD,
Yunzhong Gao0de36ec2016-02-12 23:37:57 +0000764 FeatureLAHFSAHF,
Amjad Aboud4f977512017-03-03 09:03:24 +0000765 FeatureFastPartialYMMorZMMWrite
Eric Christopher11e59832015-10-08 20:10:06 +0000766]>;
Sanjay Patele57f3c02014-11-28 18:40:18 +0000767
Benjamin Kramer077ae1d2012-01-10 11:50:02 +0000768// Bulldozer
Eric Christopher11e59832015-10-08 20:10:06 +0000769def : Proc<"bdver1", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000770 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000771 FeatureXOP,
772 FeatureFMA4,
773 FeatureCMPXCHG16B,
774 FeatureAES,
775 FeaturePRFCHW,
776 FeaturePCLMUL,
777 FeatureMMX,
778 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000779 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000780 FeatureSSE4A,
781 FeatureLZCNT,
782 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000783 FeatureXSAVE,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000784 FeatureLWP,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000785 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +0000786 FeatureLAHFSAHF,
787 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000788]>;
Benjamin Kramerb44c4272013-05-03 10:20:08 +0000789// Piledriver
Eric Christopher11e59832015-10-08 20:10:06 +0000790def : Proc<"bdver2", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000791 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000792 FeatureXOP,
793 FeatureFMA4,
794 FeatureCMPXCHG16B,
795 FeatureAES,
796 FeaturePRFCHW,
797 FeaturePCLMUL,
798 FeatureMMX,
799 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000800 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000801 FeatureSSE4A,
802 FeatureF16C,
803 FeatureLZCNT,
804 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000805 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000806 FeatureBMI,
807 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000808 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000809 FeatureFMA,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000810 FeatureSlowSHLD,
Craig Topper641e2af2017-08-30 04:34:48 +0000811 FeatureLAHFSAHF,
812 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000813]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000814
815// Steamroller
Eric Christopher11e59832015-10-08 20:10:06 +0000816def : Proc<"bdver3", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000817 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000818 FeatureXOP,
819 FeatureFMA4,
820 FeatureCMPXCHG16B,
821 FeatureAES,
822 FeaturePRFCHW,
823 FeaturePCLMUL,
824 FeatureMMX,
825 FeatureAVX,
Craig Topper09b65982015-10-16 06:03:09 +0000826 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000827 FeatureSSE4A,
828 FeatureF16C,
829 FeatureLZCNT,
830 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000831 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000832 FeatureBMI,
833 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000834 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000835 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000836 FeatureXSAVEOPT,
Eric Christopher11e59832015-10-08 20:10:06 +0000837 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000838 FeatureFSGSBase,
Craig Topper641e2af2017-08-30 04:34:48 +0000839 FeatureLAHFSAHF,
840 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000841]>;
Benjamin Kramerd114def2013-11-04 10:29:20 +0000842
Benjamin Kramer60045732014-05-02 15:47:07 +0000843// Excavator
Eric Christopher11e59832015-10-08 20:10:06 +0000844def : Proc<"bdver4", [
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000845 FeatureX87,
Eric Christopher11e59832015-10-08 20:10:06 +0000846 FeatureMMX,
847 FeatureAVX2,
Craig Topper09b65982015-10-16 06:03:09 +0000848 FeatureFXSR,
Eric Christopher11e59832015-10-08 20:10:06 +0000849 FeatureXOP,
850 FeatureFMA4,
851 FeatureCMPXCHG16B,
852 FeatureAES,
853 FeaturePRFCHW,
854 FeaturePCLMUL,
855 FeatureF16C,
856 FeatureLZCNT,
857 FeaturePOPCNT,
Craig Topper0ee35692015-10-14 05:37:38 +0000858 FeatureXSAVE,
Eric Christopher11e59832015-10-08 20:10:06 +0000859 FeatureBMI,
860 FeatureBMI2,
861 FeatureTBM,
Simon Pilgrim99b925b2017-05-03 15:51:39 +0000862 FeatureLWP,
Eric Christopher11e59832015-10-08 20:10:06 +0000863 FeatureFMA,
Craig Topper0ee35692015-10-14 05:37:38 +0000864 FeatureXSAVEOPT,
Simon Pilgrim381a0ad2016-07-24 16:00:53 +0000865 FeatureSlowSHLD,
Hans Wennborg5000ce82015-12-04 23:00:33 +0000866 FeatureFSGSBase,
Ashutosh Nema348af9c2016-05-18 11:59:12 +0000867 FeatureLAHFSAHF,
Craig Topper641e2af2017-08-30 04:34:48 +0000868 FeatureMWAITX,
869 FeatureMacroFusion
Eric Christopher11e59832015-10-08 20:10:06 +0000870]>;
Benjamin Kramer60045732014-05-02 15:47:07 +0000871
Craig Topper106b5b62017-07-19 02:45:14 +0000872// Znver1
873def: ProcessorModel<"znver1", Znver1Model, [
Craig Topperd55b8312017-01-10 06:01:16 +0000874 FeatureADX,
875 FeatureAES,
876 FeatureAVX2,
877 FeatureBMI,
878 FeatureBMI2,
879 FeatureCLFLUSHOPT,
Craig Topper50f3d142017-02-09 04:27:34 +0000880 FeatureCLZERO,
Craig Topperd55b8312017-01-10 06:01:16 +0000881 FeatureCMPXCHG16B,
882 FeatureF16C,
883 FeatureFMA,
884 FeatureFSGSBase,
885 FeatureFXSR,
886 FeatureFastLZCNT,
887 FeatureLAHFSAHF,
888 FeatureLZCNT,
Craig Topper641e2af2017-08-30 04:34:48 +0000889 FeatureMacroFusion,
Craig Topperd55b8312017-01-10 06:01:16 +0000890 FeatureMMX,
891 FeatureMOVBE,
892 FeatureMWAITX,
893 FeaturePCLMUL,
894 FeaturePOPCNT,
895 FeaturePRFCHW,
896 FeatureRDRAND,
897 FeatureRDSEED,
898 FeatureSHA,
Craig Topperd55b8312017-01-10 06:01:16 +0000899 FeatureSSE4A,
900 FeatureSlowSHLD,
901 FeatureX87,
902 FeatureXSAVE,
903 FeatureXSAVEC,
904 FeatureXSAVEOPT,
905 FeatureXSAVES]>;
906
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000907def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000908
Andrey Turetskiy6a3d5612016-03-23 11:13:54 +0000909def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
910def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
911def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
912def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
913 FeatureSSE1, FeatureFXSR]>;
Evan Chengff1beda2006-10-06 09:17:41 +0000914
Chandler Carruth32908d72014-05-07 17:37:03 +0000915// We also provide a generic 64-bit specific x86 processor model which tries to
916// be good for modern chips without enabling instruction set encodings past the
917// basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
918// modern 64-bit x86 chip, and enables features that are generally beneficial.
Michael Liao5bf95782014-12-04 05:20:33 +0000919//
Chandler Carruth32908d72014-05-07 17:37:03 +0000920// We currently use the Sandy Bridge model as the default scheduling model as
921// we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
922// covers a huge swath of x86 processors. If there are specific scheduling
923// knobs which need to be tuned differently for AMD chips, we might consider
924// forming a common base for them.
Chandler Carruth98c51cb2017-08-21 08:45:22 +0000925def : ProcessorModel<"x86-64", SandyBridgeModel, [
926 FeatureX87,
927 FeatureMMX,
928 FeatureSSE2,
929 FeatureFXSR,
930 Feature64Bit,
931 FeatureSlow3OpsLEA,
932 FeatureSlowBTMem,
Craig Topper641e2af2017-08-30 04:34:48 +0000933 FeatureSlowIncDec,
934 FeatureMacroFusion
Chandler Carruth98c51cb2017-08-21 08:45:22 +0000935]>;
Chandler Carruth32908d72014-05-07 17:37:03 +0000936
Evan Chengff1beda2006-10-06 09:17:41 +0000937//===----------------------------------------------------------------------===//
Chris Lattner5da8e802003-08-03 15:47:49 +0000938// Register File Description
939//===----------------------------------------------------------------------===//
940
941include "X86RegisterInfo.td"
Igor Bregerb4442f32017-02-10 07:05:56 +0000942include "X86RegisterBanks.td"
Chris Lattner5da8e802003-08-03 15:47:49 +0000943
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000944//===----------------------------------------------------------------------===//
945// Instruction Descriptions
946//===----------------------------------------------------------------------===//
947
Chris Lattner59a4a912003-08-03 21:54:21 +0000948include "X86InstrInfo.td"
949
Jakob Stoklund Olesenb93331f2010-04-05 03:10:20 +0000950def X86InstrInfo : InstrInfo;
Chris Lattnera8c3cff2003-08-03 18:19:37 +0000951
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000952//===----------------------------------------------------------------------===//
953// Calling Conventions
954//===----------------------------------------------------------------------===//
955
956include "X86CallingConv.td"
957
958
959//===----------------------------------------------------------------------===//
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000960// Assembly Parser
Chris Lattner5d00a0b2007-02-26 18:17:14 +0000961//===----------------------------------------------------------------------===//
962
Devang Patel85d684a2012-01-09 19:13:28 +0000963def ATTAsmParserVariant : AsmParserVariant {
Daniel Dunbar00331992009-07-29 00:02:19 +0000964 int Variant = 0;
Daniel Dunbare4318712009-08-11 20:59:47 +0000965
Chad Rosier9f7a2212013-04-18 22:35:36 +0000966 // Variant name.
967 string Name = "att";
968
Daniel Dunbare4318712009-08-11 20:59:47 +0000969 // Discard comments in assembly strings.
970 string CommentDelimiter = "#";
971
972 // Recognize hard coded registers.
973 string RegisterPrefix = "%";
Daniel Dunbar00331992009-07-29 00:02:19 +0000974}
975
Devang Patel67bf992a2012-01-10 17:51:54 +0000976def IntelAsmParserVariant : AsmParserVariant {
977 int Variant = 1;
978
Chad Rosier9f7a2212013-04-18 22:35:36 +0000979 // Variant name.
980 string Name = "intel";
981
Devang Patel67bf992a2012-01-10 17:51:54 +0000982 // Discard comments in assembly strings.
983 string CommentDelimiter = ";";
984
985 // Recognize hard coded registers.
986 string RegisterPrefix = "";
987}
988
Jim Grosbach4cf25f52010-10-30 13:48:28 +0000989//===----------------------------------------------------------------------===//
990// Assembly Printers
991//===----------------------------------------------------------------------===//
992
Chris Lattner56832602004-10-03 20:36:57 +0000993// The X86 target supports two different syntaxes for emitting machine code.
994// This is controlled by the -x86-asm-syntax={att|intel}
995def ATTAsmWriter : AsmWriter {
Chris Lattner1cbd3de2009-09-13 19:30:11 +0000996 string AsmWriterClassName = "ATTInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +0000997 int Variant = 0;
998}
999def IntelAsmWriter : AsmWriter {
Chris Lattner13306a12009-09-20 07:47:59 +00001000 string AsmWriterClassName = "IntelInstPrinter";
Chris Lattner56832602004-10-03 20:36:57 +00001001 int Variant = 1;
1002}
1003
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001004def X86 : Target {
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001005 // Information about the instructions...
Chris Lattner25510802003-08-04 04:59:56 +00001006 let InstructionSet = X86InstrInfo;
Devang Patel67bf992a2012-01-10 17:51:54 +00001007 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
Chris Lattner56832602004-10-03 20:36:57 +00001008 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
Chris Lattnera8c3cff2003-08-03 18:19:37 +00001009}