You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> - On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
@@ -223,6 +226,8 @@ The availability of supported types for a particular register class may depend o
> **Note**: For the purposes of the above table pointers, function pointers and `isize`/`usize` are treated as the equivalent integer type (`i16`/`i32`/`i64` depending on the target).
228
233
@@ -284,22 +289,37 @@ Here is the list of all supported register aliases:
284
289
| RISC-V |`f[10-17]`|`fa[0-7]`|
285
290
| RISC-V |`f[18-27]`|`fs[2-11]`|
286
291
| RISC-V |`f[28-31]`|`ft[8-11]`|
292
+
| LoongArch |`$r0`|`$zero`|
293
+
| LoongArch |`$r1`|`$ra`|
294
+
| LoongArch |`$r2`|`$tp`|
295
+
| LoongArch |`$r3`|`$sp`|
296
+
| LoongArch |`$r[4-11]`|`$a[0-7]`|
297
+
| LoongArch |`$r[12-20]`|`$t[0-8]`|
298
+
| LoongArch |`$r21`||
299
+
| LoongArch |`$r22`|`$fp`, `$s9`|
300
+
| LoongArch |`$r[23-31]`|`$s[0-8]`|
301
+
| LoongArch |`$f[0-7]`|`$fa[0-7]`|
302
+
| LoongArch |`$f[8-23]`|`$ft[0-15]`|
303
+
| LoongArch |`$f[24-31]`|`$fs[0-7]`|
287
304
288
305
Some registers cannot be used for input or output operands:
289
306
290
307
| Architecture | Unsupported register | Reason |
291
308
| ------------ | -------------------- | ------ |
292
309
| All |`sp`| The stack pointer must be restored to its original value at the end of an asm code block. |
293
-
| All |`bp` (x86), `x29` (AArch64), `x8` (RISC-V) | The frame pointer cannot be used as an input or output. |
310
+
| All |`bp` (x86), `x29` (AArch64), `x8` (RISC-V), `$fp` (LoongArch)| The frame pointer cannot be used as an input or output. |
294
311
| 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. |
295
-
| All |`si` (x86-32), `bx` (x86-64), `r6` (ARM), `x19` (AArch64), `x9` (RISC-V) | This is used internally by LLVM as a "base pointer" for functions with complex stack frames. |
312
+
| 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. |
296
313
| x86 |`ip`| This is the program counter, not a real register. |
297
314
| AArch64 |`xzr`| This is a constant zero register which can't be modified. |
298
315
| AArch64 |`x18`| This is an OS-reserved register on some AArch64 targets. |
299
316
| ARM |`pc`| This is the program counter, not a real register. |
300
317
| ARM |`r9`| This is an OS-reserved register on some ARM targets. |
301
318
| RISC-V |`x0`| This is a constant zero register which can't be modified. |
302
319
| RISC-V |`gp`, `tp`| These registers are reserved and cannot be used as inputs or outputs. |
320
+
| LoongArch |`$r0` or `$zero`| This is a constant zero register which can't be modified. |
321
+
| LoongArch |`$r2` or `$tp`| This is reserved for TLS. |
322
+
| LoongArch |`$r21`| This is reserved by the ABI. |
303
323
304
324
The frame pointer and base pointer registers are reserved for internal use by LLVM. While `asm!` statements cannot explicitly specify the use of reserved registers, in some cases LLVM will allocate one of these reserved registers for `reg` operands. Assembly code making use of reserved registers should be careful since `reg` operands may use the same registers.
305
325
@@ -346,6 +366,8 @@ The supported modifiers are a subset of LLVM's (and GCC's) [asm template argumen
346
366
| ARM |`qreg`|`e` / `f`|`d0` / `d1`|`e` / `f`|
347
367
| RISC-V |`reg`| None |`x1`| None |
348
368
| RISC-V |`freg`| None |`f0`| None |
369
+
| LoongArch |`reg`| None |`$r1`| None |
370
+
| LoongArch |`freg`| None |`$f0`| None |
349
371
350
372
> **Notes**:
351
373
> - on ARM `e` / `f`: this prints the low or high doubleword register name of a NEON quad (128-bit) register.
@@ -379,6 +401,7 @@ The following ABIs can be used with `clobber_abi`:
> - On AArch64 `x18` only included in the clobber list if it is not considered as a reserved register on the target.
@@ -466,6 +489,8 @@ To avoid undefined behavior, these rules must be followed when using function-sc
466
489
- RISC-V
467
490
- Floating-point exception flags in `fcsr` (`fflags`).
468
491
- Vector extension state (`vtype`, `vl`, `vcsr`).
492
+
- LoongArch
493
+
- Floating-point condition flags in `$fcc[0-7]`.
469
494
- On x86, the direction flag (DF in `EFLAGS`) is clear on entry to an asm block and must be clear on exit.
470
495
- Behavior is undefined if the direction flag is set on exiting an asm block.
471
496
- 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)") _, ...`.
0 commit comments