Skip to content

Commit bd29df2

Browse files
authored
Rollup merge of rust-lang#140460 - heiher:issue-140455, r=Urgau
Fix handling of LoongArch target features not supported by LLVM 19 Fixes rust-lang#140455
2 parents 4cb39af + 74b55b4 commit bd29df2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+6
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,12 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
273273
("aarch64", "fpmr") => None, // only existed in 18
274274
("arm", "fp16") => Some(LLVMFeature::new("fullfp16")),
275275
// Filter out features that are not supported by the current LLVM version
276+
("loongarch64", "div32" | "lam-bh" | "lamcas" | "ld-seq-sa" | "scq")
277+
if get_version().0 < 20 =>
278+
{
279+
None
280+
}
281+
// Filter out features that are not supported by the current LLVM version
276282
("riscv32" | "riscv64", "zacas") if get_version().0 < 20 => None,
277283
// Enable the evex512 target feature if an avx512 target feature is enabled.
278284
("x86", s) if s.starts_with("avx512") => {

compiler/rustc_target/src/target_features.rs

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ impl Stability {
102102
// check whether they're named already elsewhere in rust
103103
// e.g. in stdarch and whether the given name matches LLVM's
104104
// if it doesn't, to_llvm_feature in llvm_util in rustc_codegen_llvm needs to be adapted.
105+
// Additionally, if the feature is not available in older version of LLVM supported by the current
106+
// rust, the same function must be updated to filter out these features to avoid triggering
107+
// warnings.
105108
//
106109
// Also note that all target features listed here must be purely additive: for target_feature 1.1 to
107110
// be sound, we can never allow features like `+soft-float` (on x86) to be controlled on a

0 commit comments

Comments
 (0)