@@ -217,27 +217,16 @@ impl<'a> IntoIterator for LLVMFeature<'a> {
217
217
/// Rust can also be build with an external precompiled version of LLVM which might lead to failures
218
218
/// if the oldest tested / supported LLVM version doesn't yet support the relevant intrinsics.
219
219
pub ( 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,
230
227
} ;
228
+ let ( major, _, _) = get_version ( ) ;
231
229
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" ) ) ,
241
230
( "aarch64" , "rcpc2" ) => Some ( LLVMFeature :: new ( "rcpc-immo" ) ) ,
242
231
( "aarch64" , "dpb" ) => Some ( LLVMFeature :: new ( "ccpp" ) ) ,
243
232
( "aarch64" , "dpb2" ) => Some ( LLVMFeature :: new ( "ccdp" ) ) ,
@@ -260,14 +249,23 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
260
249
( "aarch64" , "fpmr" ) => None , // only existed in 18
261
250
( "arm" , "fp16" ) => Some ( LLVMFeature :: new ( "fullfp16" ) ) ,
262
251
// 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" ) ) ,
264
264
// Enable the evex512 target feature if an avx512 target feature is enabled.
265
265
( "x86" , s) if s. starts_with ( "avx512" ) => Some ( LLVMFeature :: with_dependencies (
266
266
s,
267
267
smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "evex512" ) ] ,
268
268
) ) ,
269
- ( "sparc" , "leoncasa" ) => Some ( LLVMFeature :: new ( "hasleoncasa" ) ) ,
270
- ( "powerpc" , "power8-crypto" ) => Some ( LLVMFeature :: new ( "crypto" ) ) ,
271
269
( "x86" , "avx10.1" ) => Some ( LLVMFeature :: new ( "avx10.1-512" ) ) ,
272
270
( "x86" , "avx10.2" ) => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
273
271
( "x86" , "apxf" ) => Some ( LLVMFeature :: with_dependencies (
0 commit comments