__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined on aarch64

Alexander Monakov amonakov@ispras.ru
Thu Jun 29 09:40:00 GMT 2017


On Thu, 29 Jun 2017, Andrew Haley wrote:
> I think I now properly understand Richard Earnshaw's point: that we
> *do* support a full set of atomic primitives for 16-byte types via
> libatomic, but for them to work as a sequentially-consistent set we
> must use the same locking scheme for all of them.  It's ugly, and
> horrible for anyone who simply wants a double-word CAS, but it is what
> it is.  We can't use LDXP because it isn't atomic on its own, and the
> ARM manual is quite explicit about this.  Anyone who wants to use
> a real compare-and-swap-16 is on their own.

Note that there's no 'atomic read' primitive among __sync builtins, so
IMO it gives a way out: expose native doubleword cas via __sync_compare_and_swap,
use a locking scheme for its __atomic counterpart.

Alexander



More information about the Gcc-help mailing list