Skip to content

Commit

Permalink
Rollup merge of #135203 - RalfJung:arm-soft-float, r=workingjubilee
Browse files Browse the repository at this point in the history
arm: add unstable soft-float target feature

This has an actual usecase as mentioned [here](#116344 (comment)), and with my recent ARM float ABI changes there shouldn't be any soundness concerns any more. We will reject enabling this feature on `hf` targets, but disabling it on non-`hf` targets is entirely fine -- the target feature refers to whether softfloat emulation is used for float instructions, and is independent of the ABI which we set separately via `llvm_floatabi`.

Cc ``@workingjubilee``
  • Loading branch information
jhpratt authored Jan 8, 2025
2 parents 45250f3 + 427abb6 commit 57eb95c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("neon", Unstable(sym::arm_target_feature), &["vfp3"]),
("rclass", Unstable(sym::arm_target_feature), &[]),
("sha2", Unstable(sym::arm_target_feature), &["neon"]),
// This can be *disabled* on non-`hf` targets to enable the use
// of hardfloats while keeping the softfloat ABI.
// FIXME before stabilization: Should we expose this as a `hard-float` target feature instead of
// matching the odd negative feature LLVM uses?
("soft-float", Unstable(sym::arm_target_feature), &[]),
// This is needed for inline assembly, but shouldn't be stabilized as-is
// since it should be enabled per-function using #[instruction_set], not
// #[target_feature].
Expand Down Expand Up @@ -790,6 +795,9 @@ impl Target {
match self.llvm_floatabi.unwrap() {
FloatAbi::Soft => {
// Nothing special required, will use soft-float ABI throughout.
// We can even allow `-soft-float` here; in fact that is useful as it lets
// people use FPU instructions with a softfloat ABI (corresponds to
// `-mfloat-abi=softfp` in GCC/clang).
NOTHING
}
FloatAbi::Hard => {
Expand Down
1 change: 1 addition & 0 deletions tests/ui/check-cfg/target_feature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`sme-lutv2`
`sme2`
`sme2p1`
`soft-float`
`spe`
`ssbs`
`sse`
Expand Down

0 comments on commit 57eb95c

Please sign in to comment.