[Bug target/80878] -mcx16 (enable 128 bit CAS) on x86_64 seems not to work on 7.1.0

andysem at mail dot ru gcc-bugzilla@gcc.gnu.org
Thu Mar 29 18:40:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878

--- Comment #17 from andysem at mail dot ru ---
I'll clarify why I think load() should be allowed to issue writes on the
memory. According to [atomics.types.operations]/18 in N4713,
compare_exchange_*() is a load operation if the comparison fails, yet we know
cmpxchg (even the ones more narrow than cmpxchg16b) always writes, so we must
assume a load operation may write. I do not find a definition of a "load
operation" in the standard and [atomics.types.operations]/12 and 13 avoid this
term, saying that load() "Atomically returns the value pointed to by this."
Again, it doesn't say anything about writes to the memory.

So, if compare_exchange_*() is allowed to write on failure, why load()
shouldn't be? Either compare_exchange_*() issuing writes is a bug (in which
case a lock-free CAS can't be implemented on x86 at all) or writes in load()
should be allowed and the change wrt. cmpxchg16b should be reverted.


More information about the Gcc-bugs mailing list