https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107676
--- Comment #6 from Hongyu Wang <wwwhhhyyy333 at gmail dot com> --- (In reply to Andrew Pinski from comment #5) > (In reply to Jonathan Wakely from comment #4) > > I don't think __atomic_compare_exchange emits such a loop. This is about > > __atomic_fetch_xor and friends, which do emit cmpxchg loops. But there are > > four such functions to name. > > Oh yes right. > Then this: > For compare and exchange loops that are emitted by some __atomic_* builtins > (e.g. ....), emit an atomic load before the loop and if the value was not > the expected value, emit a pause instruction. This might reduce execussive > cache bouncing of the memory. > > > I think that is better wording than it was before. I hope the person who > added this option can take over this to get it closer to what it should be. Thanks for all the suggestions, a patch has been posted at https://gcc.gnu.org/pipermail/gcc-patches/2022-November/606212.html