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
 
Format R-Type (Atomic)
Opcode 0x1800302F
Extension A

Operands

  • rd
    Dest (0=Success)
  • rs2
    Source Value
  • rs1
    Address

Example

SC.D x10, x11, (x12)

// 64-bit conditional store.

Related

More in A

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; }