gatomic: Use new _atomic*() intrinsics for all atomic operations
Previously we used the old __sync_fetch_*() intrinsics for some of the
atomic operations, such as g_atomic_int_compare_and_exchange(). When
available, use the new __atomic_*() intrinsics for those instead.
As with the rest of our use of __atomic_*() intrinsics, we use the
__ATOMIC_SEQ_CST memory model. If people want to use a less
restrictive memory model to get better performance in certain
situations, they can use the compiler intrinsics directly themselves.
g_atomic_*() aim to be as fast as possible while remaining general
purpose.
Tested using:
meson test --repeat 1000 atomic atomic-test
Signed-off-by: Philip Withnall withnall@endlessm.com
Fixes: #1750 (closed)
Edited by Philip Withnall