util/u_atomic: add p_atomic_xchg

The closest to it in the old-style gcc builtins is __sync_lock_test_and_set,
however, that is only guaranteed to work with values 0 and 1 and only
provides an acquire barrier. I also don't know about other OSes, so we
provide a simple & stupid emulation via p_atomic_cmpxchg.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
1 file changed