AMOSWAP.D
Atomic Swap Doubleword
AMOSWAP.D rd, rs2, (rs1)
Atomically swaps a 64-bit value in memory with a register.
Details
AMOSWAP.D atomically loads a doubleword, writes it to rd, and stores rs2 to that address (RV64 only).
Pseudocode Operation
temp = M[R[rs1]]; M[R[rs1]] = R[rs2]; R[rd] = temp;
Example
AMOSWAP.D x10, x11, (x12)
Encoding
Binary Layout
00001
31:27
aq
26
rl
25
rs2
24:20
rs1
19:15
011
14:12
rd
11:7
0101111
6:0
Operands
-
rd
Dest (Old Value) -
rs2
New Value -
rs1
Address