@@ -732,11 +732,17 @@ Sign extension of 32-bit values on RV64 is not reflected in the interface.
732
732
733
733
This section lists operand constraints that can be used with inline assembly
734
734
statements, including both RISC-V specific and common operand constraints.
735
+ Operand constraints are case-sensitive.
736
+
737
+ "Floating-point register" in both the `f` and `cf` rows means "a register
738
+ suitable for passing a floating-point value", so when using the `Zfinx`,
739
+ `Zdinx`, or `Zhinxmin` extensions this will allocate an X register. This is done
740
+ to aid portability of floating-point code.
735
741
736
742
.Constraints on Operands of Inline Assembly Statements
737
743
[%autowidth]
738
744
|===
739
- |*Constraint* | |*Note*
745
+ |*Constraint* |*Description* |*Note*
740
746
|m |An address that is held in a general-purpose register with offset. |
741
747
|A |An address that is held in a general-purpose register. |
742
748
|r |General purpose register |
@@ -746,13 +752,25 @@ statements, including both RISC-V specific and common operand constraints.
746
752
|K |5-bit unsigned immediate integer operand |
747
753
|J |Zero integer immediate operand |
748
754
|s |symbol or label reference with a constant offset |
755
+ |cr |RVC general purpose register (`x8`-`x15`) |
756
+ |cf |RVC floating-point register (`f8`-`f15` or `x8-x15` with `Zfinx`) |
757
+ |R |Even-odd general purpose register pair |
749
758
|vr |Vector register |
750
759
|vd |Vector register, excluding v0 |
751
760
|vm |Vector register, only v0 |
752
761
|===
753
762
763
+ The `R` constraint should print as the even register in the pair, as this
764
+ matches how the `amocas.q` instruction (on RV64) or the `amocas.d` and `Zdinx`
765
+ instructions (on RV32) expect to parse their pair register operands. However,
766
+ both registers in the pair should be considered to be live or clobbered
767
+ together.
768
+
754
769
NOTE: Immediate value must be a compile-time constant.
755
770
771
+ NOTE: The `c*` constraints are designed to be extensible to more kinds of
772
+ RVC-compatible register constraints in the future.
773
+
756
774
=== The Difference Between `m` and `A` Constraints
757
775
758
776
The difference between `m` and `A` is whether the operand can have an offset;
@@ -809,6 +827,7 @@ statements, including both RISC-V specific and common operand modifiers.
809
827
|*Modifiers* |*Description* |*Note*
810
828
|z |Print `zero` (`x0`) register for immediate 0, typically used with constraints `J` |
811
829
|i |Print `i` if corresponding operand is immediate. |
830
+ |N |Print register encoding as integer (0-31). |
812
831
|===
813
832
814
833
[id=function-multi-version]
0 commit comments