Skip to content

Commit 6ad17bd

Browse files
committed
get rid of feature list in target feature logic
1 parent 7340b9c commit 6ad17bd

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

+2-24
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
55
use rustc_errors::Applicability;
66
use rustc_hir::def::DefKind;
77
use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
8-
use rustc_middle::bug;
98
use rustc_middle::middle::codegen_fn_attrs::TargetFeature;
109
use rustc_middle::query::Providers;
1110
use rustc_middle::ty::TyCtxt;
@@ -61,30 +60,9 @@ pub(crate) fn from_target_feature(
6160
return None;
6261
};
6362

64-
// Only allow features whose feature gates have been enabled.
63+
// Only allow target features whose feature gates have been enabled.
6564
let allowed = match feature_gate.as_ref().copied() {
66-
Some(sym::arm_target_feature) => rust_features.arm_target_feature(),
67-
Some(sym::hexagon_target_feature) => rust_features.hexagon_target_feature(),
68-
Some(sym::powerpc_target_feature) => rust_features.powerpc_target_feature(),
69-
Some(sym::mips_target_feature) => rust_features.mips_target_feature(),
70-
Some(sym::riscv_target_feature) => rust_features.riscv_target_feature(),
71-
Some(sym::avx512_target_feature) => rust_features.avx512_target_feature(),
72-
Some(sym::sse4a_target_feature) => rust_features.sse4a_target_feature(),
73-
Some(sym::tbm_target_feature) => rust_features.tbm_target_feature(),
74-
Some(sym::wasm_target_feature) => rust_features.wasm_target_feature(),
75-
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature(),
76-
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature(),
77-
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature(),
78-
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature(),
79-
Some(sym::csky_target_feature) => rust_features.csky_target_feature(),
80-
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature(),
81-
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature(),
82-
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature(),
83-
Some(sym::sha512_sm_x86) => rust_features.sha512_sm_x86(),
84-
Some(sym::x86_amx_intrinsics) => rust_features.x86_amx_intrinsics(),
85-
Some(sym::xop_target_feature) => rust_features.xop_target_feature(),
86-
Some(sym::s390x_target_feature) => rust_features.s390x_target_feature(),
87-
Some(name) => bug!("unknown target feature gate {}", name),
65+
Some(name) => rust_features.enabled(name),
8866
None => true,
8967
};
9068
if !allowed {

0 commit comments

Comments
 (0)