Skip to content

Commit 3c32dce

Browse files
committed
fixup! Inline Asm Constraints and Modifiers
1 parent 45f02d4 commit 3c32dce

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/c-api.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,11 @@ Sign extension of 32-bit values on RV64 is not reflected in the interface.
733733
This section lists operand constraints that can be used with inline assembly
734734
statements, including both RISC-V specific and common operand constraints.
735735

736+
"Floating-point register" in both the `f` and `cf` rows means "a register
737+
suitable for passing a floating-point value", so when using the `Zfinx`,
738+
`Zdinx`, or `Zhinxmin` extensions this will allocate an X register. This is done
739+
to aid portability of floating-point code.
740+
736741
.Constraints on Operands of Inline Assembly Statements
737742
[%autowidth]
738743
|===
@@ -747,13 +752,19 @@ statements, including both RISC-V specific and common operand constraints.
747752
|J |Zero integer immediate operand |
748753
|s |symbol or label reference with a constant offset |
749754
|cr |RVC general purpose register (`x8`-`x15`) |
750-
|cf |RVC floating point register (`f8`-`f15`) |
755+
|cf |RVC floating-point register (`f8`-`f15`) |
751756
|Pr |Even-odd general purpose register pair |
752757
|vr |Vector register |
753758
|vd |Vector register, excluding v0 |
754759
|vm |Vector register, only v0 |
755760
|===
756761

762+
The `Pr` constraint should print as the even register in the pair, as this
763+
matches how the `amocas.q` instruction (on RV64) or the `amocas.d` and `Zdinx`
764+
instructions (on RV32) expect to parse their pair register operands. However,
765+
both registers in the pair should be considered to be live or clobbered
766+
together.
767+
757768
NOTE: Immediate value must be a compile-time constant.
758769

759770
NOTE: The `c*` and `P*` constraints are designed to be extensible to more kinds of registers in the future.

0 commit comments

Comments
 (0)