Skip to content

Commit bc0bf3a

Browse files
committed
mure requires readonly or nomem
1 parent fae136c commit bc0bf3a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/inline-assembly.md

+1
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ Flags are used to further influence the behavior of the inline assembly block.
414414
Currently the following options are defined:
415415
- `pure`: The `asm!` block has no side effects, and its outputs depend only on its direct inputs (i.e. the values themselves, not what they point to) or values read from memory (unless the `nomem` options is also set).
416416
This allows the compiler to execute the `asm!` block fewer times than specified in the program (e.g. by hoisting it out of a loop) or even eliminate it entirely if the outputs are not used.
417+
When `pure` is specified, then either `nomem` or `readonly` must also be present.
417418
- `nomem`: The `asm!` blocks does not read or write to any memory.
418419
This allows the compiler to cache the values of modified global variables in registers across the `asm!` block since it knows that they are not read or written to by the `asm!`.
419420
The compiler also assumes that this `asm!` block does not perform any kind of synchronization with other threads, e.g. via fences.

0 commit comments

Comments
 (0)