Hi Sebastian, > Wilco pointed out in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105162#c7 > that > "Only __sync needs the extra full barrier, but __atomic does not." > The attached patch does that by adding out-of-line functions for > MEMMODEL_SYNC_*. > Those new functions contain a barrier on the path without LSE instructions.
Yes, adding _sync versions of the outline functions is the correct approach. However there is no need to have separate _acq/_rel/_seq variants for every function since all but one are _seq. Also we should ensure we generate the same sequence as the inlined versions so that they are consistent. This means ensuring the LDXR macro ignores the 'A' for the _sync variants and the swp function switches to acquire semantics. Cheers, Wilco