21#define AO_NO_DD_ORDERING
26#if (AO_GNUC_PREREQ(4, 9) || AO_CLANG_PREREQ(3, 5)) \
27 && !defined(AO_DISABLE_GCC_ATOMICS)
31# if defined(__clang__)
32# define AO_GCC_FORCE_HAVE_CAS
39# include "../test_and_set_t_is_ao_t.h"
40# include "../all_aligned_atomic_load_store.h"
42# if !defined(_ABI64) || _MIPS_SIM != _ABI64
44# if __mips_isa_rev >= 6
46# define AO_MIPS_SET_ISA ""
48# define AO_MIPS_SET_ISA " .set mips2\n"
50# define AO_MIPS_LL_1(args) " ll " args "\n"
51# define AO_MIPS_SC(args) " sc " args "\n"
53# if __mips_isa_rev >= 6
54# define AO_MIPS_SET_ISA ""
56# define AO_MIPS_SET_ISA " .set mips3\n"
58# define AO_MIPS_LL_1(args) " lld " args "\n"
59# define AO_MIPS_SC(args) " scd " args "\n"
62#ifdef AO_ICE9A1_LLSC_WAR
66# define AO_MIPS_LL(args) AO_MIPS_LL_1(args) AO_MIPS_LL_1(args)
68# define AO_MIPS_LL(args) AO_MIPS_LL_1(args)
83#define AO_HAVE_nop_full
85#ifndef AO_PREFER_GENERALIZED
104 :
"=&r" (
result),
"=&r" (temp),
"+m" (*addr)
109#define AO_HAVE_fetch_and_add
117 __asm__ __volatile__(
129 :
"=&r" (oldval),
"=&r" (temp),
"+m" (*addr)
134#define AO_HAVE_test_and_set
139#ifndef AO_GENERALIZE_ASM_BOOL_CAS
143 register int was_equal = 0;
146 __asm__ __volatile__(
160 :
"=&r" (temp),
"+m" (*addr),
"+r" (was_equal)
161 :
"r" (new_val),
"r" (old)
165# define AO_HAVE_compare_and_swap
171 register int fetched_val;
174 __asm__ __volatile__(
188 :
"=&r" (fetched_val),
"=&r" (temp),
"+m" (*addr)
189 :
"r" (new_val),
"Jr" (old)
191 return (
AO_t)fetched_val;
193#define AO_HAVE_fetch_compare_and_swap
201#undef AO_GCC_FORCE_HAVE_CAS
205#undef AO_MIPS_SET_ISA
AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
AO_INLINE int AO_compare_and_swap(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_t AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old, AO_t new_val)
AO_INLINE void AO_nop_full(void)