Skip to content

Commit

Permalink
rustc_target: Remove fpmr target feature
Browse files Browse the repository at this point in the history
FEAT_FPMR has been removed from upstream LLVM as of LLVM 19.
Remove the feature from the target features list and temporarily hack
the LLVM codegen to always enable it until the minimum LLVM version is
bumped to 19.
  • Loading branch information
mrkajetanp committed Jul 30, 2024
1 parent 9a69447 commit c79f701
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,12 @@ pub fn from_fn_attrs<'ll, 'tcx>(
InstructionSetAttr::ArmA32 => "-thumb-mode".to_string(),
InstructionSetAttr::ArmT32 => "+thumb-mode".to_string(),
}))
// HACK: LLVM versions 19+ do not have the FPMR feature and treat it as always enabled
// It only exists as a feature in LLVM 18, cannot be passed down for any other version
.chain(match &*cx.tcx.sess.target.arch {
"aarch64" if llvm_util::get_version().0 == 18 => vec!["+fpmr".to_string()],
_ => vec![],
})
.collect::<Vec<String>>();

if cx.tcx.sess.target.is_like_wasm {
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ const AARCH64_ALLOWED_FEATURES: &[(&str, Stability)] = &[
("fp8dot4", Unstable(sym::aarch64_unstable_target_feature)),
// FEAT_FP8FMA
("fp8fma", Unstable(sym::aarch64_unstable_target_feature)),
// FEAT_FPMR
("fpmr", Unstable(sym::aarch64_unstable_target_feature)),
// FEAT_FRINTTS
("frintts", Stable),
// FEAT_HBC
Expand Down

0 comments on commit c79f701

Please sign in to comment.