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

Niall Douglas <s_gccbugzilla at nedprod dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |s_gccbugzilla at nedprod dot 
com

--- Comment #30 from Niall Douglas <s_gccbugzilla at nedprod dot com> ---
I got bit by this GCC regression today at work. Consider
https://godbolt.org/z/M9fd7nhdh where std::atomic<__int128> is compare
exchanged with -march=sandybridge:

- On GCC 6.4 and earlier, this emits lock cmpxchg16b, as you would expect.

- From GCC 7 up to trunk (12?), this emits __atomic_compare_exchange_16.

- On clang, this emits lock cmpxchg16b, as you would expect.

This is clearly a regression. GCCs before 7 did the right thing. GCCs from 7
onwards do not. clangs with libstdc++ do do the right thing.

This isn't just an x64 thing, either. Consider https://godbolt.org/z/x6d5GE4o6
where GCC on ARM64 emits __atomic_compare_exchange_16, whereas clang on ARM64
emits ldaxp/stlxp, as you would expect.

Please mark this bug as a regression affecting all versions of GCC from 7 to
trunk, and affecting all 128 bit atomic capable architectures not just x64.

Reply via email to