Skip to content

Commit d9f8814

Browse files
committed
Add Arm64EC to inline-assembly documentation
1 parent 7ce3563 commit d9f8814

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

src/inline-assembly.md

+32-14
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ r[asm.stable-targets]
1313
Support for inline assembly is stable on the following architectures:
1414
- x86 and x86-64
1515
- ARM
16-
- AArch64
16+
- AArch64 and Arm64EC
1717
- RISC-V
1818
- LoongArch
1919

@@ -234,6 +234,9 @@ Here is the list of currently supported register classes:
234234
| AArch64 | `vreg` | `v[0-31]` | `w` |
235235
| AArch64 | `vreg_low16` | `v[0-15]` | `x` |
236236
| AArch64 | `preg` | `p[0-15]`, `ffr` | Only clobbers |
237+
| Arm64EC | `reg` | `x[0-12]`, `x[15-22]`, `x[25-27]`, `x30` | `r` |
238+
| Arm64EC | `vreg` | `v[0-15]` | `w` |
239+
| Arm64EC | `vreg_low16` | `v[0-15]` | `x` |
237240
| ARM (ARM/Thumb2) | `reg` | `r[0-12]`, `r14` | `r` |
238241
| ARM (Thumb1) | `reg` | `r[0-7]` | `r` |
239242
| ARM | `sreg` | `s[0-31]` | `t` |
@@ -277,6 +280,8 @@ The availability of supported types for a particular register class may depend o
277280
| AArch64 | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
278281
| AArch64 | `vreg` | `neon` | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
279282
| AArch64 | `preg` | N/A | Only clobbers |
283+
| Arm64EC | `reg` | None | `i8`, `i16`, `i32`, `f32`, `i64`, `f64` |
284+
| Arm64EC | `vreg` | `neon` | `i8`, `i16`, `i32`, `f32`, `i64`, `f64`, <br> `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2`, `f64x1`, <br> `i8x16`, `i16x8`, `i32x4`, `i64x2`, `f32x4`, `f64x2` |
280285
| ARM | `reg` | None | `i8`, `i16`, `i32`, `f32` |
281286
| ARM | `sreg` | `vfp2` | `i32`, `f32` |
282287
| ARM | `dreg` | `vfp2` | `i64`, `f64`, `i8x8`, `i16x4`, `i32x2`, `i64x1`, `f32x2` |
@@ -329,6 +334,12 @@ Here is the list of all supported register aliases:
329334
| AArch64 | `sp` | `wsp` |
330335
| AArch64 | `xzr` | `wzr` |
331336
| AArch64 | `v[0-31]` | `b[0-31]`, `h[0-31]`, `s[0-31]`, `d[0-31]`, `q[0-31]` |
337+
| Arm64EC | `x[0-30]` | `w[0-30]` |
338+
| Arm64EC | `x29` | `fp` |
339+
| Arm64EC | `x30` | `lr` |
340+
| Arm64EC | `sp` | `wsp` |
341+
| Arm64EC | `xzr` | `wzr` |
342+
| Arm64EC | `v[0-15]` | `b[0-15]`, `h[0-15]`, `s[0-15]`, `d[0-15]`, `q[0-15]` |
332343
| ARM | `r[0-3]` | `a[1-4]` |
333344
| ARM | `r[4-9]` | `v[1-6]` |
334345
| ARM | `r9` | `rfp` |
@@ -373,12 +384,15 @@ Some registers cannot be used for input or output operands:
373384
| Architecture | Unsupported register | Reason |
374385
| ------------ | -------------------- | ------ |
375386
| All | `sp` | The stack pointer must be restored to its original value at the end of an asm code block. |
376-
| All | `bp` (x86), `x29` (AArch64), `x8` (RISC-V), `$fp` (LoongArch) | The frame pointer cannot be used as an input or output. |
387+
| All | `bp` (x86), `x29` (AArch64 and Arm64EC), `x8` (RISC-V), `$fp` (LoongArch) | The frame pointer cannot be used as an input or output. |
377388
| ARM | `r7` or `r11` | On ARM the frame pointer can be either `r7` or `r11` depending on the target. The frame pointer cannot be used as an input or output. |
378-
| All | `si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64), `x9` (RISC-V), `$s8` (LoongArch) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
389+
| All | `si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64 and Arm64EC), `x9` (RISC-V), `$s8` (LoongArch) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
379390
| x86 | `ip` | This is the program counter, not a real register. |
380391
| AArch64 | `xzr` | This is a constant zero register which can't be modified. |
381392
| AArch64 | `x18` | This is an OS-reserved register on some AArch64 targets. |
393+
| Arm64EC | `xzr` | This is a constant zero register which can't be modified. |
394+
| Arm64EC | `x18` | This is an OS-reserved register. |
395+
| Arm64EC | `x13`, `x14`, `x23`, `x24`, `x28`, `v[16-31]`, `p[0-15]`, `ffr` | These are AArch64 registers that are not supported for Arm64EC. |
382396
| ARM | `pc` | This is the program counter, not a real register. |
383397
| ARM | `r9` | This is an OS-reserved register on some ARM targets. |
384398
| RISC-V | `x0` | This is a constant zero register which can't be modified. |
@@ -422,16 +436,16 @@ The supported modifiers are a subset of LLVM's (and GCC's) [asm template argumen
422436
| x86 | `*mm_reg` | `y` | `ymm0` | `t` |
423437
| x86 | `*mm_reg` | `z` | `zmm0` | `g` |
424438
| x86 | `kreg` | None | `k1` | None |
425-
| AArch64 | `reg` | None | `x0` | `x` |
426-
| AArch64 | `reg` | `w` | `w0` | `w` |
427-
| AArch64 | `reg` | `x` | `x0` | `x` |
428-
| AArch64 | `vreg` | None | `v0` | None |
429-
| AArch64 | `vreg` | `v` | `v0` | None |
430-
| AArch64 | `vreg` | `b` | `b0` | `b` |
431-
| AArch64 | `vreg` | `h` | `h0` | `h` |
432-
| AArch64 | `vreg` | `s` | `s0` | `s` |
433-
| AArch64 | `vreg` | `d` | `d0` | `d` |
434-
| AArch64 | `vreg` | `q` | `q0` | `q` |
439+
| AArch64/Arm64EC | `reg` | None | `x0` | `x` |
440+
| AArch64/Arm64EC | `reg` | `w` | `w0` | `w` |
441+
| AArch64/Arm64EC | `reg` | `x` | `x0` | `x` |
442+
| AArch64/Arm64EC | `vreg` | None | `v0` | None |
443+
| AArch64/Arm64EC | `vreg` | `v` | `v0` | None |
444+
| AArch64/Arm64EC | `vreg` | `b` | `b0` | `b` |
445+
| AArch64/Arm64EC | `vreg` | `h` | `h0` | `h` |
446+
| AArch64/Arm64EC | `vreg` | `s` | `s0` | `s` |
447+
| AArch64/Arm64EC | `vreg` | `d` | `d0` | `d` |
448+
| AArch64/Arm64EC | `vreg` | `q` | `q0` | `q` |
435449
| ARM | `reg` | None | `r0` | None |
436450
| ARM | `sreg` | None | `s0` | None |
437451
| ARM | `dreg` | None | `d0` | `P` |
@@ -482,6 +496,7 @@ The following ABIs can be used with `clobber_abi`:
482496
| x86-64 | `"C"`, `"system"` (on Windows), `"efiapi"`, `"win64"` | `ax`, `cx`, `dx`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[0-7]`, `st([0-7])`, `tmm[0-7]` |
483497
| x86-64 | `"C"`, `"system"` (on non-Windows), `"sysv64"` | `ax`, `cx`, `dx`, `si`, `di`, `r[8-11]`, `xmm[0-31]`, `mm[0-7]`, `k[0-7]`, `st([0-7])`, `tmm[0-7]` |
484498
| AArch64 | `"C"`, `"system"`, `"efiapi"` | `x[0-17]`, `x18`\*, `x30`, `v[0-31]`, `p[0-15]`, `ffr` |
499+
| Arm64EC | `"C"`, `"system"` | `x[0-12]`, `x[15-17]`, `x30`, `v[0-15]` |
485500
| ARM | `"C"`, `"system"`, `"efiapi"`, `"aapcs"` | `r[0-3]`, `r12`, `r14`, `s[0-15]`, `d[0-7]`, `d[16-31]` |
486501
| RISC-V | `"C"`, `"system"`, `"efiapi"` | `x1`, `x[5-7]`, `x[10-17]`, `x[28-31]`, `f[0-7]`, `f[10-17]`, `f[28-31]`, `v[0-31]` |
487502
| LoongArch | `"C"`, `"system"` | `$r1`, `$r[4-20]`, `$f[0-23]` |
@@ -616,7 +631,7 @@ r[asm.rules.preserved-registers]
616631
- Condition flags in `FPSCR` (N, Z, C, V)
617632
- Saturation flag in `FPSCR` (QC)
618633
- Floating-point exception flags in `FPSCR` (IDC, IXC, UFC, OFC, DZC, IOC).
619-
- AArch64
634+
- AArch64 and Arm64EC
620635
- Condition flags (`NZCV` register).
621636
- Floating-point status (`FPSR` register).
622637
- RISC-V
@@ -633,6 +648,9 @@ r[asm.rules.x86-x87]
633648
- On x86, the x87 floating-point register stack must remain unchanged unless all of the `st([0-7])` registers have been marked as clobbered with `out("st(0)") _, out("st(1)") _, ...`.
634649
- If all x87 registers are clobbered then the x87 register stack is guaranteed to be empty upon entering an `asm` block. Assembly code must ensure that the x87 register stack is also empty when exiting the asm block.
635650

651+
r[asm.rules.arm64ec]
652+
- On arm64ec, [call checkers with appropriate thunks](https://learn.microsoft.com/en-us/windows/arm/arm64ec-abi#authoring-arm64ec-in-assembly) are mandatory when calling functions.
653+
636654
r[asm.rules.only-on-exit]
637655
- The requirement of restoring the stack pointer and non-output registers to their original value only applies when exiting an `asm!` block.
638656
- This means that `asm!` blocks that never return (even if not marked `noreturn`) don't need to preserve these registers.

0 commit comments

Comments
 (0)