Commit 2cacf71
authored
[ARM] Improve comment on the 'J' inline asm modifier. (#160712)
An inline asm constraint "Jr", in AArch32, means that if the input value
is a compile-time constant in the range -4095 to +4095, then it can be
inserted into the assembly language as an immediate operand, and
otherwise it will be placed in a register.
The comment in the Arm backend said "It is not clear what this
constraint is intended for". I believe the answer is that that range of
immediate values are the ones you can use in a LDR or STR instruction.
So it's suitable for cases like this:
asm("str %0,[%1,%2]" : : "r"(data), "r"(base), "Jr"(offset) : "memory");
in the same way that the "Ir" constraint is suitable for the immediate
in a data-processing instruction such as ADD or EOR.1 parent 368d599 commit 2cacf71
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20428 | 20428 | | |
20429 | 20429 | | |
20430 | 20430 | | |
20431 | | - | |
20432 | | - | |
20433 | | - | |
| 20431 | + | |
| 20432 | + | |
| 20433 | + | |
20434 | 20434 | | |
20435 | 20435 | | |
20436 | 20436 | | |
| |||
0 commit comments