mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Auto merge of #130987 - thejpster:revise-arm-platform-notes-soft-float, r=ehuss
Revise arm platform notes regarding soft float This PR updates the Arm microcontroller platform docs to recommend `-fpregs` instead of `+soft-float` as [discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.60-Ctarget-feature.3D.2Bsoft-float.60.20considered.20harmful)
This commit is contained in:
commit
edbd9398dc
@ -42,15 +42,14 @@ their own document.
|
||||
There are two 32-bit instruction set architectures (ISAs) defined by Arm:
|
||||
|
||||
- The [*A32 ISA*][a32-isa], with fixed-width 32-bit instructions. Previously
|
||||
known as the *Arm* ISA, this originated with the original Arm1 of 1985 and has
|
||||
known as the *Arm* ISA, this originated with the original ARM1 of 1985 and has
|
||||
been updated by various revisions to the architecture specifications ever
|
||||
since.
|
||||
- The [*T32 ISA*][t32-isa], with a mix of 16-bit and 32-bit width instructions.
|
||||
Note that this term includes both the original 16-bit width *Thumb* ISA
|
||||
introduced with the Armv4T architecture in 1994, and the later 16/32-bit sized
|
||||
*Thumb-2* ISA introduced with the Armv6T2 architecture in 2003.
|
||||
|
||||
Again, these ISAs have been revised by subsequent revisions to the relevant Arm
|
||||
*Thumb-2* ISA introduced with the Armv6T2 architecture in 2003. Again, these
|
||||
ISAs have been revised by subsequent revisions to the relevant Arm
|
||||
architecture specifications.
|
||||
|
||||
There is also a 64-bit ISA with fixed-width 32-bit instructions called the *A64
|
||||
@ -106,10 +105,14 @@ features you do not have available, leaving you with the optimized instruction
|
||||
scheduling and support for the features you do have. More details are available
|
||||
in the detailed target-specific documentation.
|
||||
|
||||
**Note:** Many target-features are currently unstable and subject to change, and
|
||||
<div class="warning">
|
||||
|
||||
Many target-features are currently unstable and subject to change, and
|
||||
if you use them you should disassemble the compiler output and manually inspect
|
||||
it to ensure only appropriate instructions for your CPU have been generated.
|
||||
|
||||
</div>
|
||||
|
||||
If you wish to use the *target-cpu* and *target-feature* options, you can add
|
||||
them to your `.cargo/config.toml` file alongside any other flags your project
|
||||
uses (likely linker related ones):
|
||||
|
@ -35,9 +35,9 @@ to use these flags.
|
||||
| CPU | FPU | DSP | Target CPU | Target Features |
|
||||
| ---------- | --- | --- | ----------- | --------------- |
|
||||
| Any | No | Yes | None | None |
|
||||
| Cortex-M4 | No | Yes | `cortex-m4` | `+soft-float` |
|
||||
| Cortex-M4 | No | Yes | `cortex-m4` | `-fpregs` |
|
||||
| Cortex-M4F | SP | Yes | `cortex-m4` | None |
|
||||
| Cortex-M7 | No | Yes | `cortex-m7` | `+soft-float` |
|
||||
| Cortex-M7 | No | Yes | `cortex-m7` | `-fpregs` |
|
||||
| Cortex-M7F | SP | Yes | `cortex-m7` | `-fp64` |
|
||||
| Cortex-M7F | DP | Yes | `cortex-m7` | None |
|
||||
|
||||
@ -50,6 +50,13 @@ to use these flags.
|
||||
| Cortex-M7F | SP | Yes | `cortex-m7` | `-fp64` |
|
||||
| Cortex-M7F | DP | Yes | `cortex-m7` | None |
|
||||
|
||||
<div class="warning">
|
||||
|
||||
Never use the `-fpregs` *target-feature* with the `thumbv7em-none-eabihf` target
|
||||
as it will cause compilation units to have different ABIs, which is unsound.
|
||||
|
||||
</div>
|
||||
|
||||
### Arm Cortex-M4 and Arm Cortex-M4F
|
||||
|
||||
The target CPU is `cortex-m4`.
|
||||
@ -59,7 +66,7 @@ The target CPU is `cortex-m4`.
|
||||
* enabled by default with this *target*
|
||||
* Cortex-M4F has a single precision FPU
|
||||
* support is enabled by default with this *target-cpu*
|
||||
* disable support using the `+soft-float` feature (`eabi` only)
|
||||
* disable support using the `-fpregs` *target-feature* (`eabi` only)
|
||||
|
||||
### Arm Cortex-M7 and Arm Cortex-M7F
|
||||
|
||||
@ -71,4 +78,4 @@ The target CPU is `cortex-m7`.
|
||||
* Cortex-M7F have either a single-precision or double-precision FPU
|
||||
* double-precision support is enabled by default with this *target-cpu*
|
||||
* opt-out by using the `-f64` *target-feature*
|
||||
* disable support entirely using the `+soft-float` feature (`eabi` only)
|
||||
* disable support entirely using the `-fpregs` *target-feature* (`eabi` only)
|
||||
|
@ -39,22 +39,22 @@ to use these flags.
|
||||
| CPU | FPU | DSP | MVE | Target CPU | Target Features |
|
||||
| ----------- | --- | --- | --------- | ------------- | --------------------- |
|
||||
| Unspecified | No | No | No | None | None |
|
||||
| Cortex-M33 | No | No | No | `cortex-m33` | `+soft-float,-dsp` |
|
||||
| Cortex-M33 | No | Yes | No | `cortex-m33` | `+soft-float` |
|
||||
| Cortex-M33 | No | No | No | `cortex-m33` | `-fpregs,-dsp` |
|
||||
| Cortex-M33 | No | Yes | No | `cortex-m33` | `-fpregs` |
|
||||
| Cortex-M33 | SP | No | No | `cortex-m33` | `-dsp` |
|
||||
| Cortex-M33 | SP | Yes | No | `cortex-m33` | None |
|
||||
| Cortex-M35P | No | No | No | `cortex-m35p` | `+soft-float,-dsp` |
|
||||
| Cortex-M35P | No | Yes | No | `cortex-m35p` | `+soft-float` |
|
||||
| Cortex-M35P | No | No | No | `cortex-m35p` | `-fpregs,-dsp` |
|
||||
| Cortex-M35P | No | Yes | No | `cortex-m35p` | `-fpregs` |
|
||||
| Cortex-M35P | SP | No | No | `cortex-m35p` | `-dsp` |
|
||||
| Cortex-M35P | SP | Yes | No | `cortex-m35p` | None |
|
||||
| Cortex-M55 | No | Yes | No | `cortex-m55` | `+soft-float,-mve` |
|
||||
| Cortex-M55 | No | Yes | No | `cortex-m55` | `-fpregs,-mve` |
|
||||
| Cortex-M55 | DP | Yes | No | `cortex-m55` | `-mve` |
|
||||
| Cortex-M55 | No | Yes | Int | `cortex-m55` | `+soft-float,-mve.fp` |
|
||||
| Cortex-M55 | No | Yes | Int | `cortex-m55` | `-fpregs,-mve.fp,+mve`|
|
||||
| Cortex-M55 | DP | Yes | Int | `cortex-m55` | `-mve.fp` |
|
||||
| Cortex-M55 | DP | Yes | Int+Float | `cortex-m55` | None |
|
||||
| Cortex-M85 | No | Yes | No | `cortex-m85` | `+soft-float,-mve` |
|
||||
| Cortex-M85 | No | Yes | No | `cortex-m85` | `-fpregs,-mve` |
|
||||
| Cortex-M85 | DP | Yes | No | `cortex-m85` | `-mve` |
|
||||
| Cortex-M85 | No | Yes | Int | `cortex-m85` | `+soft-float,-mve.fp` |
|
||||
| Cortex-M85 | No | Yes | Int | `cortex-m85` | `-fpregs,-mve.fp,+mve`|
|
||||
| Cortex-M85 | DP | Yes | Int | `cortex-m85` | `-mve.fp` |
|
||||
| Cortex-M85 | DP | Yes | Int+Float | `cortex-m85` | None |
|
||||
|
||||
@ -74,6 +74,19 @@ to use these flags.
|
||||
| Cortex-M85 | DP | Yes | Int | `cortex-m85` | `-mve.fp` |
|
||||
| Cortex-M85 | DP | Yes | Int+Float | `cortex-m85` | None |
|
||||
|
||||
*Technically* you can use this hard-float ABI on a CPU which has no FPU but does
|
||||
have Integer MVE, because MVE provides the same set of registers as the FPU
|
||||
(including `s0` and `d0`). The particular set of flags that might enable this
|
||||
unusual scenario are currently not recorded here.
|
||||
|
||||
<div class="warning">
|
||||
|
||||
Never use the `-fpregs` *target-feature* with the `thumbv8m.main-none-eabihf`
|
||||
target as it will cause compilation units to have different ABIs, which is
|
||||
unsound.
|
||||
|
||||
</div>
|
||||
|
||||
### Arm Cortex-M33
|
||||
|
||||
The target CPU is `cortex-m33`.
|
||||
@ -83,7 +96,7 @@ The target CPU is `cortex-m33`.
|
||||
* enabled by default with this *target-cpu*
|
||||
* Has an optional single precision FPU
|
||||
* support is enabled by default with this *target-cpu*
|
||||
* disable support using the `+soft-float` feature (`eabi` only)
|
||||
* disable support using the `-fpregs` *target-feature* (`eabi` only)
|
||||
|
||||
### Arm Cortex-M35P
|
||||
|
||||
@ -94,7 +107,7 @@ The target CPU is `cortex-m35p`.
|
||||
* enabled by default with this *target-cpu*
|
||||
* Has an optional single precision FPU
|
||||
* support is enabled by default with this *target-cpu*
|
||||
* disable support using the `+soft-float` feature (`eabi` only)
|
||||
* disable support using the `-fpregs` *target-feature* (`eabi` only)
|
||||
|
||||
### Arm Cortex-M55
|
||||
|
||||
@ -106,7 +119,7 @@ The target CPU is `cortex-m55`.
|
||||
* Has an optional double-precision FPU that also supports half-precision FP16
|
||||
values
|
||||
* support is enabled by default with this *target-cpu*
|
||||
* disable support using the `+soft-float` feature (`eabi` only)
|
||||
* disable support using the `-fpregs` *target-feature* (`eabi` only)
|
||||
* Has optional support for M-Profile Vector Extensions
|
||||
* Also known as *Helium Technology*
|
||||
* Available with only integer support, or both integer/float support
|
||||
@ -125,7 +138,7 @@ The target CPU is `cortex-m85`.
|
||||
* Has an optional double-precision FPU that also supports half-precision FP16
|
||||
values
|
||||
* support is enabled by default with this *target-cpu*
|
||||
* disable support using the `+soft-float` feature (`eabi` only)
|
||||
* disable support using the `-fpregs` *target-feature* (`eabi` only)
|
||||
* Has optional support for M-Profile Vector Extensions
|
||||
* Also known as *Helium Technology*
|
||||
* Available with only integer support, or both integer/float support
|
||||
|
Loading…
Reference in New Issue
Block a user