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
The macro will initially be supported only on ARM, AArch64, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
377
+
The macro will initially be supported only on ARM, AArch64, Hexagon, x86, x86-64 and RISC-V targets. Support for more targets may be added in the future. The compiler will emit an error if `asm!` is used on an unsupported target.
@@ -386,7 +386,7 @@ As with format strings, named arguments must appear after positional arguments.
386
386
387
387
The exact assembly code syntax is target-specific and opaque to the compiler except for the way operands are substituted into the template string to form the code passed to the assembler.
388
388
389
-
The 4 targets specified in this RFC (x86, ARM, AArch64, RISC-V) all use the assembly code syntax of the GNU assembler (GAS). On x86, the `.intel_syntax noprefix` mode of GAS is used by default. On ARM, the `.syntax unified` mode is used. These targets impose an additional restriction on the assembly code: any assembler state (e.g. the current section which can be changed with `.section`) must be restored to its original value at the end of the asm string. Assembly code that does not conform to the GAS syntax will result in assembler-specific behavior.
389
+
The 5 targets specified in this RFC (x86, ARM, AArch64, RISC-V, Hexagon) all use the assembly code syntax of the GNU assembler (GAS). On x86, the `.intel_syntax noprefix` mode of GAS is used by default. On ARM, the `.syntax unified` mode is used. These targets impose an additional restriction on the assembly code: any assembler state (e.g. the current section which can be changed with `.section`) must be restored to its original value at the end of the asm string. Assembly code that does not conform to the GAS syntax will result in assembler-specific behavior.
> **Note**: On x86 we treat `reg_byte` differently from `reg` because the compiler can allocate `al` and `ah` separately whereas `reg` reserves the whole register.
478
479
>
@@ -507,6 +508,7 @@ Each register class has constraints on which value types they can be used with.
> **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).
512
514
@@ -563,13 +565,16 @@ Some registers have multiple names. These are all treated by the compiler as ide
563
565
| RISC-V |`f[10-17]`|`fa[0-7]`|
564
566
| RISC-V |`f[18-27]`|`fs[2-11]`|
565
567
| RISC-V |`f[28-31]`|`ft[8-11]`|
568
+
| Hexagon |`r29`|`sp`|
569
+
| Hexagon |`r30`|`fr`|
570
+
| Hexagon |`r31`|`lr`|
566
571
567
572
Some registers cannot be used for input or output operands:
568
573
569
574
| Architecture | Unsupported register | Reason |
570
575
| ------------ | -------------------- | ------ |
571
576
| All |`sp`| The stack pointer must be restored to its original value at the end of an asm code block. |
572
-
| All |`bp` (x86), `r11` (ARM), `x29` (AArch64), `x8` (RISC-V) | The frame pointer cannot be used as an input or output. |
577
+
| All |`bp` (x86), `r11` (ARM), `x29` (AArch64), `x8` (RISC-V), `fr` (Hexagon)| The frame pointer cannot be used as an input or output. |
573
578
| x86 |`k0`| This is a constant zero register which can't be modified. |
574
579
| x86 |`ip`| This is the program counter, not a real register. |
575
580
| x86 |`mm[0-7]`| MMX registers are not currently supported (but may be in the future). |
@@ -578,6 +583,7 @@ Some registers cannot be used for input or output operands:
578
583
| ARM |`pc`| This is the program counter, not a real register. |
579
584
| RISC-V |`x0`| This is a constant zero register which can't be modified. |
580
585
| RISC-V |`gp`, `tp`| These registers are reserved and cannot be used as inputs or outputs. |
586
+
| Hexagon |`lr`| This is the link register which cannot be used as an input or output. |
581
587
582
588
## Template modifiers
583
589
@@ -623,6 +629,7 @@ The supported modifiers are a subset of LLVM's (and GCC's) [asm template argumen
623
629
| NVPTX |`reg64`| None |`rd0`| None |
624
630
| RISC-V |`reg`| None |`x1`| None |
625
631
| RISC-V |`freg`| None |`f0`| None |
632
+
| Hexagon |`reg`| None |`r0`| None |
626
633
627
634
> Notes:
628
635
> - on ARM `e` / `f`: this prints the low or high doubleword register name of a NEON quad (128-bit) register.
0 commit comments