@@ -262,6 +262,15 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
262
262
// Filter out features that are not supported by the current LLVM version
263
263
( "aarch64" , "fpmr" ) => None , // only existed in 18
264
264
( "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 ,
265
274
// Filter out features that are not supported by the current LLVM version
266
275
( "loongarch64" , "div32" | "lam-bh" | "lamcas" | "ld-seq-sa" | "scq" )
267
276
if get_version ( ) . 0 < 20 =>
@@ -324,15 +333,12 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
324
333
///
325
334
/// We do not have to worry about RUSTC_SPECIFIC_FEATURES here, those are handled outside codegen.
326
335
pub ( crate ) fn target_config ( sess : & Session ) -> TargetConfig {
327
- // Add base features for the target.
328
- // We do *not* add the -Ctarget-features there, and instead duplicate the logic for that below.
329
- // The reason is that if LLVM considers a feature implied but we do not, we don't want that to
330
- // show up in `cfg`. That way, `cfg` is entirely under our control -- except for the handling of
331
- // the target CPU, that is still expanded to target features (with all their implied features)
332
- // by LLVM.
333
336
let target_machine = create_informational_target_machine ( sess, true ) ;
334
337
335
338
let ( unstable_target_features, target_features) = cfg_target_feature ( sess, |feature| {
339
+ // This closure determines whether the target CPU has the feature according to LLVM. We do
340
+ // *not* consider the `-Ctarget-feature`s here, as that will be handled later in
341
+ // `cfg_target_feature`.
336
342
if let Some ( feat) = to_llvm_features ( sess, feature) {
337
343
// All the LLVM features this expands to must be enabled.
338
344
for llvm_feature in feat {
0 commit comments