Does AMOAND.W place the new memory result in rd?
No. AMOAND.W places the old memory word before the operation in rd; the result of oldWord & rs2LowWord is written back to memory.
Atomic 32-bit word bitwise AND: rd returns the old memory word, while memory receives the 32-bit result of oldWord & rs2LowWord
AMOAND.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 bitwise-ANDs the old word with the low 32 bits of rs2. The resulting 32-bit word is written back to the same address. aq/rl bits affect memory ordering only; they do not change the bitwise AND data result.
Shows A / Zaamo word atomic field decode, aq/rl ordering bits, a memory read, and RMW state update.
A / Zaamo-extension word 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.
AMOAND.W is used for atomic bit clearing or masked updates. On a successful access with rd other than x0, rd receives the sign-extended old memory word; the new 32-bit word after the bitwise AND operation is written only to memory.
Successful 32-bit access example: a2=0x1000, old memory=5, a1=3; amoand.w a0, a1, (a2) returns a0=5 and updates memory to 1. The address is naturally aligned and the region supports this AMO.
Successful 32-bit access example: a2=0x1000, old memory=5, a1=3; amoand.w a0, a1, (a2) returns a0=5 and updates memory to 1. The address is naturally aligned and the region supports this AMO.
No. AMOAND.W places the old memory word before the operation in rd; the result of 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.