Skip to content

Commit a1a3cd0

Browse files
committed
rustc_codegen_llvm: Reorder conversion cases
For maintainability, this commit reorders target feature conversion cases by the architecture.
1 parent d9f67cb commit a1a3cd0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
227227
};
228228
let (major, _, _) = get_version();
229229
match (arch, s) {
230-
("x86", "sse4.2") => Some(LLVMFeature::with_dependencies(
231-
"sse4.2",
232-
smallvec![TargetFeatureFoldStrength::EnableOnly("crc32")],
233-
)),
234-
("x86", "pclmulqdq") => Some(LLVMFeature::new("pclmul")),
235-
("x86", "rdrand") => Some(LLVMFeature::new("rdrnd")),
236-
("x86", "bmi1") => Some(LLVMFeature::new("bmi")),
237-
("x86", "cmpxchg16b") => Some(LLVMFeature::new("cx16")),
238-
("x86", "lahfsahf") => Some(LLVMFeature::new("sahf")),
239230
("aarch64", "rcpc2") => Some(LLVMFeature::new("rcpc-immo")),
240231
("aarch64", "dpb") => Some(LLVMFeature::new("ccpp")),
241232
("aarch64", "dpb2") => Some(LLVMFeature::new("ccdp")),
@@ -259,13 +250,22 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
259250
("arm", "fp16") => Some(LLVMFeature::new("fullfp16")),
260251
// Filter out features that are not supported by the current LLVM version
261252
("loongarch32" | "loongarch64", "32s") if major < 21 => None,
253+
("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
254+
("sparc", "leoncasa") => Some(LLVMFeature::new("hasleoncasa")),
255+
("x86", "sse4.2") => Some(LLVMFeature::with_dependencies(
256+
"sse4.2",
257+
smallvec![TargetFeatureFoldStrength::EnableOnly("crc32")],
258+
)),
259+
("x86", "pclmulqdq") => Some(LLVMFeature::new("pclmul")),
260+
("x86", "rdrand") => Some(LLVMFeature::new("rdrnd")),
261+
("x86", "bmi1") => Some(LLVMFeature::new("bmi")),
262+
("x86", "cmpxchg16b") => Some(LLVMFeature::new("cx16")),
263+
("x86", "lahfsahf") => Some(LLVMFeature::new("sahf")),
262264
// Enable the evex512 target feature if an avx512 target feature is enabled.
263265
("x86", s) if s.starts_with("avx512") => Some(LLVMFeature::with_dependencies(
264266
s,
265267
smallvec![TargetFeatureFoldStrength::EnableOnly("evex512")],
266268
)),
267-
("sparc", "leoncasa") => Some(LLVMFeature::new("hasleoncasa")),
268-
("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
269269
("x86", "avx10.1") => Some(LLVMFeature::new("avx10.1-512")),
270270
("x86", "avx10.2") => Some(LLVMFeature::new("avx10.2-512")),
271271
("x86", "apxf") => Some(LLVMFeature::with_dependencies(

0 commit comments

Comments
 (0)