How do I tell whether AMOCAS.W succeeded?
After normal completion with nonzero rd, compare the low 32 bits of the value returned in rd with the low 32 bits of the expected value saved before execution; equality indicates that the swap store occurred. On RV64, the returned word is sign-extended in rd.