SC.D
Store Conditional Doubleword
SC.D rd, rs2, (rs1)
Conditionally stores a 64-bit value to memory if the reservation is valid.
Encoding
Binary Layout
00011
31:27
aq
26
rl
25
rs2
24:20
rs1
19:15
011
14:12
rd
11:7
0101111
6:0
Operands
-
rd
Dest (0=Success) -
rs2
Source Value -
rs1
Address
Example
SC.D x10, x11, (x12)
// 64-bit conditional store.
Related
More in A
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
SC.D conditionally stores the doubleword in rs2 to the address in rs1, only if the reservation set by LR.D is still valid (RV64 only). It writes 0 to rd on success and a non-zero value on failure.
Operation
if (ReservationValid) { M[R[rs1]] = R[rs2]; R[rd] = 0; } else { R[rd] = 1; }