@@ -107,7 +107,7 @@ use rustc_target::spec::{Arch, RelocModel};
107107use tempfile:: TempDir ;
108108
109109use crate :: back:: lto:: ModuleBuffer ;
110- use crate :: gcc_util:: target_cpu;
110+ use crate :: gcc_util:: { target_cpu, to_gcc_features } ;
111111
112112rustc_fluent_macro:: fluent_messages! { "../messages.ftl" }
113113
@@ -220,7 +220,7 @@ impl CodegenBackend for GccCodegenBackend {
220220 }
221221
222222 fn provide ( & self , providers : & mut Providers ) {
223- providers. global_backend_features = |tcx, ( ) | gcc_util:: global_gcc_features ( tcx. sess , true )
223+ providers. global_backend_features = |tcx, ( ) | gcc_util:: global_gcc_features ( tcx. sess )
224224 }
225225
226226 fn codegen_crate ( & self , tcx : TyCtxt < ' _ > ) -> Box < dyn Any > {
@@ -446,21 +446,25 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
446446
447447/// Returns the features that should be set in `cfg(target_feature)`.
448448fn target_config ( sess : & Session , target_info : & LockedTargetInfo ) -> TargetConfig {
449- let ( unstable_target_features, target_features) = cfg_target_feature ( sess, |feature| {
450- // TODO: we disable Neon for now since we don't support the LLVM intrinsics for it.
451- if feature == "neon" {
452- return false ;
453- }
454- target_info. cpu_supports ( feature)
455- // cSpell:disable
456- /*
457- adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512fp16, avx512ifma,
458- avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
459- bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
460- sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
461- */
462- // cSpell:enable
463- } ) ;
449+ let ( unstable_target_features, target_features) = cfg_target_feature (
450+ sess,
451+ |feature| to_gcc_features ( sess, feature) ,
452+ |feature| {
453+ // TODO: we disable Neon for now since we don't support the LLVM intrinsics for it.
454+ if feature == "neon" {
455+ return false ;
456+ }
457+ target_info. cpu_supports ( feature)
458+ // cSpell:disable
459+ /*
460+ adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512fp16, avx512ifma,
461+ avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
462+ bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
463+ sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
464+ */
465+ // cSpell:enable
466+ } ,
467+ ) ;
464468
465469 let has_reliable_f16 = target_info. supports_target_dependent_type ( CType :: Float16 ) ;
466470 let has_reliable_f128 = target_info. supports_target_dependent_type ( CType :: Float128 ) ;
0 commit comments