https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80878
Yongwei Wu <wuyongwei at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wuyongwei at gmail dot com --- Comment #27 from Yongwei Wu <wuyongwei at gmail dot com> --- Anyone can show a valid use case for a non-lock-free version of 128-bit atomic_compare_exchange? I am trying to use it in a data structure intended to be lock-free. I am surprised to find that the C++ std::atomic::compare_exchange_weak does not result in lock-free code for a 128-bit struct intended for ABA-free CAS. As a result, the GCC-generated code is MUCH slower than the mutex-based version in my 8-thread contention test, defeating all its valid purposes. I am talking about a 10x difference. And the Clang-generated code is more than 200x faster in the same test. Friends, being 200x worse in an important use case (lock-free, ABA-free data structures like queues and lists) is not funny at all.