Skip to content

Commit d7152f8

Browse files
committed
Allow actual AVX512-related feature names in the case of some misleading aliases
1 parent cd12888 commit d7152f8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

compiler/rustc_codegen_gcc/src/lib.rs

Lines changed: 4 additions & 4 deletions
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

Lines changed: 3 additions & 0 deletions
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. For now, they must be kept at a minimum because std::arch uses 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

Lines changed: 3 additions & 0 deletions
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)