@@ -102,10 +102,9 @@ use rustc_codegen_ssa::back::write::{
102102 CodegenContext , FatLtoInput , ModuleConfig , TargetMachineFactoryFn ,
103103} ;
104104use rustc_codegen_ssa:: base:: codegen_crate;
105+ use rustc_codegen_ssa:: target_features:: cfg_target_feature;
105106use rustc_codegen_ssa:: traits:: { CodegenBackend , ExtraBackendMethods , WriteBackendMethods } ;
106- use rustc_codegen_ssa:: {
107- CodegenResults , CompiledModule , ModuleCodegen , TargetConfig , target_features,
108- } ;
107+ use rustc_codegen_ssa:: { CodegenResults , CompiledModule , ModuleCodegen , TargetConfig } ;
109108use rustc_data_structures:: fx:: FxIndexMap ;
110109use rustc_data_structures:: sync:: IntoDynSyncSend ;
111110use rustc_errors:: DiagCtxtHandle ;
@@ -478,25 +477,21 @@ fn to_gcc_opt_level(optlevel: Option<OptLevel>) -> OptimizationLevel {
478477
479478/// Returns the features that should be set in `cfg(target_feature)`.
480479fn target_config ( sess : & Session , target_info : & LockedTargetInfo ) -> TargetConfig {
481- let ( unstable_target_features, target_features) = target_features:: cfg_target_feature (
482- sess,
483- /* FIXME: we ignore `-Ctarget-feature` */ "" ,
484- |feature| {
485- // TODO: we disable Neon for now since we don't support the LLVM intrinsics for it.
486- if feature == "neon" {
487- return false ;
488- }
489- target_info. cpu_supports ( feature)
490- // cSpell:disable
491- /*
492- adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512fp16, avx512ifma,
493- avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
494- bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
495- sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
496- */
497- // cSpell:enable
498- } ,
499- ) ;
480+ let ( unstable_target_features, target_features) = cfg_target_feature ( sess, |feature| {
481+ // TODO: we disable Neon for now since we don't support the LLVM intrinsics for it.
482+ if feature == "neon" {
483+ return false ;
484+ }
485+ target_info. cpu_supports ( feature)
486+ // cSpell:disable
487+ /*
488+ adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512fp16, avx512ifma,
489+ avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
490+ bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
491+ sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
492+ */
493+ // cSpell:enable
494+ } ) ;
500495
501496 let has_reliable_f16 = target_info. supports_target_dependent_type ( CType :: Float16 ) ;
502497 let has_reliable_f128 = target_info. supports_target_dependent_type ( CType :: Float128 ) ;
0 commit comments