Skip to content

Commit 427abb6

Browse files
committed
arm: add unstable soft-float target feature
1 parent 243d2ca commit 427abb6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Diff for: compiler/rustc_target/src/target_features.rs

+8
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ const ARM_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
148148
("neon", Unstable(sym::arm_target_feature), &["vfp3"]),
149149
("rclass", Unstable(sym::arm_target_feature), &[]),
150150
("sha2", Unstable(sym::arm_target_feature), &["neon"]),
151+
// This can be *disabled* on non-`hf` targets to enable the use
152+
// of hardfloats while keeping the softfloat ABI.
153+
// FIXME before stabilization: Should we expose this as a `hard-float` target feature instead of
154+
// matching the odd negative feature LLVM uses?
155+
("soft-float", Unstable(sym::arm_target_feature), &[]),
151156
// This is needed for inline assembly, but shouldn't be stabilized as-is
152157
// since it should be enabled per-function using #[instruction_set], not
153158
// #[target_feature].
@@ -790,6 +795,9 @@ impl Target {
790795
match self.llvm_floatabi.unwrap() {
791796
FloatAbi::Soft => {
792797
// Nothing special required, will use soft-float ABI throughout.
798+
// We can even allow `-soft-float` here; in fact that is useful as it lets
799+
// people use FPU instructions with a softfloat ABI (corresponds to
800+
// `-mfloat-abi=softfp` in GCC/clang).
793801
NOTHING
794802
}
795803
FloatAbi::Hard => {

Diff for: tests/ui/check-cfg/target_feature.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
202202
`sme-lutv2`
203203
`sme2`
204204
`sme2p1`
205+
`soft-float`
205206
`spe`
206207
`ssbs`
207208
`sse`

0 commit comments

Comments
 (0)