Does AMOXOR.W place the new memory result in rd?
No. AMOXOR.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 XOR: rd returns the old memory word, while memory receives the 32-bit result of oldWord ^ rs2LowWord
AMOXOR.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-XORs 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 XOR 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.
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.
AMOXOR.W is used for atomic bit toggling. The value returned in rd is always the old memory word; the new 32-bit word after the bitwise XOR operation is written only to memory.
Understand this scenario with real code like «amoxor.w a0, a1, (a2) # a0 = old *a2; *a2 = old ^ a1».
Understand this scenario with real code like «amoxor.w a0, a1, (a2) # a0 = old *a2; *a2 = old ^ a1».
No. AMOXOR.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.