AMOSWAP.W
Atomic Swap Word
AMOSWAP.W rd, rs2, (rs1)
Atomically swaps a value in memory with a register.
Details
AMOSWAP.W atomically loads a word from the address in rs1 into rd and stores the value of rs2 to that address.
Pseudocode Operation
temp = M[R[rs1]]; M[R[rs1]] = R[rs2]; R[rd] = temp;
Example
AMOSWAP.W x10, x11, (x12)
Encoding
Binary Layout
00001
31:27
aq
26
rl
25
rs2
24:20
rs1
19:15
010
14:12
rd
11:7
0101111
6:0
Operands
-
rd
Dest (Old Value) -
rs2
New Value -
rs1
Address