In the discussion about #63384 we agreed that it would be best if atomic compare-and-swap applied a memory barrier even if the comparison fails. That avoids potential race conditions such as the one described in that issue.
Based on my own inspection, the arm and mips implementation of compare-and-swap do not implement the expected memory barrier. The arm64 and mips64 implementations look OK.
CC @golang/arm @golang/mips @golang/runtime