@@ -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,56 +259,15 @@ 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
- // 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
- // Filter out features that are not supported by the current LLVM version
281
- ( "riscv32" | "riscv64" , "zacas" ) if get_version ( ) . 0 < 20 => None ,
282
- (
283
- "s390x" ,
284
- "message-security-assist-extension12"
285
- | "concurrent-functions"
286
- | "miscellaneous-extensions-4"
287
- | "vector-enhancements-3"
288
- | "vector-packed-decimal-enhancement-3" ,
289
- ) if get_version ( ) . 0 < 20 => None ,
290
262
// Enable the evex512 target feature if an avx512 target feature is enabled.
291
263
( "x86" , s) if s. starts_with ( "avx512" ) => Some ( LLVMFeature :: with_dependencies (
292
264
s,
293
265
smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "evex512" ) ] ,
294
266
) ) ,
295
- // Support for `wide-arithmetic` will first land in LLVM 20 as part of
296
- // llvm/llvm-project#111598
297
- ( "wasm32" | "wasm64" , "wide-arithmetic" ) if get_version ( ) < ( 20 , 0 , 0 ) => None ,
298
267
( "sparc" , "leoncasa" ) => Some ( LLVMFeature :: new ( "hasleoncasa" ) ) ,
299
- // In LLVM 19, there is no `v8plus` feature and `v9` means "SPARC-V9 instruction available and SPARC-V8+ ABI used".
300
- // https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L27-L28
301
- // Before LLVM 19, there was no `v8plus` feature and `v9` means "SPARC-V9 instruction available".
302
- // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26
303
- ( "sparc" , "v8plus" ) if get_version ( ) . 0 == 19 => Some ( LLVMFeature :: new ( "v9" ) ) ,
304
268
( "powerpc" , "power8-crypto" ) => Some ( LLVMFeature :: new ( "crypto" ) ) ,
305
- // These new `amx` variants and `movrs` were introduced in LLVM20
306
- ( "x86" , "amx-avx512" | "amx-fp8" | "amx-movrs" | "amx-tf32" | "amx-transpose" )
307
- if get_version ( ) . 0 < 20 =>
308
- {
309
- None
310
- }
311
- ( "x86" , "movrs" ) if get_version ( ) . 0 < 20 => None ,
312
269
( "x86" , "avx10.1" ) => Some ( LLVMFeature :: new ( "avx10.1-512" ) ) ,
313
- ( "x86" , "avx10.2" ) if get_version ( ) . 0 < 20 => None ,
314
- ( "x86" , "avx10.2" ) if get_version ( ) . 0 >= 20 => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
270
+ ( "x86" , "avx10.2" ) => Some ( LLVMFeature :: new ( "avx10.2-512" ) ) ,
315
271
( "x86" , "apxf" ) => Some ( LLVMFeature :: with_dependencies (
316
272
"egpr" ,
317
273
smallvec ! [
@@ -715,17 +671,7 @@ pub(crate) fn global_llvm_features(
715
671
} ;
716
672
717
673
// Features implied by an implicit or explicit `--target`.
718
- features. extend (
719
- sess. target
720
- . features
721
- . split ( ',' )
722
- . filter ( |v| !v. is_empty ( ) )
723
- // Drop +v8plus feature introduced in LLVM 20.
724
- // (Hard-coded target features do not go through `to_llvm_feature` since they already
725
- // are LLVM feature names, hence we need a special case here.)
726
- . filter ( |v| * v != "+v8plus" || get_version ( ) >= ( 20 , 0 , 0 ) )
727
- . map ( String :: from) ,
728
- ) ;
674
+ features. extend ( sess. target . features . split ( ',' ) . filter ( |v| !v. is_empty ( ) ) . map ( String :: from) ) ;
729
675
730
676
if wants_wasm_eh ( sess) && sess. panic_strategy ( ) == PanicStrategy :: Unwind {
731
677
features. push ( "+exception-handling" . into ( ) ) ;
0 commit comments