1 //===-- X86.td - Target definition file for the Intel X86 --*- tablegen -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This is a target description file for the Intel i386 architecture, referred
11 // to here as the "X86" architecture.
13 //===----------------------------------------------------------------------===//
15 // Get the target-independent interfaces which we are implementing...
17 include "llvm/Target/Target.td"
19 //===----------------------------------------------------------------------===//
20 // X86 Subtarget state
23 def Mode64Bit : SubtargetFeature<"64bit-mode", "In64BitMode", "true",
24 "64-bit mode (x86_64)">;
25 def Mode32Bit : SubtargetFeature<"32bit-mode", "In32BitMode", "true",
26 "32-bit mode (80386)">;
27 def Mode16Bit : SubtargetFeature<"16bit-mode", "In16BitMode", "true",
28 "16-bit mode (i8086)">;
30 //===----------------------------------------------------------------------===//
31 // X86 Subtarget features
32 //===----------------------------------------------------------------------===//
34 def FeatureX87 : SubtargetFeature<"x87","HasX87", "true",
35 "Enable X87 float instructions">;
37 def FeatureNOPL : SubtargetFeature<"nopl", "HasNOPL", "true",
38 "Enable NOPL instruction">;
40 def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true",
41 "Enable conditional move instructions">;
43 def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true",
44 "Support POPCNT instruction">;
46 def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true",
47 "Support fxsave/fxrestore instructions">;
49 def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true",
50 "Support xsave instructions">;
52 def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true",
53 "Support xsaveopt instructions">;
55 def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true",
56 "Support xsavec instructions">;
58 def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true",
59 "Support xsaves instructions">;
61 def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1",
62 "Enable SSE instructions",
63 // SSE codegen depends on cmovs, and all
64 // SSE1+ processors support them.
66 def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2",
67 "Enable SSE2 instructions",
69 def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3",
70 "Enable SSE3 instructions",
72 def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3",
73 "Enable SSSE3 instructions",
75 def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41",
76 "Enable SSE 4.1 instructions",
78 def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42",
79 "Enable SSE 4.2 instructions",
81 // The MMX subtarget feature is separate from the rest of the SSE features
82 // because it's important (for odd compatibility reasons) to be able to
83 // turn it off explicitly while allowing SSE+ to be on.
84 def FeatureMMX : SubtargetFeature<"mmx","X863DNowLevel", "MMX",
85 "Enable MMX instructions">;
86 def Feature3DNow : SubtargetFeature<"3dnow", "X863DNowLevel", "ThreeDNow",
87 "Enable 3DNow! instructions",
89 def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA",
90 "Enable 3DNow! Athlon instructions",
92 // All x86-64 hardware has SSE2, but we don't mark SSE2 as an implied
93 // feature, because SSE2 can be disabled (e.g. for compiling OS kernels)
94 // without disabling 64-bit mode.
95 def Feature64Bit : SubtargetFeature<"64bit", "HasX86_64", "true",
96 "Support 64-bit instructions",
98 def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true",
99 "64-bit with cmpxchg16b",
101 def FeatureSlowSHLD : SubtargetFeature<"slow-shld", "IsSHLDSlow", "true",
102 "SHLD instruction is slow">;
103 def FeatureSlowPMULLD : SubtargetFeature<"slow-pmulld", "IsPMULLDSlow", "true",
104 "PMULLD instruction is slow">;
105 // FIXME: This should not apply to CPUs that do not have SSE.
106 def FeatureSlowUAMem16 : SubtargetFeature<"slow-unaligned-mem-16",
107 "IsUAMem16Slow", "true",
108 "Slow unaligned 16-byte memory access">;
109 def FeatureSlowUAMem32 : SubtargetFeature<"slow-unaligned-mem-32",
110 "IsUAMem32Slow", "true",
111 "Slow unaligned 32-byte memory access">;
112 def FeatureSSE4A : SubtargetFeature<"sse4a", "HasSSE4A", "true",
113 "Support SSE 4a instructions",
116 def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX",
117 "Enable AVX instructions",
119 def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2",
120 "Enable AVX2 instructions",
122 def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true",
123 "Enable three-operand fused multiple-add",
125 def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true",
126 "Support 16-bit floating point conversion instructions",
128 def FeatureAVX512 : SubtargetFeature<"avx512f", "X86SSELevel", "AVX512F",
129 "Enable AVX-512 instructions",
130 [FeatureAVX2, FeatureFMA, FeatureF16C]>;
131 def FeatureERI : SubtargetFeature<"avx512er", "HasERI", "true",
132 "Enable AVX-512 Exponential and Reciprocal Instructions",
134 def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true",
135 "Enable AVX-512 Conflict Detection Instructions",
137 def FeatureVPOPCNTDQ : SubtargetFeature<"avx512vpopcntdq", "HasVPOPCNTDQ",
138 "true", "Enable AVX-512 Population Count Instructions",
140 def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true",
141 "Enable AVX-512 PreFetch Instructions",
143 def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPREFETCHWT1",
145 "Prefetch with Intent to Write and T1 Hint">;
146 def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true",
147 "Enable AVX-512 Doubleword and Quadword Instructions",
149 def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true",
150 "Enable AVX-512 Byte and Word Instructions",
152 def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true",
153 "Enable AVX-512 Vector Length eXtensions",
155 def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true",
156 "Enable AVX-512 Vector Byte Manipulation Instructions",
158 def FeatureVBMI2 : SubtargetFeature<"avx512vbmi2", "HasVBMI2", "true",
159 "Enable AVX-512 further Vector Byte Manipulation Instructions",
161 def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true",
162 "Enable AVX-512 Integer Fused Multiple-Add",
164 def FeaturePKU : SubtargetFeature<"pku", "HasPKU", "true",
165 "Enable protection keys">;
166 def FeatureVNNI : SubtargetFeature<"avx512vnni", "HasVNNI", "true",
167 "Enable AVX-512 Vector Neural Network Instructions",
169 def FeatureBITALG : SubtargetFeature<"avx512bitalg", "HasBITALG", "true",
170 "Enable AVX-512 Bit Algorithms",
172 def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true",
173 "Enable packed carry-less multiplication instructions",
175 def FeatureGFNI : SubtargetFeature<"gfni", "HasGFNI", "true",
176 "Enable Galois Field Arithmetic Instructions",
178 def FeatureVPCLMULQDQ : SubtargetFeature<"vpclmulqdq", "HasVPCLMULQDQ", "true",
179 "Enable vpclmulqdq instructions",
180 [FeatureAVX, FeaturePCLMUL]>;
181 def FeatureFMA4 : SubtargetFeature<"fma4", "HasFMA4", "true",
182 "Enable four-operand fused multiple-add",
183 [FeatureAVX, FeatureSSE4A]>;
184 def FeatureXOP : SubtargetFeature<"xop", "HasXOP", "true",
185 "Enable XOP instructions",
187 def FeatureSSEUnalignedMem : SubtargetFeature<"sse-unaligned-mem",
188 "HasSSEUnalignedMem", "true",
189 "Allow unaligned memory operands with SSE instructions">;
190 def FeatureAES : SubtargetFeature<"aes", "HasAES", "true",
191 "Enable AES instructions",
193 def FeatureVAES : SubtargetFeature<"vaes", "HasVAES", "true",
194 "Promote selected AES instructions to AVX512/AVX registers",
195 [FeatureAVX, FeatureAES]>;
196 def FeatureTBM : SubtargetFeature<"tbm", "HasTBM", "true",
197 "Enable TBM instructions">;
198 def FeatureLWP : SubtargetFeature<"lwp", "HasLWP", "true",
199 "Enable LWP instructions">;
200 def FeatureMOVBE : SubtargetFeature<"movbe", "HasMOVBE", "true",
201 "Support MOVBE instruction">;
202 def FeatureRDRAND : SubtargetFeature<"rdrnd", "HasRDRAND", "true",
203 "Support RDRAND instruction">;
204 def FeatureFSGSBase : SubtargetFeature<"fsgsbase", "HasFSGSBase", "true",
205 "Support FS/GS Base instructions">;
206 def FeatureLZCNT : SubtargetFeature<"lzcnt", "HasLZCNT", "true",
207 "Support LZCNT instruction">;
208 def FeatureBMI : SubtargetFeature<"bmi", "HasBMI", "true",
209 "Support BMI instructions">;
210 def FeatureBMI2 : SubtargetFeature<"bmi2", "HasBMI2", "true",
211 "Support BMI2 instructions">;
212 def FeatureRTM : SubtargetFeature<"rtm", "HasRTM", "true",
213 "Support RTM instructions">;
214 def FeatureADX : SubtargetFeature<"adx", "HasADX", "true",
215 "Support ADX instructions">;
216 def FeatureSHA : SubtargetFeature<"sha", "HasSHA", "true",
217 "Enable SHA instructions",
219 def FeatureSHSTK : SubtargetFeature<"shstk", "HasSHSTK", "true",
220 "Support CET Shadow-Stack instructions">;
221 def FeaturePRFCHW : SubtargetFeature<"prfchw", "HasPRFCHW", "true",
222 "Support PRFCHW instructions">;
223 def FeatureRDSEED : SubtargetFeature<"rdseed", "HasRDSEED", "true",
224 "Support RDSEED instruction">;
225 def FeatureLAHFSAHF : SubtargetFeature<"sahf", "HasLAHFSAHF", "true",
226 "Support LAHF and SAHF instructions">;
227 def FeatureMWAITX : SubtargetFeature<"mwaitx", "HasMWAITX", "true",
228 "Enable MONITORX/MWAITX timer functionality">;
229 def FeatureCLZERO : SubtargetFeature<"clzero", "HasCLZERO", "true",
230 "Enable Cache Line Zero">;
231 def FeatureCLDEMOTE : SubtargetFeature<"cldemote", "HasCLDEMOTE", "true",
232 "Enable Cache Demote">;
233 def FeaturePTWRITE : SubtargetFeature<"ptwrite", "HasPTWRITE", "true",
234 "Support ptwrite instruction">;
235 def FeatureMPX : SubtargetFeature<"mpx", "HasMPX", "true",
236 "Support MPX instructions">;
237 def FeatureLEAForSP : SubtargetFeature<"lea-sp", "UseLeaForSP", "true",
238 "Use LEA for adjusting the stack pointer">;
239 def FeatureSlowDivide32 : SubtargetFeature<"idivl-to-divb",
240 "HasSlowDivide32", "true",
241 "Use 8-bit divide for positive values less than 256">;
242 def FeatureSlowDivide64 : SubtargetFeature<"idivq-to-divl",
243 "HasSlowDivide64", "true",
244 "Use 32-bit divide for positive values less than 2^32">;
245 def FeaturePadShortFunctions : SubtargetFeature<"pad-short-functions",
246 "PadShortFunctions", "true",
247 "Pad short functions">;
248 def FeatureINVPCID : SubtargetFeature<"invpcid", "HasINVPCID", "true",
249 "Invalidate Process-Context Identifier">;
250 def FeatureSGX : SubtargetFeature<"sgx", "HasSGX", "true",
251 "Enable Software Guard Extensions">;
252 def FeatureCLFLUSHOPT : SubtargetFeature<"clflushopt", "HasCLFLUSHOPT", "true",
253 "Flush A Cache Line Optimized">;
254 def FeatureCLWB : SubtargetFeature<"clwb", "HasCLWB", "true",
255 "Cache Line Write Back">;
256 def FeatureWBNOINVD : SubtargetFeature<"wbnoinvd", "HasWBNOINVD", "true",
257 "Write Back No Invalidate">;
258 def FeatureRDPID : SubtargetFeature<"rdpid", "HasRDPID", "true",
259 "Support RDPID instructions">;
260 def FeatureWAITPKG : SubtargetFeature<"waitpkg", "HasWAITPKG", "true",
261 "Wait and pause enhancements">;
262 // On some processors, instructions that implicitly take two memory operands are
263 // slow. In practice, this means that CALL, PUSH, and POP with memory operands
264 // should be avoided in favor of a MOV + register CALL/PUSH/POP.
265 def FeatureSlowTwoMemOps : SubtargetFeature<"slow-two-mem-ops",
266 "SlowTwoMemOps", "true",
267 "Two memory operand instructions are slow">;
268 def FeatureLEAUsesAG : SubtargetFeature<"lea-uses-ag", "LEAUsesAG", "true",
269 "LEA instruction needs inputs at AG stage">;
270 def FeatureSlowLEA : SubtargetFeature<"slow-lea", "SlowLEA", "true",
271 "LEA instruction with certain arguments is slow">;
272 def FeatureSlow3OpsLEA : SubtargetFeature<"slow-3ops-lea", "Slow3OpsLEA", "true",
273 "LEA instruction with 3 ops or certain registers is slow">;
274 def FeatureSlowIncDec : SubtargetFeature<"slow-incdec", "SlowIncDec", "true",
275 "INC and DEC instructions are slower than ADD and SUB">;
277 : SubtargetFeature<"soft-float", "UseSoftFloat", "true",
278 "Use software floating point features.">;
279 def FeaturePOPCNTFalseDeps : SubtargetFeature<"false-deps-popcnt",
280 "HasPOPCNTFalseDeps", "true",
281 "POPCNT has a false dependency on dest register">;
282 def FeatureLZCNTFalseDeps : SubtargetFeature<"false-deps-lzcnt-tzcnt",
283 "HasLZCNTFalseDeps", "true",
284 "LZCNT/TZCNT have a false dependency on dest register">;
285 def FeaturePCONFIG : SubtargetFeature<"pconfig", "HasPCONFIG", "true",
286 "platform configuration instruction">;
287 // On recent X86 (port bound) processors, its preferable to combine to a single shuffle
288 // using a variable mask over multiple fixed shuffles.
289 def FeatureFastVariableShuffle
290 : SubtargetFeature<"fast-variable-shuffle",
291 "HasFastVariableShuffle",
292 "true", "Shuffles with variable masks are fast">;
293 // On some X86 processors, there is no performance hazard to writing only the
294 // lower parts of a YMM or ZMM register without clearing the upper part.
295 def FeatureFastPartialYMMorZMMWrite
296 : SubtargetFeature<"fast-partial-ymm-or-zmm-write",
297 "HasFastPartialYMMorZMMWrite",
298 "true", "Partial writes to YMM/ZMM registers are fast">;
299 // FeatureFastScalarFSQRT should be enabled if scalar FSQRT has shorter latency
300 // than the corresponding NR code. FeatureFastVectorFSQRT should be enabled if
301 // vector FSQRT has higher throughput than the corresponding NR code.
302 // The idea is that throughput bound code is likely to be vectorized, so for
303 // vectorized code we should care about the throughput of SQRT operations.
304 // But if the code is scalar that probably means that the code has some kind of
305 // dependency and we should care more about reducing the latency.
306 def FeatureFastScalarFSQRT
307 : SubtargetFeature<"fast-scalar-fsqrt", "HasFastScalarFSQRT",
308 "true", "Scalar SQRT is fast (disable Newton-Raphson)">;
309 def FeatureFastVectorFSQRT
310 : SubtargetFeature<"fast-vector-fsqrt", "HasFastVectorFSQRT",
311 "true", "Vector SQRT is fast (disable Newton-Raphson)">;
312 // If lzcnt has equivalent latency/throughput to most simple integer ops, it can
313 // be used to replace test/set sequences.
316 "fast-lzcnt", "HasFastLZCNT", "true",
317 "LZCNT instructions are as fast as most simple integer ops">;
318 // If the target can efficiently decode NOPs upto 11-bytes in length.
319 def FeatureFast11ByteNOP
321 "fast-11bytenop", "HasFast11ByteNOP", "true",
322 "Target can quickly decode up to 11 byte NOPs">;
323 // If the target can efficiently decode NOPs upto 15-bytes in length.
324 def FeatureFast15ByteNOP
326 "fast-15bytenop", "HasFast15ByteNOP", "true",
327 "Target can quickly decode up to 15 byte NOPs">;
328 // Sandy Bridge and newer processors can use SHLD with the same source on both
329 // inputs to implement rotate to avoid the partial flag update of the normal
330 // rotate instructions.
331 def FeatureFastSHLDRotate
333 "fast-shld-rotate", "HasFastSHLDRotate", "true",
334 "SHLD can be used as a faster rotate">;
336 // Ivy Bridge and newer processors have enhanced REP MOVSB and STOSB (aka
337 // "string operations"). See "REP String Enhancement" in the Intel Software
338 // Development Manual. This feature essentially means that REP MOVSB will copy
339 // using the largest available size instead of copying bytes one by one, making
340 // it at least as fast as REPMOVS{W,D,Q}.
343 "ermsb", "HasERMSB", "true",
344 "REP MOVS/STOS are fast">;
346 // Sandy Bridge and newer processors have many instructions that can be
347 // fused with conditional branches and pass through the CPU as a single
349 def FeatureMacroFusion
350 : SubtargetFeature<"macrofusion", "HasMacroFusion", "true",
351 "Various instructions can be fused with conditional branches">;
353 // Gather is available since Haswell (AVX2 set). So technically, we can
354 // generate Gathers on all AVX2 processors. But the overhead on HSW is high.
355 // Skylake Client processor has faster Gathers than HSW and performance is
356 // similar to Skylake Server (AVX-512).
357 def FeatureHasFastGather
358 : SubtargetFeature<"fast-gather", "HasFastGather", "true",
359 "Indicates if gather is reasonably fast.">;
361 def FeaturePrefer256Bit
362 : SubtargetFeature<"prefer-256-bit", "Prefer256Bit", "true",
363 "Prefer 256-bit AVX instructions">;
365 // Enable mitigation of some aspects of speculative execution related
366 // vulnerabilities by removing speculatable indirect branches. This disables
367 // jump-table formation, rewrites explicit `indirectbr` instructions into
368 // `switch` instructions, and uses a special construct called a "retpoline" to
369 // prevent speculation of the remaining indirect branches (indirect calls and
372 : SubtargetFeature<"retpoline", "UseRetpoline", "true",
373 "Remove speculation of indirect branches from the "
374 "generated code, either by avoiding them entirely or "
375 "lowering them with a speculation blocking construct.">;
377 // Rely on external thunks for the emitted retpoline calls. This allows users
378 // to provide their own custom thunk definitions in highly specialized
379 // environments such as a kernel that does boot-time hot patching.
380 def FeatureRetpolineExternalThunk
382 "retpoline-external-thunk", "UseRetpolineExternalThunk", "true",
383 "Enable retpoline, but with an externally provided thunk.",
386 // Direct Move instructions.
387 def FeatureMOVDIRI : SubtargetFeature<"movdiri", "HasMOVDIRI", "true",
388 "Support movdiri instruction">;
389 def FeatureMOVDIR64B : SubtargetFeature<"movdir64b", "HasMOVDIR64B", "true",
390 "Support movdir64b instruction">;
392 //===----------------------------------------------------------------------===//
393 // Register File Description
394 //===----------------------------------------------------------------------===//
396 include "X86RegisterInfo.td"
397 include "X86RegisterBanks.td"
399 //===----------------------------------------------------------------------===//
400 // Instruction Descriptions
401 //===----------------------------------------------------------------------===//
403 include "X86Schedule.td"
404 include "X86InstrInfo.td"
405 include "X86SchedPredicates.td"
407 def X86InstrInfo : InstrInfo;
409 //===----------------------------------------------------------------------===//
410 // X86 processors supported.
411 //===----------------------------------------------------------------------===//
413 include "X86ScheduleAtom.td"
414 include "X86SchedSandyBridge.td"
415 include "X86SchedHaswell.td"
416 include "X86SchedBroadwell.td"
417 include "X86ScheduleSLM.td"
418 include "X86ScheduleZnver1.td"
419 include "X86ScheduleBtVer2.td"
420 include "X86SchedSkylakeClient.td"
421 include "X86SchedSkylakeServer.td"
423 def ProcIntelAtom : SubtargetFeature<"atom", "X86ProcFamily", "IntelAtom",
424 "Intel Atom processors">;
425 def ProcIntelSLM : SubtargetFeature<"slm", "X86ProcFamily", "IntelSLM",
426 "Intel Silvermont processors">;
427 def ProcIntelGLM : SubtargetFeature<"glm", "X86ProcFamily", "IntelGLM",
428 "Intel Goldmont processors">;
429 def ProcIntelGLP : SubtargetFeature<"glp", "X86ProcFamily", "IntelGLP",
430 "Intel Goldmont Plus processors">;
431 def ProcIntelTRM : SubtargetFeature<"tremont", "X86ProcFamily", "IntelTRM",
432 "Intel Tremont processors">;
433 def ProcIntelHSW : SubtargetFeature<"haswell", "X86ProcFamily",
434 "IntelHaswell", "Intel Haswell processors">;
435 def ProcIntelBDW : SubtargetFeature<"broadwell", "X86ProcFamily",
436 "IntelBroadwell", "Intel Broadwell processors">;
437 def ProcIntelSKL : SubtargetFeature<"skylake", "X86ProcFamily",
438 "IntelSkylake", "Intel Skylake processors">;
439 def ProcIntelKNL : SubtargetFeature<"knl", "X86ProcFamily",
440 "IntelKNL", "Intel Knights Landing processors">;
441 def ProcIntelSKX : SubtargetFeature<"skx", "X86ProcFamily",
442 "IntelSKX", "Intel Skylake Server processors">;
443 def ProcIntelCNL : SubtargetFeature<"cannonlake", "X86ProcFamily",
444 "IntelCannonlake", "Intel Cannonlake processors">;
445 def ProcIntelICL : SubtargetFeature<"icelake-client", "X86ProcFamily",
446 "IntelIcelakeClient", "Intel Icelake processors">;
447 def ProcIntelICX : SubtargetFeature<"icelake-server", "X86ProcFamily",
448 "IntelIcelakeServer", "Intel Icelake Server processors">;
450 class Proc<string Name, list<SubtargetFeature> Features>
451 : ProcessorModel<Name, GenericModel, Features>;
453 def : Proc<"generic", [FeatureX87, FeatureSlowUAMem16]>;
454 def : Proc<"i386", [FeatureX87, FeatureSlowUAMem16]>;
455 def : Proc<"i486", [FeatureX87, FeatureSlowUAMem16]>;
456 def : Proc<"i586", [FeatureX87, FeatureSlowUAMem16]>;
457 def : Proc<"pentium", [FeatureX87, FeatureSlowUAMem16]>;
458 def : Proc<"pentium-mmx", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
460 def : Proc<"i686", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV]>;
461 def : Proc<"pentiumpro", [FeatureX87, FeatureSlowUAMem16, FeatureCMOV,
464 def : Proc<"pentium2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
465 FeatureCMOV, FeatureFXSR, FeatureNOPL]>;
467 foreach P = ["pentium3", "pentium3m"] in {
468 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE1,
469 FeatureFXSR, FeatureNOPL]>;
472 // Enable the PostRAScheduler for SSE2 and SSE3 class cpus.
473 // The intent is to enable it for pentium4 which is the current default
474 // processor in a vanilla 32-bit clang compilation when no specific
475 // architecture is specified. This generally gives a nice performance
476 // increase on silvermont, with largely neutral behavior on other
477 // contemporary large core processors.
478 // pentium-m, pentium4m, prescott and nocona are included as a preventative
479 // measure to avoid performance surprises, in case clang's default cpu
482 def : ProcessorModel<"pentium-m", GenericPostRAModel,
483 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
484 FeatureSSE2, FeatureFXSR, FeatureNOPL]>;
486 foreach P = ["pentium4", "pentium4m"] in {
487 def : ProcessorModel<P, GenericPostRAModel,
488 [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
489 FeatureSSE2, FeatureFXSR, FeatureNOPL]>;
493 def : Proc<"lakemont", []>;
496 def : ProcessorModel<"yonah", SandyBridgeModel,
497 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
498 FeatureFXSR, FeatureNOPL]>;
501 def : ProcessorModel<"prescott", GenericPostRAModel,
502 [FeatureX87, FeatureSlowUAMem16, FeatureMMX, FeatureSSE3,
503 FeatureFXSR, FeatureNOPL]>;
504 def : ProcessorModel<"nocona", GenericPostRAModel, [
514 // Intel Core 2 Solo/Duo.
515 def : ProcessorModel<"core2", SandyBridgeModel, [
526 def : ProcessorModel<"penryn", SandyBridgeModel, [
539 class BonnellProc<string Name> : ProcessorModel<Name, AtomModel, [
552 FeatureSlowTwoMemOps,
554 FeaturePadShortFunctions,
557 def : BonnellProc<"bonnell">;
558 def : BonnellProc<"atom">; // Pin the generic name to the baseline.
560 class SilvermontProc<string Name> : ProcessorModel<Name, SLMModel, [
573 FeatureSlowTwoMemOps,
580 FeaturePOPCNTFalseDeps
582 def : SilvermontProc<"silvermont">;
583 def : SilvermontProc<"slm">; // Legacy alias.
585 class ProcessorFeatures<list<SubtargetFeature> Inherited,
586 list<SubtargetFeature> NewFeatures> {
587 list<SubtargetFeature> Value = !listconcat(Inherited, NewFeatures);
590 class ProcModel<string Name, SchedMachineModel Model,
591 list<SubtargetFeature> ProcFeatures,
592 list<SubtargetFeature> OtherFeatures> :
593 ProcessorModel<Name, Model, !listconcat(ProcFeatures, OtherFeatures)>;
595 def GLMFeatures : ProcessorFeatures<[], [
607 FeatureSlowTwoMemOps,
623 class GoldmontProc<string Name> : ProcModel<Name, SLMModel,
626 FeaturePOPCNTFalseDeps
628 def : GoldmontProc<"goldmont">;
630 def GLPFeatures : ProcessorFeatures<GLMFeatures.Value, [
636 class GoldmontPlusProc<string Name> : ProcModel<Name, SLMModel,
640 def : GoldmontPlusProc<"goldmont-plus">;
642 class TremontProc<string Name> : ProcModel<Name, SLMModel,
651 def : TremontProc<"tremont">;
653 // "Arrandale" along with corei3 and corei5
654 class NehalemProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
665 def : NehalemProc<"nehalem">;
666 def : NehalemProc<"corei7">;
668 // Westmere is a similar machine to nehalem with some additional features.
669 // Westmere is the corei3/i5/i7 path from nehalem to sandybridge
670 class WestmereProc<string Name> : ProcessorModel<Name, SandyBridgeModel, [
683 def : WestmereProc<"westmere">;
685 // SSE is not listed here since llvm treats AVX as a reimplementation of SSE,
686 // rather than a superset.
687 def SNBFeatures : ProcessorFeatures<[], [
702 FeatureFastScalarFSQRT,
703 FeatureFastSHLDRotate,
708 class SandyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
711 FeaturePOPCNTFalseDeps
713 def : SandyBridgeProc<"sandybridge">;
714 def : SandyBridgeProc<"corei7-avx">; // Legacy alias.
716 def IVBFeatures : ProcessorFeatures<SNBFeatures.Value, [
722 class IvyBridgeProc<string Name> : ProcModel<Name, SandyBridgeModel,
725 FeaturePOPCNTFalseDeps
727 def : IvyBridgeProc<"ivybridge">;
728 def : IvyBridgeProc<"core-avx-i">; // Legacy alias.
730 def HSWFeatures : ProcessorFeatures<IVBFeatures.Value, [
739 FeatureFastVariableShuffle
742 class HaswellProc<string Name> : ProcModel<Name, HaswellModel,
745 FeaturePOPCNTFalseDeps,
746 FeatureLZCNTFalseDeps
748 def : HaswellProc<"haswell">;
749 def : HaswellProc<"core-avx2">; // Legacy alias.
751 def BDWFeatures : ProcessorFeatures<HSWFeatures.Value, [
756 class BroadwellProc<string Name> : ProcModel<Name, BroadwellModel,
759 FeaturePOPCNTFalseDeps,
760 FeatureLZCNTFalseDeps
762 def : BroadwellProc<"broadwell">;
764 def SKLFeatures : ProcessorFeatures<BDWFeatures.Value, [
770 FeatureFastVectorFSQRT
773 class SkylakeClientProc<string Name> : ProcModel<Name, SkylakeClientModel,
776 FeatureHasFastGather,
777 FeaturePOPCNTFalseDeps,
780 def : SkylakeClientProc<"skylake">;
782 def KNLFeatures : ProcessorFeatures<IVBFeatures.Value, [
798 // FIXME: define KNL model
799 class KnightsLandingProc<string Name> : ProcModel<Name, HaswellModel,
802 FeatureSlowTwoMemOps,
803 FeatureFastPartialYMMorZMMWrite,
806 def : KnightsLandingProc<"knl">;
808 class KnightsMillProc<string Name> : ProcModel<Name, HaswellModel,
811 FeatureSlowTwoMemOps,
812 FeatureFastPartialYMMorZMMWrite,
813 FeatureHasFastGather,
816 def : KnightsMillProc<"knm">; // TODO Add AVX5124FMAPS/AVX5124VNNIW features
818 def SKXFeatures : ProcessorFeatures<SKLFeatures.Value, [
828 class SkylakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
831 FeatureHasFastGather,
832 FeaturePOPCNTFalseDeps
834 def : SkylakeServerProc<"skylake-avx512">;
835 def : SkylakeServerProc<"skx">; // Legacy alias.
837 def CNLFeatures : ProcessorFeatures<SKLFeatures.Value, [
850 class CannonlakeProc<string Name> : ProcModel<Name, SkylakeServerModel,
855 def : CannonlakeProc<"cannonlake">;
857 def ICLFeatures : ProcessorFeatures<CNLFeatures.Value, [
869 class IcelakeClientProc<string Name> : ProcModel<Name, SkylakeServerModel,
874 def : IcelakeClientProc<"icelake-client">;
876 class IcelakeServerProc<string Name> : ProcModel<Name, SkylakeServerModel,
883 def : IcelakeServerProc<"icelake-server">;
887 def : Proc<"k6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
888 def : Proc<"k6-2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
889 def : Proc<"k6-3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
891 foreach P = ["athlon", "athlon-tbird"] in {
892 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, Feature3DNowA,
893 FeatureNOPL, FeatureSlowSHLD]>;
896 foreach P = ["athlon-4", "athlon-xp", "athlon-mp"] in {
897 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE1,
898 Feature3DNowA, FeatureFXSR, FeatureNOPL, FeatureSlowSHLD]>;
901 foreach P = ["k8", "opteron", "athlon64", "athlon-fx"] in {
902 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE2, Feature3DNowA,
903 FeatureFXSR, FeatureNOPL, Feature64Bit, FeatureSlowSHLD]>;
906 foreach P = ["k8-sse3", "opteron-sse3", "athlon64-sse3"] in {
907 def : Proc<P, [FeatureX87, FeatureSlowUAMem16, FeatureSSE3, Feature3DNowA,
908 FeatureFXSR, FeatureNOPL, FeatureCMPXCHG16B, FeatureSlowSHLD]>;
911 foreach P = ["amdfam10", "barcelona"] in {
912 def : Proc<P, [FeatureX87, FeatureSSE4A, Feature3DNowA, FeatureFXSR,
913 FeatureNOPL, FeatureCMPXCHG16B, FeatureLZCNT, FeaturePOPCNT,
914 FeatureSlowSHLD, FeatureLAHFSAHF]>;
918 def : Proc<"btver1", [
935 def : ProcessorModel<"btver2", BtVer2Model, [
956 FeatureFast15ByteNOP,
957 FeatureFastPartialYMMorZMMWrite
961 def : Proc<"bdver1", [
980 FeatureFast11ByteNOP,
984 def : Proc<"bdver2", [
1007 FeatureFast11ByteNOP,
1012 def : Proc<"bdver3", [
1037 FeatureFast11ByteNOP,
1042 def : Proc<"bdver4", [
1067 FeatureFast11ByteNOP,
1073 def: ProcessorModel<"znver1", Znver1Model, [
1090 FeatureFast15ByteNOP,
1109 def : Proc<"geode", [FeatureX87, FeatureSlowUAMem16, Feature3DNowA]>;
1111 def : Proc<"winchip-c6", [FeatureX87, FeatureSlowUAMem16, FeatureMMX]>;
1112 def : Proc<"winchip2", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
1113 def : Proc<"c3", [FeatureX87, FeatureSlowUAMem16, Feature3DNow]>;
1114 def : Proc<"c3-2", [FeatureX87, FeatureSlowUAMem16, FeatureMMX,
1115 FeatureSSE1, FeatureFXSR]>;
1117 // We also provide a generic 64-bit specific x86 processor model which tries to
1118 // be good for modern chips without enabling instruction set encodings past the
1119 // basic SSE2 and 64-bit ones. It disables slow things from any mainstream and
1120 // modern 64-bit x86 chip, and enables features that are generally beneficial.
1122 // We currently use the Sandy Bridge model as the default scheduling model as
1123 // we use it across Nehalem, Westmere, Sandy Bridge, and Ivy Bridge which
1124 // covers a huge swath of x86 processors. If there are specific scheduling
1125 // knobs which need to be tuned differently for AMD chips, we might consider
1126 // forming a common base for them.
1127 def : ProcessorModel<"x86-64", SandyBridgeModel, [
1139 //===----------------------------------------------------------------------===//
1140 // Calling Conventions
1141 //===----------------------------------------------------------------------===//
1143 include "X86CallingConv.td"
1146 //===----------------------------------------------------------------------===//
1148 //===----------------------------------------------------------------------===//
1150 def ATTAsmParserVariant : AsmParserVariant {
1154 string Name = "att";
1156 // Discard comments in assembly strings.
1157 string CommentDelimiter = "#";
1159 // Recognize hard coded registers.
1160 string RegisterPrefix = "%";
1163 def IntelAsmParserVariant : AsmParserVariant {
1167 string Name = "intel";
1169 // Discard comments in assembly strings.
1170 string CommentDelimiter = ";";
1172 // Recognize hard coded registers.
1173 string RegisterPrefix = "";
1176 //===----------------------------------------------------------------------===//
1177 // Assembly Printers
1178 //===----------------------------------------------------------------------===//
1180 // The X86 target supports two different syntaxes for emitting machine code.
1181 // This is controlled by the -x86-asm-syntax={att|intel}
1182 def ATTAsmWriter : AsmWriter {
1183 string AsmWriterClassName = "ATTInstPrinter";
1186 def IntelAsmWriter : AsmWriter {
1187 string AsmWriterClassName = "IntelInstPrinter";
1192 // Information about the instructions...
1193 let InstructionSet = X86InstrInfo;
1194 let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant];
1195 let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter];
1196 let AllowRegisterRenaming = 1;
1199 //===----------------------------------------------------------------------===//
1201 //===----------------------------------------------------------------------===//
1203 include "X86PfmCounters.td"