This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/80878] -mcx16 (enable 128 bit CAS) on x86_64 seems not to work on 7.1.0
- From: "andysem at mail dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 29 Mar 2018 18:40:32 +0000
- Subject: [Bug target/80878] -mcx16 (enable 128 bit CAS) on x86_64 seems not to work on 7.1.0
- Auto-submitted: auto-generated
- References: <bug-80878-4@http.gcc.gnu.org/bugzilla/>
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.