@@ -217,27 +217,16 @@ impl<'a> IntoIterator for LLVMFeature<'a> {
217217/// Rust can also be build with an external precompiled version of LLVM which might lead to failures
218218/// if the oldest tested / supported LLVM version doesn't yet support the relevant intrinsics.
219219pub ( crate ) fn to_llvm_features < ' a > ( sess : & Session , s : & ' a str ) -> Option < LLVMFeature < ' a > > {
220- let arch = if sess. target . arch == "x86_64" {
221- "x86"
222- } else if sess. target . arch == "arm64ec" {
223- "aarch64"
224- } else if sess. target . arch == "sparc64" {
225- "sparc"
226- } else if sess. target . arch == "powerpc64" {
227- "powerpc"
228- } else {
229- & * sess. target . arch
220+ let raw_arch = & * sess. target . arch ;
221+ let arch = match raw_arch {
222+ "x86_64" => "x86" ,
223+ "arm64ec" => "aarch64" ,
224+ "sparc64" => "sparc" ,
225+ "powerpc64" => "powerpc" ,
226+ _ => raw_arch,
230227 } ;
228+ let ( major, _, _) = get_version ( ) ;
231229 match ( arch, s) {
232- ( "x86" , "sse4.2" ) => Some ( LLVMFeature :: with_dependencies (
233- "sse4.2" ,
234- smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "crc32" ) ] ,
235- ) ) ,
236- ( "x86" , "pclmulqdq" ) => Some ( LLVMFeature :: new ( "pclmul" ) ) ,
237- ( "x86" , "rdrand" ) => Some ( LLVMFeature :: new ( "rdrnd" ) ) ,
238- ( "x86" , "bmi1" ) => Some ( LLVMFeature :: new ( "bmi" ) ) ,
239- ( "x86" , "cmpxchg16b" ) => Some ( LLVMFeature :: new ( "cx16" ) ) ,
240- ( "x86" , "lahfsahf" ) => Some ( LLVMFeature :: new ( "sahf" ) ) ,
241230 ( "aarch64" , "rcpc2" ) => Some ( LLVMFeature :: new ( "rcpc-immo" ) ) ,
242231 ( "aarch64" , "dpb" ) => Some ( LLVMFeature :: new ( "ccpp" ) ) ,
243232 ( "aarch64" , "dpb2" ) => Some ( LLVMFeature :: new ( "ccdp" ) ) ,
@@ -260,14 +249,23 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
260249 ( "aarch64" , "fpmr" ) => None , // only existed in 18
261250 ( "arm" , "fp16" ) => Some ( LLVMFeature :: new ( "fullfp16" ) ) ,
262251 // Filter out features that are not supported by the current LLVM version
263- ( "loongarch32" | "loongarch64" , "32s" ) if get_version ( ) . 0 < 21 => None ,
252+ ( "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" ) ) ,
264264 // Enable the evex512 target feature if an avx512 target feature is enabled.
265265 ( "x86" , s) if s. starts_with ( "avx512" ) => Some ( LLVMFeature :: with_dependencies (
266266 s,
267267 smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "evex512" ) ] ,
268268 ) ) ,
269- ( "sparc" , "leoncasa" ) => Some ( LLVMFeature :: new ( "hasleoncasa" ) ) ,
270- ( "powerpc" , "power8-crypto" ) => Some ( LLVMFeature :: new ( "crypto" ) ) ,
271269 ( "x86" , "avx10.1" ) => Some ( LLVMFeature :: new ( "avx10.1-512" ) ) ,
272270 ( "x86" , "avx10.2" ) => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
273271 ( "x86" , "apxf" ) => Some ( LLVMFeature :: with_dependencies (
0 commit comments