diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 6c7f5a7772323..7c13ba699932a 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1528,6 +1528,8 @@ supported_targets! { ("thumbv8m.base-none-eabi", thumbv8m_base_none_eabi), ("thumbv8m.main-none-eabi", thumbv8m_main_none_eabi), ("thumbv8m.main-none-eabihf", thumbv8m_main_none_eabihf), + ("thumbv8.1m.main-none-eabi", thumbv81m_main_none_eabi), + ("thumbv8.1m.main-none-eabihf", thumbv81m_main_none_eabihf), ("armv7a-none-eabi", armv7a_none_eabi), ("thumbv7a-none-eabi", thumbv7a_none_eabi), diff --git a/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabi.rs b/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabi.rs new file mode 100644 index 0000000000000..1c197aef1d5ab --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabi.rs @@ -0,0 +1,28 @@ +// Targets the Cortex-M55/-M85 processors (Armv8.1-M Mainline architecture profile), +// without the Floating Point extension. + +use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; + +pub(crate) fn target() -> Target { + Target { + llvm_target: "thumbv8.1m.main-none-eabi".into(), + metadata: TargetMetadata { + description: Some("Bare ARMv8.1-M Mainline with DSP and LOB".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(false), + }, + pointer_width: 32, + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), + arch: Arch::Arm, + + options: TargetOptions { + cfg_abi: CfgAbi::Eabi, + llvm_floatabi: Some(FloatAbi::Soft), + // We assume you have the DSP and LOB extensions (which are technically optional). + features: "+dsp,+lob".into(), + max_atomic_width: Some(32), + ..base::arm_none::opts() + }, + } +} diff --git a/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabihf.rs b/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabihf.rs new file mode 100644 index 0000000000000..a93ba1ab47fc7 --- /dev/null +++ b/compiler/rustc_target/src/spec/targets/thumbv81m_main_none_eabihf.rs @@ -0,0 +1,31 @@ +// Targets the Cortex-M55/-M85 processors (Armv8.1-M Mainline architecture profile), +// with the Floating Point extension. +// +// It does not assume you have M-Profile Vector Extensions (aka Helium) + +use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base}; + +pub(crate) fn target() -> Target { + Target { + llvm_target: "thumbv8.1m.main-none-eabihf".into(), + metadata: TargetMetadata { + description: Some("Bare ARMv8.1-M Mainline, hardfloat, with DSP and LOB".into()), + tier: Some(3), + host_tools: Some(false), + std: Some(false), + }, + pointer_width: 32, + data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), + arch: Arch::Arm, + + options: TargetOptions { + cfg_abi: CfgAbi::EabiHf, + llvm_floatabi: Some(FloatAbi::Hard), + // The Cortex-M55 and Cortex-M85 both have FPv5-D16 double-precision FPUs + // We also assume you have the DSP and LOB extensions (which are technically optional). + features: "+dsp,+fp-armv8d16,+lob".into(), + max_atomic_width: Some(32), + ..base::arm_none::opts() + }, + } +} diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index ac44a4dfca9b1..1d9542021e234 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -37,6 +37,8 @@ pub struct Finder { const STAGE0_MISSING_TARGETS: &[&str] = &[ // just a dummy comment so the list doesn't get onelined "aarch64-unknown-qtee", + "thumbv8.1m.main-none-eabihf", + "thumbv8.1m.main-none-eabi", ]; /// Minimum version threshold for libstdc++ required when using prebuilt LLVM diff --git a/src/doc/rustc/src/SUMMARY.md b/src/doc/rustc/src/SUMMARY.md index 953789648485b..a8dd4b66b44ae 100644 --- a/src/doc/rustc/src/SUMMARY.md +++ b/src/doc/rustc/src/SUMMARY.md @@ -67,6 +67,7 @@ - [thumbv7m-none-eabi](./platform-support/thumbv7m-none-eabi.md) - [thumbv8m.base-none-eabi](./platform-support/thumbv8m.base-none-eabi.md) - [thumbv8m.main-none-eabi\*](./platform-support/thumbv8m.main-none-eabi.md) + - [thumbv8.1m.main-none-eabi\*](./platform-support/thumbv8.1m.main-none-eabi.md) - [armebv7r-none-eabi{,hf}](platform-support/armebv7r-none-eabi.md) - [arm\*-unknown-linux-\*](./platform-support/arm-linux.md) - [armeb-unknown-linux-gnueabi](platform-support/armeb-unknown-linux-gnueabi.md) diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md index 2321dec16b8eb..fc71e94211268 100644 --- a/src/doc/rustc/src/platform-support.md +++ b/src/doc/rustc/src/platform-support.md @@ -448,6 +448,8 @@ target | std | host | notes [`thumbv8m.base-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Baseline with NuttX [`thumbv8m.main-nuttx-eabi`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX [`thumbv8m.main-nuttx-eabihf`](platform-support/nuttx.md) | ✓ | | ARMv8M Mainline with NuttX, hardfloat +[`thumbv8.1m.main-none-eabi`](platform-support/thumbv8.1m.main-none-eabi.md) | * | | Bare Armv8.1-M Mainline, with DSP and LOB +[`thumbv8.1m.main-none-eabihf`](platform-support/thumbv8.1m.main-none-eabi.md) | * | | Bare Armv8.1-M Mainline, hardfloat, with DSP and LOB [`wasm64-unknown-unknown`](platform-support/wasm64-unknown-unknown.md) | ? | | WebAssembly [`wasm32-wali-linux-musl`](platform-support/wasm32-wali-linux.md) | ? | | WebAssembly with [WALI](https://github.com/arjunr2/WALI) [`x86_64-apple-tvos`](platform-support/apple-tvos.md) | ✓ | | x86 64-bit tvOS diff --git a/src/doc/rustc/src/platform-support/arm-none-eabi.md b/src/doc/rustc/src/platform-support/arm-none-eabi.md index 4a6c4783f6d7b..3e3b6a6c44e2e 100644 --- a/src/doc/rustc/src/platform-support/arm-none-eabi.md +++ b/src/doc/rustc/src/platform-support/arm-none-eabi.md @@ -26,6 +26,7 @@ their own document. - [`thumbv7em-none-eabi` and `thumbv7em-none-eabihf`](thumbv7em-none-eabi.md) - [`thumbv8m.base-none-eabi`](thumbv8m.base-none-eabi.md) - [`thumbv8m.main-none-eabi` and `thumbv8m.main-none-eabihf`](thumbv8m.main-none-eabi.md) + - [`thumbv8.1m.main-none-eabi` and `thumbv8.1m.main-none-eabihf`](thumbv8.1m.main-none-eabi.md) - *Legacy* Arm Architectures - None diff --git a/src/doc/rustc/src/platform-support/thumbv8.1m.main-none-eabi.md b/src/doc/rustc/src/platform-support/thumbv8.1m.main-none-eabi.md new file mode 100644 index 0000000000000..6f7a07b16e0aa --- /dev/null +++ b/src/doc/rustc/src/platform-support/thumbv8.1m.main-none-eabi.md @@ -0,0 +1,111 @@ +# `thumbv8.1m.main-none-eabi` and `thumbv8.1m.main-none-eabihf` + +* **Tier: 3** +* **Library Support:** core and alloc (bare-metal, `#![no_std]`) + +Bare-metal target for CPUs in the Mainline [Armv8.1-M] architecture family, +supporting a subset of the [T32 ISA][t32-isa]. + +Processors in this family include the: + +* [Arm Cortex-M55][cortex-m55] +* [Arm Cortex-M85][cortex-m85] + +This target assumes your processor supports the *DSP* and *Low-Overhead Branch* extensions. + +See [`arm-none-eabi`](arm-none-eabi.md) for information applicable to all +`arm-none-eabi` targets, in particular the difference between the `eabi` and +`eabihf` ABI. + +[t32-isa]: https://developer.arm.com/Architectures/T32%20Instruction%20Set%20Architecture +[Armv8.1-M]: https://developer.arm.com/documentation/ddi0553/latest/ +[cortex-m55]: https://developer.arm.com/Processors/Cortex-M55 +[cortex-m85]: https://developer.arm.com/Processors/Cortex-M85 + +## Target maintainers + +- [Rust Embedded Devices Working Group Arm Team](https://github.com/rust-embedded/wg?tab=readme-ov-file#the-arm-team) +- [arm-maintainers][arm_maintainers] ([rust@arm.com][arm_email]) + - Use `@rustbot ping arm-maintainers` to ping us + +[arm_maintainers]: https://github.com/rust-lang/team/blob/master/teams/arm-maintainers.toml +[arm_email]: mailto:rust@arm.com + +## Target CPU and Target Feature options + +See [the bare-metal Arm +docs](arm-none-eabi.md#target-cpu-and-target-feature-options) for details on how +to use these flags. + +### Table of supported CPUs for `thumbv8.1m.main-none-eabi` + +| CPU | FPU | MVE | Target CPU | Target Features | +| ----------- | --- | --------- | ------------- | --------------------- | +| Unspecified | No | No | None | None | +| Cortex-M55 | No | No | `cortex-m55` | `-fpregs,-mve` | +| Cortex-M55 | DP | No | `cortex-m55` | `-mve` | +| Cortex-M55 | No | Int | `cortex-m55` | `-fpregs,-mve.fp,+mve`| +| Cortex-M55 | DP | Int | `cortex-m55` | `-mve.fp` | +| Cortex-M55 | DP | Int+Float | `cortex-m55` | None | +| Cortex-M85 | No | No | `cortex-m85` | `-fpregs,-mve` | +| Cortex-M85 | DP | No | `cortex-m85` | `-mve` | +| Cortex-M85 | No | Int | `cortex-m85` | `-fpregs,-mve.fp,+mve`| +| Cortex-M85 | DP | Int | `cortex-m85` | `-mve.fp` | +| Cortex-M85 | DP | Int+Float | `cortex-m85` | None | + +### Table of supported CPUs for `thumbv8.1m.main-none-eabihf` + +| CPU | FPU | MVE | Target CPU | Target Features | +| ----------- | --- | --------- | ------------- | --------------------- | +| Unspecified | DP | No | None | None | +| Cortex-M55 | DP | No | `cortex-m55` | `-mve` | +| Cortex-M55 | DP | Int | `cortex-m55` | `-mve.fp` | +| Cortex-M55 | DP | Int+Float | `cortex-m55` | None | +| Cortex-M85 | DP | No | `cortex-m85` | `-mve` | +| Cortex-M85 | DP | Int | `cortex-m85` | `-mve.fp` | +| Cortex-M85 | DP | 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. + +