@@ -246,9 +246,6 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
246246 ( "aarch64" , "pmuv3" ) => Some ( LLVMFeature :: new ( "perfmon" ) ) ,
247247 ( "aarch64" , "paca" ) => Some ( LLVMFeature :: new ( "pauth" ) ) ,
248248 ( "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" ) ) ,
252249 ( "aarch64" , "flagm2" ) => Some ( LLVMFeature :: new ( "altnzcv" ) ) ,
253250 // Rust ties fp and neon together.
254251 ( "aarch64" , "neon" ) => Some ( LLVMFeature :: with_dependencies (
@@ -262,56 +259,15 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
262259 // Filter out features that are not supported by the current LLVM version
263260 ( "aarch64" , "fpmr" ) => None , // only existed in 18
264261 ( "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 ,
290262 // Enable the evex512 target feature if an avx512 target feature is enabled.
291263 ( "x86" , s) if s. starts_with ( "avx512" ) => Some ( LLVMFeature :: with_dependencies (
292264 s,
293265 smallvec ! [ TargetFeatureFoldStrength :: EnableOnly ( "evex512" ) ] ,
294266 ) ) ,
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 ,
298267 ( "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" ) ) ,
304268 ( "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 ,
312269 ( "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" ) ) ,
315271 ( "x86" , "apxf" ) => Some ( LLVMFeature :: with_dependencies (
316272 "egpr" ,
317273 smallvec ! [
@@ -713,17 +669,7 @@ pub(crate) fn global_llvm_features(
713669 } ;
714670
715671 // Features implied by an implicit or explicit `--target`.
716- features. extend (
717- sess. target
718- . features
719- . split ( ',' )
720- . filter ( |v| !v. is_empty ( ) )
721- // Drop +v8plus feature introduced in LLVM 20.
722- // (Hard-coded target features do not go through `to_llvm_feature` since they already
723- // are LLVM feature names, hence we need a special case here.)
724- . filter ( |v| * v != "+v8plus" || get_version ( ) >= ( 20 , 0 , 0 ) )
725- . map ( String :: from) ,
726- ) ;
672+ features. extend ( sess. target . features . split ( ',' ) . filter ( |v| !v. is_empty ( ) ) . map ( String :: from) ) ;
727673
728674 if wants_wasm_eh ( sess) && sess. panic_strategy ( ) == PanicStrategy :: Unwind {
729675 features. push ( "+exception-handling" . into ( ) ) ;
0 commit comments