How do I tell whether AMOCAS.D succeeded?
After normal completion with nonzero rd, compare the returned old memory value with the expected value saved before execution: use rd on RV64, or the complete 64-bit rd/rd+1 value on RV32. Equality indicates that the swap store occurred.