Skip to content

Commit 34a873b

Browse files
authored
Unrolled build for rust-lang#123159
Rollup merge of rust-lang#123159 - chrisnc:fix-arm-rm-none-eabihf-features, r=workingjubilee Fix target-cpu fpu features on Arm R/M-profile This is achieved by converting `+<fpu>,-d32,{,-fp64}` to `+<fpu>d16{,sp}`. By using a single additive feature that captures `d16` vs `d32` and `sp` vs `dp`, we prevent `-<feature>` from overriding `-C target-cpu` at build time. Remove extraneous `-fp16` from `armv7r` targets, as this is not included in `vfp3` anyway, but was preventing `fp16` from being enabled by e.g., `-C target-cpu=cortex-r7`, which does support `fp16`.
2 parents 9d79cd5 + 0459e55 commit 34a873b

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

compiler/rustc_target/src/spec/targets/armebv7r_none_eabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub fn target() -> Target {
2222
linker: Some("rust-lld".into()),
2323
relocation_model: RelocModel::Static,
2424
panic_strategy: PanicStrategy::Abort,
25-
features: "+vfp3,-d32,-fp16".into(),
25+
features: "+vfp3d16".into(),
2626
max_atomic_width: Some(64),
2727
emit_debug_gdb_scripts: false,
2828
// GCC defaults to 8 for arm-none here.

compiler/rustc_target/src/spec/targets/armv7r_none_eabihf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn target() -> Target {
2121
linker: Some("rust-lld".into()),
2222
relocation_model: RelocModel::Static,
2323
panic_strategy: PanicStrategy::Abort,
24-
features: "+vfp3,-d32,-fp16".into(),
24+
features: "+vfp3d16".into(),
2525
max_atomic_width: Some(64),
2626
emit_debug_gdb_scripts: false,
2727
// GCC defaults to 8 for arm-none here.

compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,15 @@ pub fn target() -> Target {
2525

2626
options: TargetOptions {
2727
abi: "eabihf".into(),
28-
// `+vfp4` is the lowest common denominator between the Cortex-M4 (vfp4-16) and the
29-
// Cortex-M7 (vfp5)
30-
// `-d32` both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers
31-
// available
32-
// `-fp64` The Cortex-M4 only supports single precision floating point operations
33-
// whereas in the Cortex-M7 double precision is optional
28+
// vfp4 is the lowest common denominator between the Cortex-M4F (vfp4) and the
29+
// Cortex-M7 (vfp5).
30+
// Both the Cortex-M4 and the Cortex-M7 only have 16 double-precision registers
31+
// available, and the Cortex-M4 only supports single-precision floating point operations
32+
// whereas in the Cortex-M7 double-precision is optional.
3433
//
3534
// Reference:
3635
// ARMv7-M Architecture Reference Manual - A2.5 The optional floating-point extension
37-
features: "+vfp4,-d32,-fp64".into(),
36+
features: "+vfp4d16sp".into(),
3837
max_atomic_width: Some(32),
3938
..base::thumb::opts()
4039
},

compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ pub fn target() -> Target {
2222
// processor, the Cortex-M33 Technical Reference Manual states that
2323
// the FPU uses the FPv5 architecture, single-precision instructions
2424
// and 16 D registers.
25-
// These parameters map to the following LLVM features.
26-
features: "+fp-armv8,-fp64,-d32".into(),
25+
features: "+fp-armv8d16sp".into(),
2726
max_atomic_width: Some(32),
2827
..base::thumb::opts()
2928
},

0 commit comments

Comments
 (0)