Skip to content

Commit 1dbeaf9

Browse files
committed
Clarify the evaluation order of asm! operands
1 parent f45ca4b commit 1dbeaf9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

text/0000-inline-asm.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ Several types of operands are supported:
429429
- The substituted string does not include any modifiers (e.g. GOT, PLT, relocations, etc).
430430
- `<path>` is allowed to point to a `#[thread_local]` static, in which case the asm code can combine the symbol with relocations (e.g. `@plt`, `@TPOFF`) to read from thread-local data.
431431

432+
Operand expressions are evaluated from left to right, just like function call arguments. After the `asm!` has executed, outputs are written to in left to right order. This is significant if two outputs point to the same place: that place will contain the value of the rightmost output.
433+
432434
## Register operands
433435

434436
Input and output operands can be specified either as an explicit register or as a register class from which the register allocator can select a register. Explicit registers are specified as string literals (e.g. `"eax"`) while register classes are specified as identifiers (e.g. `reg`). Using string literals for register names enables support for architectures that use special characters in register names, such as MIPS (`$0`, `$1`, etc).

0 commit comments

Comments
 (0)