Skip to content

Commit 081e5b4

Browse files
authored
Support detecting all llc's x86 target features
This commit adds support for detecting all of llc's target features for the x86/x86_64 architectures. Closes rust-lang#30462. Helps with rust-lang#29717 and rust-lang#34382.
1 parent 45cde97 commit 081e5b4

File tree

1 file changed

+82
-8
lines changed

1 file changed

+82
-8
lines changed

src/librustc_driver/target_features.rs

Lines changed: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,88 @@ const ARM_WHITELIST: &'static [&'static str] = &[
2828
];
2929

3030
const X86_WHITELIST: &'static [&'static str] = &[
31-
"avx\0",
32-
"avx2\0",
33-
"sse\0",
34-
"sse2\0",
35-
"sse3\0",
36-
"sse4.1\0",
37-
"sse4.2\0",
38-
"ssse3\0",
31+
"16bit-mode\0", // 16-bit mode (i8086).
32+
"32bit-mode\0", // 32-bit mode (80386).
33+
"3dnow\0", // 3DNow! instructions.
34+
"3dnowa\0", // 3DNow! Athlon instructions.
35+
"64bit\0", // Support 64-bit instructions.
36+
"64bit-mode\0", // 64-bit mode (x86_64).
37+
"adx\0", // Support ADX instructions.
38+
"aes\0", // AES instructions.
39+
"atom\0", // Intel Atom processors.
40+
"avx\0", // AVX instructions.
41+
"avx2\0", // AVX2 instructions.
42+
"avx512bw\0", // AVX-512 Byte and Word Instructions.
43+
"avx512cd\0", // AVX-512 Conflict Detection Instructions.
44+
"avx512dq\0", // AVX-512 Doubleword and Quadword Instructions.
45+
"avx512er\0", // AVX-512 Exponential and Reciprocal Instructions.
46+
"avx512f\0", // AVX-512 instructions.
47+
"avx512ifma\0", // AVX-512 Integer Fused Multiple-Add.
48+
"avx512pf\0", // AVX-512 PreFetch Instructions.
49+
"avx512vbmi\0", // AVX-512 Vector Bit Manipulation Instructions.
50+
"avx512vl\0", // AVX-512 Vector Length eXtensions.
51+
"bmi\0", // BMI instructions.
52+
"bmi2\0", // BMI2 instructions.
53+
"call-reg-indirect\0", // Call register indirect.
54+
"clflushopt\0", // Flush A Cache Line Optimized.
55+
"clwb\0", // Cache Line Write Back.
56+
"cmov\0", // Conditional move instructions.
57+
"cx16\0", // 64-bit with cmpxchg16b.
58+
"f16c\0", // 16-bit floating point conversion instructions.
59+
"fast-partial-ymm-write\0", // Partial writes to YMM registers are fast.
60+
"fma\0", // Three-operand fused multiple-add.
61+
"fma4\0", // Four-operand fused multiple-add.
62+
"fsgsbase\0", // FS/GS Base instructions.
63+
"fxsr\0", // fxsave/fxrestore instructions.
64+
"hle\0", // HLE.
65+
"idivl-to-divb\0", // Use 8-bit divide for positive values less than 256.
66+
"idivq-to-divw\0", // Use 16-bit divide for positive values less than 65536.
67+
"invpcid\0", // Invalidate Process-Context Identifier.
68+
"lea-sp\0", // Uses LEA for adjusting the stack pointer.
69+
"lea-uses-ag\0", // LEA instruction needs inputs at AG stage.
70+
"lzcnt\0", // LZCNT instruction.
71+
"mmx\0", // MMX instructions.
72+
"movbe\0", // MOVBE instruction.
73+
"mpx\0", // MPX instructions.
74+
"mwaitx\0", // MONITORX/MWAITX timer functionality.
75+
"pad-short-functions\0", // Pad short functions.
76+
"pclmul\0", // Packed carry-less multiplication instructions.
77+
"pcommit\0", // Persistent Commit.
78+
"pku\0", // Protection keys.
79+
"popcnt\0", // POPCNT instruction.
80+
"prefetchwt1\0", // Prefetch with Intent to Write and T1 Hint.
81+
"prfchw\0", // PRFCHW instructions.
82+
"rdrnd\0", // RDRAND instruction.
83+
"rdseed\0", // RDSEED instruction.
84+
"rtm\0", // RTM instructions.
85+
"sahf\0", // LAHF and SAHF instructions.
86+
"sgx\0", // Software Guard Extensions.
87+
"sha\0", // SHA instructions.
88+
"slm\0", // Intel Silvermont processors.
89+
"slow-bt-mem\0", // Bit testing of memory is slow.
90+
"slow-incdec\0", // INC and DEC instructions are slower than ADD and SUB.
91+
"slow-lea\0", // LEA instruction with certain arguments is slow.
92+
"slow-shld\0", // SHLD instruction is slow.
93+
"slow-unaligned-mem-16\0", // Slow unaligned 16-byte memory access.
94+
"slow-unaligned-mem-32\0", // Slow unaligned 32-byte memory access.
95+
"smap\0", // Supervisor Mode Access Protection.
96+
"soft-float\0", // Use software floating point features.
97+
"sse\0", // SSE instructions.
98+
"sse-unaligned-mem\0", // Allow unaligned memory operands with SSE instructions.
99+
"sse2\0", // SSE2 instructions.
100+
"sse3\0", // SSE3 instructions.
101+
"sse4.1\0", // SSE 4.1 instructions.
102+
"sse4.2\0", // SSE 4.2 instructions.
103+
"sse4a\0", // SSE 4a instructions.
104+
"ssse3\0", // SSSE3 instructions.
105+
"tbm\0", // TBM instructions.
106+
"vmfunc\0", // VM Functions.
107+
"x87\0", // X87 float instructions.
108+
"xop\0", // XOP instructions.
109+
"xsave\0", // xsave instructions.
110+
"xsavec\0", // xsavec instructions.
111+
"xsaveopt\0", // xsaveopt instructions.
112+
"xsaves\0" // xsaves instructions.
39113
];
40114

41115
/// Add `target_feature = "..."` cfgs for a variety of platform

0 commit comments

Comments
 (0)