https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110061
Xi Ruoyao <xry111 at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xry111 at gcc dot gnu.org --- Comment #8 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Wilco from comment #7) > I don't see the issue you have here. GCC for x86/x86_64 has been using > compare exchange for atomic load (which always does a write even if the > compare fails) for many years. No we don't, since r7-6454. > The question is, do you believe compilers should provide users with fast and > efficient atomics they need? Or do you want to force every application to > implement their own version of 128-bit atomics? But a compiler must generate correct code first. They can use the wonderful inline assembly because they know CAS is safe in their case, but the compiler does not know.