Skip to content

Commit 8af4462

Browse files
authored
Rollup merge of rust-lang#103750 - calebzulawski:master, r=workingjubilee
Fix some misleading target feature aliases This is the first half of a fix for rust-lang#100752. It looks like these aliases were added in rust-lang#78361 and slipped under the radar, as these features are not AVX512. These features _do_ add AVX512 instructions when used _in combination_ with AVX512F, but without AVX512F, these features still provide 128-bit and 256-bit vector instructions. A user might be mislead into thinking these features imply AVX512F (which is true of the actual AVX512 features). This PR allows using the names as defined by LLVM, which matches Intel documentation. A future PR should change the `std::arch` intrinsics to use these names, and finally remove these aliases from rustc. r? ``@workingjubilee`` cc ``@Amanieu``
2 parents ace1ba4 + 1122400 commit 8af4462

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

compiler/rustc_codegen_gcc/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ pub fn target_features(sess: &Session, allow_unstable: bool) -> Vec<Symbol> {
315315
false
316316
}
317317
/*
318-
adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512gfni,
319-
avx512ifma, avx512pf, avx512vaes, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpclmulqdq,
320-
avx512vpopcntdq, bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
321-
sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, xsave, xsavec, xsaveopt, xsaves
318+
adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512ifma,
319+
avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
320+
bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
321+
sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
322322
*/
323323
//false
324324
})

compiler/rustc_codegen_llvm/src/llvm_util.rs

+3
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ pub fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]
163163
("x86", "rdrand") => smallvec!["rdrnd"],
164164
("x86", "bmi1") => smallvec!["bmi"],
165165
("x86", "cmpxchg16b") => smallvec!["cx16"],
166+
// FIXME: These aliases are misleading, and should be removed before avx512_target_feature is
167+
// stabilized. They must remain until std::arch switches off them.
168+
// rust#100752
166169
("x86", "avx512vaes") => smallvec!["vaes"],
167170
("x86", "avx512gfni") => smallvec!["gfni"],
168171
("x86", "avx512vpclmulqdq") => smallvec!["vpclmulqdq"],

compiler/rustc_codegen_ssa/src/target_features.rs

+3
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
179179
("f16c", Some(sym::f16c_target_feature)),
180180
("fma", None),
181181
("fxsr", None),
182+
("gfni", Some(sym::avx512_target_feature)),
182183
("lzcnt", None),
183184
("movbe", Some(sym::movbe_target_feature)),
184185
("pclmulqdq", None),
@@ -195,6 +196,8 @@ const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
195196
("sse4a", Some(sym::sse4a_target_feature)),
196197
("ssse3", None),
197198
("tbm", Some(sym::tbm_target_feature)),
199+
("vaes", Some(sym::avx512_target_feature)),
200+
("vpclmulqdq", Some(sym::avx512_target_feature)),
198201
("xsave", None),
199202
("xsavec", None),
200203
("xsaveopt", None),

0 commit comments

Comments
 (0)