Does LR.D write memory?
No. LR.D reads the old 64-bit value into rd and creates a reservation set; a later SC.D attempts the memory write.
On RV64, atomically read a 64-bit doubleword into rd and create a reservation set for a later SC.D
LR.D atomically reads a 64-bit doubleword from the naturally aligned address in rs1, writes the old value to rd, and creates a reservation set covering the accessed bytes. It is an RV64 A/Zalrsc instruction and does not write memory; a later SC.D uses the reservation to decide whether the conditional store succeeds. aq/rl bits affect memory ordering only and do not change the loaded value.
Shows A-extension doubleword atomic field decode, aq/rl ordering bits, memory read, and RMW state update.
A-extension doubleword atomic instructions use a 32-bit encoding; the animation starts by splitting the fields.
This animation shows ISA-visible atomic read-modify-write, compare-and-swap, LR/SC reservation state, and ordering bits, not any specific CPU cache-coherence implementation, pipeline, or timing.
LR.D is the 64-bit first step of an RV64 LR/SC sequence: it reads the old doubleword into rd and creates a reservation set. It does not write memory and is not just an ordinary ld, because a later SC.D consumes the reservation.
Understand this scenario with real code like «lr.d.aq t0, (a0) # load 64-bit doubleword from *a0 and create a reservation».
Understand this scenario with real code like «lr.d.aq t0, (a0) # load 64-bit doubleword from *a0 and create a reservation».
No. LR.D reads the old 64-bit value into rd and creates a reservation set; a later SC.D attempts the memory write.
LR.D is RV64-only, accesses a 64-bit doubleword, and requires 8-byte alignment; LR.W accesses a 32-bit word.