26#if (AO_GNUC_PREREQ(4, 8) || AO_CLANG_PREREQ(3, 8)) \
27 && !defined(AO_DISABLE_GCC_ATOMICS)
44#include "../all_aligned_atomic_load_store.h"
46#include "../test_and_set_t_is_ao_t.h"
53 __asm__ __volatile__(
"sync" : : :
"memory");
55#define AO_HAVE_nop_full
62 __asm__ __volatile__(
"sync" : : :
"memory");
64 __asm__ __volatile__(
"lwsync" : : :
"memory");
68#define AO_nop_write() AO_lwsync()
69#define AO_HAVE_nop_write
71#define AO_nop_read() AO_lwsync()
72#define AO_HAVE_nop_read
74#if defined(__powerpc64__) || defined(__ppc64__) || defined(__64BIT__)
76# define AO_PPC_LD "ld"
77# define AO_PPC_LxARX "ldarx"
78# define AO_PPC_CMPx "cmpd"
79# define AO_PPC_STxCXd "stdcx."
80# define AO_PPC_LOAD_CLOBBER "cr0"
82# define AO_PPC_LD "lwz"
83# define AO_PPC_LxARX "lwarx"
84# define AO_PPC_CMPx "cmpw"
85# define AO_PPC_STxCXd "stwcx."
86# define AO_PPC_LOAD_CLOBBER "cc"
96# define AO_PPC_L(label)
97# define AO_PPC_BR_A(labelBF, addr) addr
99# define AO_PPC_L(label) label ": "
100# define AO_PPC_BR_A(labelBF, addr) labelBF
114 __asm__ __volatile__ (
123#define AO_HAVE_load_acquire
133#define AO_HAVE_store_release
135#ifndef AO_PREFER_GENERALIZED
145 __asm__ __volatile__(
156 :
"r"(addr),
"r"(temp)
160#define AO_HAVE_test_and_set
168#define AO_HAVE_test_and_set_acquire
175#define AO_HAVE_test_and_set_release
185#define AO_HAVE_test_and_set_full
188#ifndef AO_GENERALIZE_ASM_BOOL_CAS
196 __asm__ __volatile__(
205 :
"=&r"(oldval),
"=&r"(
result)
206 :
"r"(addr),
"r"(new_val),
"r"(old),
"1"(
result)
210# define AO_HAVE_compare_and_swap
219# define AO_HAVE_compare_and_swap_acquire
227# define AO_HAVE_compare_and_swap_release
239# define AO_HAVE_compare_and_swap_full
248 __asm__ __volatile__(
257 :
"r"(addr),
"r"(new_val),
"r"(old_val)
261#define AO_HAVE_fetch_compare_and_swap
271#define AO_HAVE_fetch_compare_and_swap_acquire
280#define AO_HAVE_fetch_compare_and_swap_release
293#define AO_HAVE_fetch_compare_and_swap_full
295#ifndef AO_PREFER_GENERALIZED
301 __asm__ __volatile__(
307 :
"=&r"(oldval),
"=&r"(newval)
308 :
"r"(addr),
"r"(incr)
312#define AO_HAVE_fetch_and_add
320#define AO_HAVE_fetch_and_add_acquire
327#define AO_HAVE_fetch_and_add_release
337#define AO_HAVE_fetch_and_add_full
344#undef AO_PPC_LOAD_CLOBBER
#define AO_fetch_compare_and_swap_full(addr, old, newval)
AO_INLINE AO_TS_VAL_t AO_test_and_set_acquire(volatile AO_TS_t *addr)
AO_INLINE AO_t AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr)
AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
AO_INLINE AO_t AO_fetch_compare_and_swap_release(volatile AO_t *addr, AO_t old_val, AO_t new_val)
AO_INLINE int AO_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
AO_INLINE AO_t AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
AO_INLINE int AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
AO_INLINE AO_t AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
AO_INLINE void AO_lwsync(void)
AO_INLINE void AO_store_release(volatile AO_t *addr, AO_t value)
AO_INLINE int AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old, AO_t new_val)
AO_INLINE AO_TS_VAL_t AO_test_and_set(volatile AO_TS_t *addr)
AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr)
AO_INLINE AO_TS_VAL_t AO_test_and_set_release(volatile AO_TS_t *addr)
AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr)
#define AO_PPC_LOAD_CLOBBER
AO_INLINE int AO_compare_and_swap_release(volatile AO_t *addr, AO_t old, AO_t new_val)
#define AO_PPC_BR_A(labelBF, addr)
AO_INLINE AO_t AO_fetch_compare_and_swap_acquire(volatile AO_t *addr, AO_t old_val, AO_t new_val)
AO_INLINE AO_t AO_load_acquire(const volatile AO_t *addr)
AO_INLINE void AO_nop_full(void)