[Bug target/107456] std::atomic::fetch_xxx generate LOCK CMPXCHG instead of simpler LOCK instructions

thiago at kde dot org gcc-bugzilla@gcc.gnu.org
Mon Oct 31 18:59:01 GMT 2022


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

Thiago Macieira <thiago at kde dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thiago at kde dot org

--- Comment #3 from Thiago Macieira <thiago at kde dot org> ---
(In reply to Andrew Pinski from comment #1)
> I was going to say the exact same comment as on LLVM bug report:
> https://github.com/llvm/llvm-project/issues/58685#issuecomment-1295829030
> 
> There is no way atomically fetch and add without xadd.
> 
> There is no "x"and/"x"or  instruction on x86 (note the x here stands for
> exchange rather than exclusive as there is an xor but that is an "exclusive
> or").

With the Remote Atomic Operations (RAO) of AAND, AOR and AXOR, we can do
something.


More information about the Gcc-bugs mailing list