Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2763c8

Browse files
committedNov 2, 2024
Stabilize Arm64EC inline assembly
1 parent 7c7bb7d commit a2763c8

File tree

5 files changed

+6
-34
lines changed

5 files changed

+6
-34
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-31
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

2423
## Register classes
2524

@@ -55,9 +54,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
5554
| s390x | `freg` | `f[0-15]` | `f` |
5655
| s390x | `vreg` | `v[0-31]` | Only clobbers |
5756
| s390x | `areg` | `a[2-15]` | Only clobbers |
58-
| Arm64EC | `reg` | `x[0-12]`, `x[15-22]`, `x[25-27]`, `x30` | `r` |
59-
| Arm64EC | `vreg` | `v[0-15]` | `w` |
60-
| Arm64EC | `vreg_low16` | `v[0-15]` | `x` |
6157

6258
> **Notes**:
6359
> - NVPTX doesn't have a fixed register set, so named registers are not supported.
@@ -95,8 +91,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
9591
| s390x | `freg` | None | `f32`, `f64` |
9692
| s390x | `vreg` | N/A | Only clobbers |
9793
| s390x | `areg` | N/A | Only clobbers |
98-
| Arm64EC | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
99-
| Arm64EC | `vreg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
10094

10195
## Register aliases
10296

@@ -129,12 +123,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
129123
| CSKY | `r29` | `rtb` |
130124
| CSKY | `r30` | `svbr` |
131125
| CSKY | `r31` | `tls` |
132-
| Arm64EC | `x[0-30]` | `w[0-30]` |
133-
| Arm64EC | `x29` | `fp` |
134-
| Arm64EC | `x30` | `lr` |
135-
| Arm64EC | `sp` | `wsp` |
136-
| Arm64EC | `xzr` | `wzr` |
137-
| Arm64EC | `v[0-15]` | `b[0-15]`, `h[0-15]`, `s[0-15]`, `d[0-15]`, `q[0-15]` |
138126

139127
> **Notes**:
140128
> - TI does not mandate a frame pointer for MSP430, but toolchains are allowed
@@ -145,8 +133,8 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
145133
| Architecture | Unsupported register | Reason |
146134
| ------------ | --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
147135
| All | `sp`, `r15` (s390x) | The stack pointer must be restored to its original value at the end of an asm code block. |
148-
| All | `fr` (Hexagon), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `r11` (s390x), `x29` (Arm64EC) | The frame pointer cannot be used as an input or output. |
149-
| All | `r19` (Hexagon), `x19` (Arm64EC) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
136+
| All | `fr` (Hexagon), `$fp` (MIPS), `Y` (AVR), `r4` (MSP430), `a6` (M68k), `r11` (s390x) | The frame pointer cannot be used as an input or output. |
137+
| All | `r19` (Hexagon) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
150138
| MIPS | `$0` or `$zero` | This is a constant zero register which can't be modified. |
151139
| MIPS | `$1` or `$at` | Reserved for assembler. |
152140
| MIPS | `$26`/`$k0`, `$27`/`$k1` | OS-reserved registers. |
@@ -164,10 +152,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
164152
| CSKY | `r31` | This is the TLS register. |
165153
| s390x | `c[0-15]` | Reserved by the kernel. |
166154
| s390x | `a[0-1]` | Reserved for system use. |
167-
| Arm64EC | `xzr` | This is a constant zero register which can't be modified. |
168-
| Arm64EC | `x18` | This is an OS-reserved register. |
169-
| Arm64EC | `x13`, `x14`, `x23`, `x24`, `x28`, `v[16-31]` | These are AArch64 registers that are not supported for Arm64EC. |
170-
171155

172156
## Template modifiers
173157

@@ -187,16 +171,6 @@ This feature tracks `asm!` and `global_asm!` support for the following architect
187171
| s390x | `freg` | None | `%f0` | None |
188172
| CSKY | `reg` | None | `r0` | None |
189173
| CSKY | `freg` | None | `f0` | None |
190-
| Arm64EC | `reg` | None | `x0` | `x` |
191-
| Arm64EC | `reg` | `w` | `w0` | `w` |
192-
| Arm64EC | `reg` | `x` | `x0` | `x` |
193-
| Arm64EC | `vreg` | None | `v0` | None |
194-
| Arm64EC | `vreg` | `v` | `v0` | None |
195-
| Arm64EC | `vreg` | `b` | `b0` | `b` |
196-
| Arm64EC | `vreg` | `h` | `h0` | `h` |
197-
| Arm64EC | `vreg` | `s` | `s0` | `s` |
198-
| Arm64EC | `vreg` | `d` | `d0` | `d` |
199-
| Arm64EC | `vreg` | `q` | `q0` | `q` |
200174

201175
# Flags covered by `preserves_flags`
202176

@@ -209,6 +183,3 @@ These flags registers must be restored upon exiting the asm block if the `preser
209183
- The condition code register `ccr`.
210184
- s390x
211185
- The condition code register `cc`.
212-
- Arm64EC
213-
- Condition flags (`NZCV` register).
214-
- 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)
Failed to load comments.