arc: add acq/rel variants for atomic cmpxchg/xchg
commitdfa72192f19f130d73e6587d0c3f7ef4e22c52c7
authorPavel Kozlov <pavel.kozlov@synopsys.com>
Thu, 9 Nov 2023 11:01:53 +0000 (9 15:01 +0400)
committerWaldemar Brodkorb <wbx@openadk.org>
Fri, 10 Nov 2023 15:14:19 +0000 (10 16:14 +0100)
tree1d828f1ce8e629f6560f0646fe06cc300380e870
parent4bf3912213ed8d0fa937fb4784a3e8e0c8fd8c3c
arc: add acq/rel variants for atomic cmpxchg/xchg

Add acquire/release variants for atomic functions cmpxchg/xchg and
provide a memory barrier after/before exchange. For cmpxchg use compiler
builtins. For xchg functions add memory barrier explicitly.

These barriers are required to keep memory consistency of ARCv3 CPU
cores in SMP.

For ARC700 barriers are not required and the compiler doesn't provide
_atomic_compare_exchange*, use current asm insertion without
acquire/release variants for ARC700.

Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
libc/sysdeps/linux/arc/bits/atomic.h