Does AMOMAX.W place the new memory result in rd?
No. AMOMAX.W places the old memory word before the operation in rd; the result of signed max(oldWord, rs2LowWord) is written back to memory.
Atomic 32-bit word signed maximum: rd returns the old memory word, while memory receives the 32-bit result of signed max(oldWord, rs2LowWord)
AMOMAX.W performs an atomic read-modify-write on the 32-bit word addressed by rs1: it first reads the old memory word and sign-extends it into rd, then compares the old word and the low 32 bits of rs2 as signed 32-bit values and writes back the larger word. The resulting 32-bit word is written back to the same address. aq/rl bits affect memory ordering only; they do not change the signed maximum data result.
Shows A-extension word atomic field decode, aq/rl ordering bits, memory read, and RMW state update.
A-extension word atomic instructions use a 32-bit encoding; the animation starts by splitting the fields.
AMOMAX.W selects the memory writeback word using a signed 32-bit comparison; this is not a per-bit logical operation.
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.
AMOMAX.W is used for atomic signed maximum updates. The value returned in rd is always the old memory word; the new 32-bit word after the signed maximum operation is written only to memory.
Understand this scenario with real code like «amomax.w a0, a1, (a2) # a0 = old *a2; *a2 = signed max(old, a1)».
Understand this scenario with real code like «amomax.w a0, a1, (a2) # a0 = old *a2; *a2 = signed max(old, a1)».
No. AMOMAX.W places the old memory word before the operation in rd; the result of signed max(oldWord, rs2LowWord) is written back to memory.
No. aq/rl only affect memory-ordering constraints; they do not change this AMO.W instruction's 32-bit data result.