Skip to content

Commit 1d84152

Browse files
committed
Stabilize Arm64EC inline assembly
1 parent b91a3a0 commit 1d84152

File tree

5 files changed

+6
-33
lines changed

5 files changed

+6
-33
lines changed

compiler/rustc_ast_lowering/src/asm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
4545
| asm::InlineAsmArch::X86_64
4646
| asm::InlineAsmArch::Arm
4747
| asm::InlineAsmArch::AArch64
48+
| asm::InlineAsmArch::Arm64EC
4849
| asm::InlineAsmArch::RiscV32
4950
| asm::InlineAsmArch::RiscV64
5051
| asm::InlineAsmArch::LoongArch64

src/doc/unstable-book/src/language-features/asm-experimental-arch.md

+2-30
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
1919
- M68k
2020
- CSKY
2121
- s390x
22-
- Arm64EC
2322
- SPARC
2423

2524
## Register classes
@@ -59,9 +58,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
5958
| s390x | `areg` | `a[2-15]` | Only clobbers |
6059
| SPARC | `reg` | `r[2-29]` | `r` |
6160
| SPARC | `yreg` | `y` | Only clobbers |
62-
| Arm64EC | `reg` | `x[0-12]`, `x[15-22]`, `x[25-27]`, `x30` | `r` |
63-
| Arm64EC | `vreg` | `v[0-15]` | `w` |
64-
| Arm64EC | `vreg_low16` | `v[0-15]` | `x` |
6561

6662
> **Notes**:
6763
> - NVPTX doesn't have a fixed register set, so named registers are not supported.
@@ -102,8 +98,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
10298
| s390x | `areg` | N/A | Only clobbers |
10399
| SPARC | `reg` | None | `i8`, `i16`, `i32`, `i64` (SPARC64 only) |
104100
| SPARC | `yreg` | N/A | Only clobbers |
105-
| Arm64EC | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
106-
| Arm64EC | `vreg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
107101

108102
## Register aliases
109103

@@ -144,12 +138,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
144138
| SPARC | `r[8-15]` | `o[0-7]` |
145139
| SPARC | `r[16-23]` | `l[0-7]` |
146140
| SPARC | `r[24-31]` | `i[0-7]` |
147-
| Arm64EC | `x[0-30]` | `w[0-30]` |
148-
| Arm64EC | `x29` | `fp` |
149-
| Arm64EC | `x30` | `lr` |
150-
| Arm64EC | `sp` | `wsp` |
151-
| Arm64EC | `xzr` | `wzr` |
152-
| Arm64EC | `v[0-15]` | `b[0-15]`, `h[0-15]`, `s[0-15]`, `d[0-15]`, `q[0-15]` |
153141

154142
> **Notes**:
155143
> - TI does not mandate a frame pointer for MSP430, but toolchains are allowed
@@ -160,8 +148,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
160148
| Architecture | Unsupported register | Reason |
161149
| ------------ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
162150
| All | `sp`, `r15` (s390x), `r14`/`o6` (SPARC) | The stack pointer must be restored to its original value at the end of an asm code block. |
163-
| All | `fr` (Hexagon), `fp` (PowerPC), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `r11` (s390x), `r30`/`i6` (SPARC), `x29` (Arm64EC) | The frame pointer cannot be used as an input or output. |
164-
| All | `r19` (Hexagon), `r29` (PowerPC), `r30` (PowerPC), `x19` (Arm64EC) | These are used internally by LLVM as "base pointer" for functions with complex stack frames. |
151+
| All | `fr` (Hexagon), `fp` (PowerPC), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `r11` (s390x), `r30`/`i6` (SPARC) | The frame pointer cannot be used as an input or output. |
152+
| All | `r19` (Hexagon), `r29` (PowerPC), `r30` (PowerPC) | These are used internally by LLVM as "base pointer" for functions with complex stack frames. |
165153
| MIPS | `$0` or `$zero` | This is a constant zero register which can't be modified. |
166154
| MIPS | `$1` or `$at` | Reserved for assembler. |
167155
| MIPS | `$26`/`$k0`, `$27`/`$k1` | OS-reserved registers. |
@@ -188,9 +176,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
188176
| SPARC | `r5`/`g5` | Reserved for system. (SPARC32 only) |
189177
| SPARC | `r6`/`g6`, `r7`/`g7` | Reserved for system. |
190178
| SPARC | `r31`/`i7` | Return address cannot be used as inputs or outputs. |
191-
| Arm64EC | `xzr` | This is a constant zero register which can't be modified. |
192-
| Arm64EC | `x18` | This is an OS-reserved register. |
193-
| Arm64EC | `x13`, `x14`, `x23`, `x24`, `x28`, `v[16-31]` | These are AArch64 registers that are not supported for Arm64EC. |
194179

195180

196181
## Template modifiers
@@ -212,16 +197,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
212197
| SPARC | `reg` | None | `%o0` | None |
213198
| CSKY | `reg` | None | `r0` | None |
214199
| CSKY | `freg` | None | `f0` | None |
215-
| Arm64EC | `reg` | None | `x0` | `x` |
216-
| Arm64EC | `reg` | `w` | `w0` | `w` |
217-
| Arm64EC | `reg` | `x` | `x0` | `x` |
218-
| Arm64EC | `vreg` | None | `v0` | None |
219-
| Arm64EC | `vreg` | `v` | `v0` | None |
220-
| Arm64EC | `vreg` | `b` | `b0` | `b` |
221-
| Arm64EC | `vreg` | `h` | `h0` | `h` |
222-
| Arm64EC | `vreg` | `s` | `s0` | `s` |
223-
| Arm64EC | `vreg` | `d` | `d0` | `d` |
224-
| Arm64EC | `vreg` | `q` | `q0` | `q` |
225200

226201
# Flags covered by `preserves_flags`
227202

@@ -237,6 +212,3 @@ These flags registers must be restored upon exiting the asm block if the `preser
237212
- SPARC
238213
- Integer condition codes (`icc` and `xcc`)
239214
- Floating-point condition codes (`fcc[0-3]`)
240-
- Arm64EC
241-
- Condition flags (`NZCV` register).
242-
- Floating-point status (`FPSR` register).

tests/assembly/asm/aarch64-types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ [arm64ec] needs-llvm-components: aarch64
77
//@ compile-flags: -Zmerge-functions=disabled
88

9-
#![feature(no_core, lang_items, rustc_attrs, repr_simd, asm_experimental_arch, f16, f128)]
9+
#![feature(no_core, lang_items, rustc_attrs, repr_simd, f16, f128)]
1010
#![crate_type = "rlib"]
1111
#![no_core]
1212
#![allow(asm_sub_register, non_camel_case_types)]

tests/codegen/asm/arm64ec-clobbers.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ needs-llvm-components: aarch64
44

55
#![crate_type = "rlib"]
6-
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
6+
#![feature(no_core, rustc_attrs, lang_items)]
77
#![no_core]
88

99
#[lang = "sized"]

tests/ui/asm/aarch64/arm64ec-sve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ needs-llvm-components: aarch64
44

55
#![crate_type = "rlib"]
6-
#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)]
6+
#![feature(no_core, rustc_attrs, lang_items)]
77
#![no_core]
88

99
// SVE cannot be used for Arm64EC

0 commit comments

Comments
 (0)