compiler: Add target features for LoongArch

This commit is contained in:
WANG Rui 2023-10-19 21:12:19 +08:00
parent f654229c27
commit cb618162b1
3 changed files with 18 additions and 0 deletions

View File

@ -342,6 +342,19 @@
("hard-float-abi", Some(sym::csky_target_feature)), ("hard-float-abi", Some(sym::csky_target_feature)),
// tidy-alphabetical-end // tidy-alphabetical-end
]; ];
const LOONGARCH_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
// tidy-alphabetical-start
("d", Some(sym::loongarch_target_feature)),
("f", Some(sym::loongarch_target_feature)),
("lasx", Some(sym::loongarch_target_feature)),
("lbt", Some(sym::loongarch_target_feature)),
("lsx", Some(sym::loongarch_target_feature)),
("lvz", Some(sym::loongarch_target_feature)),
("ual", Some(sym::loongarch_target_feature)),
// tidy-alphabetical-end
];
/// When rustdoc is running, provide a list of all known features so that all their respective /// When rustdoc is running, provide a list of all known features so that all their respective
/// primitives may be documented. /// primitives may be documented.
/// ///
@ -358,6 +371,7 @@ pub fn all_known_features() -> impl Iterator<Item = (&'static str, Option<Symbol
.chain(WASM_ALLOWED_FEATURES.iter()) .chain(WASM_ALLOWED_FEATURES.iter())
.chain(BPF_ALLOWED_FEATURES.iter()) .chain(BPF_ALLOWED_FEATURES.iter())
.chain(CSKY_ALLOWED_FEATURES) .chain(CSKY_ALLOWED_FEATURES)
.chain(LOONGARCH_ALLOWED_FEATURES)
.cloned() .cloned()
} }
@ -373,6 +387,7 @@ pub fn supported_target_features(sess: &Session) -> &'static [(&'static str, Opt
"wasm32" | "wasm64" => WASM_ALLOWED_FEATURES, "wasm32" | "wasm64" => WASM_ALLOWED_FEATURES,
"bpf" => BPF_ALLOWED_FEATURES, "bpf" => BPF_ALLOWED_FEATURES,
"csky" => CSKY_ALLOWED_FEATURES, "csky" => CSKY_ALLOWED_FEATURES,
"loongarch64" => LOONGARCH_ALLOWED_FEATURES,
_ => &[], _ => &[],
} }
} }
@ -445,6 +460,7 @@ pub fn from_target_feature(
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature, Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature, Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature,
Some(sym::csky_target_feature) => rust_features.csky_target_feature, Some(sym::csky_target_feature) => rust_features.csky_target_feature,
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature,
Some(name) => bug!("unknown target feature gate {}", name), Some(name) => bug!("unknown target feature gate {}", name),
None => true, None => true,
}; };

View File

@ -288,6 +288,7 @@ pub fn internal(&self, feature: Symbol) -> bool {
(unstable, csky_target_feature, "1.73.0", Some(44839), None), (unstable, csky_target_feature, "1.73.0", Some(44839), None),
(unstable, ermsb_target_feature, "1.49.0", Some(44839), None), (unstable, ermsb_target_feature, "1.49.0", Some(44839), None),
(unstable, hexagon_target_feature, "1.27.0", Some(44839), None), (unstable, hexagon_target_feature, "1.27.0", Some(44839), None),
(unstable, loongarch_target_feature, "1.73.0", Some(44839), None),
(unstable, mips_target_feature, "1.27.0", Some(44839), None), (unstable, mips_target_feature, "1.27.0", Some(44839), None),
(unstable, powerpc_target_feature, "1.27.0", Some(44839), None), (unstable, powerpc_target_feature, "1.27.0", Some(44839), None),
(unstable, riscv_target_feature, "1.45.0", Some(44839), None), (unstable, riscv_target_feature, "1.45.0", Some(44839), None),

View File

@ -957,6 +957,7 @@
log_syntax, log_syntax,
logf32, logf32,
logf64, logf64,
loongarch_target_feature,
loop_break_value, loop_break_value,
lt, lt,
macro_at_most_once_rep, macro_at_most_once_rep,