| 1 |
//===-- X86.td - Target definition file for the Intel X86 --*- tablegen -*-===// |
| 2 |
// |
| 3 |
// The LLVM Compiler Infrastructure |
| 4 |
// |
| 5 |
// This file is distributed under the University of Illinois Open Source |
| 6 |
// License. See LICENSE.TXT for details. |
| 7 |
// |
| 8 |
//===----------------------------------------------------------------------===// |
| 9 |
// |
| 10 |
// This is a target description file for the Intel i386 architecture, referred |
| 11 |
// to here as the "X86" architecture. |
| 12 |
// |
| 13 |
//===----------------------------------------------------------------------===// |
| 14 |
|
| 15 |
// Get the target-independent interfaces which we are implementing... |
| 16 |
// |
| 17 |
include "llvm/Target/Target.td" |
| 18 |
|
| 19 |
//===----------------------------------------------------------------------===// |
| 20 |
// X86 Subtarget state |
| 21 |
// |
| 22 |
|
| 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)">; |
| 29 |
|
| 30 |
//===----------------------------------------------------------------------===// |
| 31 |
// X86 Subtarget features |
| 32 |
//===----------------------------------------------------------------------===// |
| 33 |
|
| 34 |
def FeatureX87 : SubtargetFeature<"x87","HasX87", "true", |
| 35 |
"Enable X87 float instructions">; |
| 36 |
|
| 37 |
def FeatureNOPL : SubtargetFeature<"nopl", "HasNOPL", "true", |
| 38 |
"Enable NOPL instruction">; |
| 39 |
|
| 40 |
def FeatureCMOV : SubtargetFeature<"cmov","HasCMov", "true", |
| 41 |
"Enable conditional move instructions">; |
| 42 |
|
| 43 |
def FeaturePOPCNT : SubtargetFeature<"popcnt", "HasPOPCNT", "true", |
| 44 |
"Support POPCNT instruction">; |
| 45 |
|
| 46 |
def FeatureFXSR : SubtargetFeature<"fxsr", "HasFXSR", "true", |
| 47 |
"Support fxsave/fxrestore instructions">; |
| 48 |
|
| 49 |
def FeatureXSAVE : SubtargetFeature<"xsave", "HasXSAVE", "true", |
| 50 |
"Support xsave instructions">; |
| 51 |
|
| 52 |
def FeatureXSAVEOPT: SubtargetFeature<"xsaveopt", "HasXSAVEOPT", "true", |
| 53 |
"Support xsaveopt instructions">; |
| 54 |
|
| 55 |
def FeatureXSAVEC : SubtargetFeature<"xsavec", "HasXSAVEC", "true", |
| 56 |
"Support xsavec instructions">; |
| 57 |
|
| 58 |
def FeatureXSAVES : SubtargetFeature<"xsaves", "HasXSAVES", "true", |
| 59 |
"Support xsaves instructions">; |
| 60 |
|
| 61 |
def FeatureSSE1 : SubtargetFeature<"sse", "X86SSELevel", "SSE1", |
| 62 |
"Enable SSE instructions", |
| 63 |
// SSE codegen depends on cmovs, and all |
| 64 |
// SSE1+ processors support them. |
| 65 |
[FeatureCMOV]>; |
| 66 |
def FeatureSSE2 : SubtargetFeature<"sse2", "X86SSELevel", "SSE2", |
| 67 |
"Enable SSE2 instructions", |
| 68 |
[FeatureSSE1]>; |
| 69 |
def FeatureSSE3 : SubtargetFeature<"sse3", "X86SSELevel", "SSE3", |
| 70 |
"Enable SSE3 instructions", |
| 71 |
[FeatureSSE2]>; |
| 72 |
def FeatureSSSE3 : SubtargetFeature<"ssse3", "X86SSELevel", "SSSE3", |
| 73 |
"Enable SSSE3 instructions", |
| 74 |
[FeatureSSE3]>; |
| 75 |
def FeatureSSE41 : SubtargetFeature<"sse4.1", "X86SSELevel", "SSE41", |
| 76 |
"Enable SSE 4.1 instructions", |
| 77 |
[FeatureSSSE3]>; |
| 78 |
def FeatureSSE42 : SubtargetFeature<"sse4.2", "X86SSELevel", "SSE42", |
| 79 |
"Enable SSE 4.2 instructions", |
| 80 |
[FeatureSSE41]>; |
| 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", |
| 88 |
[FeatureMMX]>; |
| 89 |
def Feature3DNowA : SubtargetFeature<"3dnowa", "X863DNowLevel", "ThreeDNowA", |
| 90 |
"Enable 3DNow! Athlon instructions", |
| 91 |
[Feature3DNow]>; |
| 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", |
| 97 |
[FeatureCMOV]>; |
| 98 |
def FeatureCMPXCHG16B : SubtargetFeature<"cx16", "HasCmpxchg16b", "true", |
| 99 |
"64-bit with cmpxchg16b", |
| 100 |
[Feature64Bit]>; |
| 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", |
| 114 |
[FeatureSSE3]>; |
| 115 |
|
| 116 |
def FeatureAVX : SubtargetFeature<"avx", "X86SSELevel", "AVX", |
| 117 |
"Enable AVX instructions", |
| 118 |
[FeatureSSE42]>; |
| 119 |
def FeatureAVX2 : SubtargetFeature<"avx2", "X86SSELevel", "AVX2", |
| 120 |
"Enable AVX2 instructions", |
| 121 |
[FeatureAVX]>; |
| 122 |
def FeatureFMA : SubtargetFeature<"fma", "HasFMA", "true", |
| 123 |
"Enable three-operand fused multiple-add", |
| 124 |
[FeatureAVX]>; |
| 125 |
def FeatureF16C : SubtargetFeature<"f16c", "HasF16C", "true", |
| 126 |
"Support 16-bit floating point conversion instructions", |
| 127 |
[FeatureAVX]>; |
| 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", |
| 133 |
[FeatureAVX512]>; |
| 134 |
def FeatureCDI : SubtargetFeature<"avx512cd", "HasCDI", "true", |
| 135 |
"Enable AVX-512 Conflict Detection Instructions", |
| 136 |
[FeatureAVX512]>; |
| 137 |
def FeatureVPOPCNTDQ : SubtargetFeature<"avx512vpopcntdq", "HasVPOPCNTDQ", |
| 138 |
"true", "Enable AVX-512 Population Count Instructions", |
| 139 |
[FeatureAVX512]>; |
| 140 |
def FeaturePFI : SubtargetFeature<"avx512pf", "HasPFI", "true", |
| 141 |
"Enable AVX-512 PreFetch Instructions", |
| 142 |
[FeatureAVX512]>; |
| 143 |
def FeaturePREFETCHWT1 : SubtargetFeature<"prefetchwt1", "HasPREFETCHWT1", |
| 144 |
"true", |
| 145 |
"Prefetch with Intent to Write and T1 Hint">; |
| 146 |
def FeatureDQI : SubtargetFeature<"avx512dq", "HasDQI", "true", |
| 147 |
"Enable AVX-512 Doubleword and Quadword Instructions", |
| 148 |
[FeatureAVX512]>; |
| 149 |
def FeatureBWI : SubtargetFeature<"avx512bw", "HasBWI", "true", |
| 150 |
"Enable AVX-512 Byte and Word Instructions", |
| 151 |
[FeatureAVX512]>; |
| 152 |
def FeatureVLX : SubtargetFeature<"avx512vl", "HasVLX", "true", |
| 153 |
"Enable AVX-512 Vector Length eXtensions", |
| 154 |
[FeatureAVX512]>; |
| 155 |
def FeatureVBMI : SubtargetFeature<"avx512vbmi", "HasVBMI", "true", |
| 156 |
"Enable AVX-512 Vector Byte Manipulation Instructions", |
| 157 |
[FeatureBWI]>; |
| 158 |
def FeatureVBMI2 : SubtargetFeature<"avx512vbmi2", "HasVBMI2", "true", |
| 159 |
"Enable AVX-512 further Vector Byte Manipulation Instructions", |
| 160 |
[FeatureBWI]>; |
| 161 |
def FeatureIFMA : SubtargetFeature<"avx512ifma", "HasIFMA", "true", |
| 162 |
"Enable AVX-512 Integer Fused Multiple-Add", |
| 163 |
[FeatureAVX512]>; |
| 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", |
| 168 |
[FeatureAVX512]>; |
| 169 |
def FeatureBITALG : SubtargetFeature<"avx512bitalg", "HasBITALG", "true", |
| 170 |
"Enable AVX-512 Bit Algorithms", |
| 171 |
[FeatureBWI]>; |
| 172 |
def FeaturePCLMUL : SubtargetFeature<"pclmul", "HasPCLMUL", "true", |
| 173 |
"Enable packed carry-less multiplication instructions", |
| 174 |
[FeatureSSE2]>; |
| 175 |
def FeatureGFNI : SubtargetFeature<"gfni", "HasGFNI", "true", |
| 176 |
"Enable Galois Field Arithmetic Instructions", |
| 177 |
[FeatureSSE2]>; |
| 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", |
| 186 |
[FeatureFMA4]>; |
| 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", |
| 192 |
[FeatureSSE2]>; |
| 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", |
| 218 |
[FeatureSSE2]>; |
| 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">; |
| 276 |
def FeatureSoftFloat |
| 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. |
| 314 |
def FeatureFastLZCNT |
| 315 |
: SubtargetFeature< |
| 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 |
| 320 |
: SubtargetFeature< |
| 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 |
| 325 |
: SubtargetFeature< |
| 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 |
| 332 |
: SubtargetFeature< |
| 333 |
"fast-shld-rotate", "HasFastSHLDRotate", "true", |
| 334 |
"SHLD can be used as a faster rotate">; |
| 335 |
|
| 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}. |
| 341 |
def FeatureERMSB |
| 342 |
: SubtargetFeature< |
| 343 |
"ermsb", "HasERMSB", "true", |
| 344 |
"REP MOVS/STOS are fast">; |
| 345 |
|
| 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 |
| 348 |
// operation. |
| 349 |
def FeatureMacroFusion |
| 350 |
: SubtargetFeature<"macrofusion", "HasMacroFusion", "true", |
| 351 |
"Various instructions can be fused with conditional branches">; |
| 352 |
|
| 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.">; |
| 360 |
|
| 361 |
def FeaturePrefer256Bit |
| 362 |
: SubtargetFeature<"prefer-256-bit", "Prefer256Bit", "true", |
| 363 |
"Prefer 256-bit AVX instructions">; |
| 364 |
|
| 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 |
| 370 |
// tail calls). |
| 371 |
def FeatureRetpoline |
| 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.">; |
| 376 |
|
| 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 |
| 381 |
: SubtargetFeature< |
| 382 |
"retpoline-external-thunk", "UseRetpolineExternalThunk", "true", |
| 383 |
"Enable retpoline, but with an externally provided thunk.", |
| 384 |
[FeatureRetpoline]>; |
| 385 |
|
| 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">; |
| 391 |
|
| 392 |
//===----------------------------------------------------------------------===// |
| 393 |
// Register File Description |
| 394 |
//===----------------------------------------------------------------------===// |
| 395 |
|
| 396 |
include "X86RegisterInfo.td" |
| 397 |
include "X86RegisterBanks.td" |
| 398 |
|
| 399 |
//===----------------------------------------------------------------------===// |
| 400 |
// Instruction Descriptions |
| 401 |
//===----------------------------------------------------------------------===// |
| 402 |
|
| 403 |
include "X86Schedule.td" |
| 404 |
include "X86InstrInfo_reduce.td" |
| 405 |
|
| 406 |
def X86InstrInfo : InstrInfo; |
| 407 |
|
| 408 |
//===----------------------------------------------------------------------===// |
| 409 |
// Assembly Parser |
| 410 |
//===----------------------------------------------------------------------===// |
| 411 |
|
| 412 |
def ATTAsmParserVariant : AsmParserVariant { |
| 413 |
int Variant = 0; |
| 414 |
|
| 415 |
// Variant name. |
| 416 |
string Name = "att"; |
| 417 |
|
| 418 |
// Discard comments in assembly strings. |
| 419 |
string CommentDelimiter = "#"; |
| 420 |
|
| 421 |
// Recognize hard coded registers. |
| 422 |
string RegisterPrefix = "%"; |
| 423 |
} |
| 424 |
|
| 425 |
def IntelAsmParserVariant : AsmParserVariant { |
| 426 |
int Variant = 1; |
| 427 |
|
| 428 |
// Variant name. |
| 429 |
string Name = "intel"; |
| 430 |
|
| 431 |
// Discard comments in assembly strings. |
| 432 |
string CommentDelimiter = ";"; |
| 433 |
|
| 434 |
// Recognize hard coded registers. |
| 435 |
string RegisterPrefix = ""; |
| 436 |
} |
| 437 |
|
| 438 |
//===----------------------------------------------------------------------===// |
| 439 |
// Assembly Printers |
| 440 |
//===----------------------------------------------------------------------===// |
| 441 |
|
| 442 |
// The X86 target supports two different syntaxes for emitting machine code. |
| 443 |
// This is controlled by the -x86-asm-syntax={att|intel} |
| 444 |
def ATTAsmWriter : AsmWriter { |
| 445 |
string AsmWriterClassName = "ATTInstPrinter"; |
| 446 |
int Variant = 0; |
| 447 |
} |
| 448 |
def IntelAsmWriter : AsmWriter { |
| 449 |
string AsmWriterClassName = "IntelInstPrinter"; |
| 450 |
int Variant = 1; |
| 451 |
} |
| 452 |
|
| 453 |
def X86 : Target { |
| 454 |
// Information about the instructions... |
| 455 |
let InstructionSet = X86InstrInfo; |
| 456 |
let AssemblyParserVariants = [ATTAsmParserVariant, IntelAsmParserVariant]; |
| 457 |
let AssemblyWriters = [ATTAsmWriter, IntelAsmWriter]; |
| 458 |
let AllowRegisterRenaming = 1; |
| 459 |
} |