@@ -246,9 +246,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
246
246
( "aarch64" , "pmuv3" ) => Some ( LLVMFeature :: new ( "perfmon" ) ) ,
247
247
( "aarch64" , "paca" ) => Some ( LLVMFeature :: new ( "pauth" ) ) ,
248
248
( "aarch64" , "pacg" ) => Some ( LLVMFeature :: new ( "pauth" ) ) ,
249
- // Before LLVM 20 those two features were packaged together as b16b16
250
- ( "aarch64" , "sve-b16b16" ) if get_version ( ) . 0 < 20 => Some ( LLVMFeature :: new ( "b16b16" ) ) ,
251
- ( "aarch64" , "sme-b16b16" ) if get_version ( ) . 0 < 20 => Some ( LLVMFeature :: new ( "b16b16" ) ) ,
252
249
( "aarch64" , "flagm2" ) => Some ( LLVMFeature :: new ( "altnzcv" ) ) ,
253
250
// Rust ties fp and neon together.
254
251
( "aarch64" , "neon" ) => Some ( LLVMFeature :: with_dependencies (
@@ -262,57 +259,17 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
262
259
// Filter out features that are not supported by the current LLVM version
263
260
( "aarch64" , "fpmr" ) => None , // only existed in 18
264
261
( "arm" , "fp16" ) => Some ( LLVMFeature :: new ( "fullfp16" ) ) ,
265
- // NVPTX targets added in LLVM 20
266
- ( "nvptx64" , "sm_100" ) if get_version ( ) . 0 < 20 => None ,
267
- ( "nvptx64" , "sm_100a" ) if get_version ( ) . 0 < 20 => None ,
268
- ( "nvptx64" , "sm_101" ) if get_version ( ) . 0 < 20 => None ,
269
- ( "nvptx64" , "sm_101a" ) if get_version ( ) . 0 < 20 => None ,
270
- ( "nvptx64" , "sm_120" ) if get_version ( ) . 0 < 20 => None ,
271
- ( "nvptx64" , "sm_120a" ) if get_version ( ) . 0 < 20 => None ,
272
- ( "nvptx64" , "ptx86" ) if get_version ( ) . 0 < 20 => None ,
273
- ( "nvptx64" , "ptx87" ) if get_version ( ) . 0 < 20 => None ,
274
262
// Filter out features that are not supported by the current LLVM version
275
- ( "loongarch64" , "div32" | "lam-bh" | "lamcas" | "ld-seq-sa" | "scq" )
276
- if get_version ( ) . 0 < 20 =>
277
- {
278
- None
279
- }
280
263
( "loongarch32" | "loongarch64" , "32s" ) if get_version ( ) . 0 < 21 => None ,
281
- // Filter out features that are not supported by the current LLVM version
282
- ( "riscv32" | "riscv64" , "zacas" | "rva23u64" | "supm" ) if get_version ( ) . 0 < 20 => None ,
283
- (
284
- "s390x" ,
285
- "message-security-assist-extension12"
286
- | "concurrent-functions"
287
- | "miscellaneous-extensions-4"
288
- | "vector-enhancements-3"
289
- | "vector-packed-decimal-enhancement-3" ,
290
- ) if get_version ( ) . 0 < 20 => None ,
291
264
// Enable the evex512 target feature if an avx512 target feature is enabled.
292
265
( "x86" , s) if s. starts_with ( "avx512" ) => Some ( LLVMFeature :: with_dependencies (
293
266
s,
294
267
smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "evex512" ) ] ,
295
268
) ) ,
296
- // Support for `wide-arithmetic` will first land in LLVM 20 as part of
297
- // llvm/llvm-project#111598
298
- ( "wasm32" | "wasm64" , "wide-arithmetic" ) if get_version ( ) < ( 20 , 0 , 0 ) => None ,
299
269
( "sparc" , "leoncasa" ) => Some ( LLVMFeature :: new ( "hasleoncasa" ) ) ,
300
- // In LLVM 19, there is no `v8plus` feature and `v9` means "SPARC-V9 instruction available and SPARC-V8+ ABI used".
301
- // https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L27-L28
302
- // Before LLVM 19, there was no `v8plus` feature and `v9` means "SPARC-V9 instruction available".
303
- // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26
304
- ( "sparc" , "v8plus" ) if get_version ( ) . 0 == 19 => Some ( LLVMFeature :: new ( "v9" ) ) ,
305
270
( "powerpc" , "power8-crypto" ) => Some ( LLVMFeature :: new ( "crypto" ) ) ,
306
- // These new `amx` variants and `movrs` were introduced in LLVM20
307
- ( "x86" , "amx-avx512" | "amx-fp8" | "amx-movrs" | "amx-tf32" | "amx-transpose" )
308
- if get_version ( ) . 0 < 20 =>
309
- {
310
- None
311
- }
312
- ( "x86" , "movrs" ) if get_version ( ) . 0 < 20 => None ,
313
271
( "x86" , "avx10.1" ) => Some ( LLVMFeature :: new ( "avx10.1-512" ) ) ,
314
- ( "x86" , "avx10.2" ) if get_version ( ) . 0 < 20 => None ,
315
- ( "x86" , "avx10.2" ) if get_version ( ) . 0 >= 20 => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
272
+ ( "x86" , "avx10.2" ) => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
316
273
( "x86" , "apxf" ) => Some ( LLVMFeature :: with_dependencies (
317
274
"egpr" ,
318
275
smallvec ! [
@@ -716,17 +673,7 @@ pub(crate) fn global_llvm_features(
716
673
} ;
717
674
718
675
// Features implied by an implicit or explicit `--target`.
719
- features. extend (
720
- sess. target
721
- . features
722
- . split ( ',' )
723
- . filter ( |v| !v. is_empty ( ) )
724
- // Drop +v8plus feature introduced in LLVM 20.
725
- // (Hard-coded target features do not go through `to_llvm_feature` since they already
726
- // are LLVM feature names, hence we need a special case here.)
727
- . filter ( |v| * v != "+v8plus" || get_version ( ) >= ( 20 , 0 , 0 ) )
728
- . map ( String :: from) ,
729
- ) ;
676
+ features. extend ( sess. target . features . split ( ',' ) . filter ( |v| !v. is_empty ( ) ) . map ( String :: from) ) ;
730
677
731
678
if wants_wasm_eh ( sess) && sess. panic_strategy ( ) == PanicStrategy :: Unwind {
732
679
features. push ( "+exception-handling" . into ( ) ) ;
0 commit comments