https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103069
--- Comment #11 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> --- For the case with atomic_compare_exchange_weak_release, it can be expanded as loop: mov %eax,%r8d and $0xfff80000,%r8d mov (%r8),%rsi <--- load lock first cmp %rsi,%rax <--- compare with expected input jne .L2 <--- lock ne expected lock cmpxchg %r8d,(%rdi) mov %rsi,%rax <--- perform the behavior of failed cmpxchg jne loop But this is not suitable for atomic_compare_exchange_strong, as the document said Unlike atomic_compare_exchange_weak, this strong version is required to always return true when expected indeed compares equal to the contained object, not allowing spurious failures. If we expand cmpxchg as above, it would result in spurious failure since the load is not atomic. So for do pd->nextevent = __nptl_last_event; while (atomic_compare_and_exchange_bool_acq (&__nptl_last_event, pd, pd->nextevent)); who invokes atomic_compare_exchange_strong we may not simply adjust the expander. It is better to know the call is in loop condition and relax it accordingly.