#if !defined(AO_ATOMIC_OPS_H) || defined(AO_ATOMIC_OPS_INCLUDED)
# error This file should not be included directly.
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_full) \
&& !defined(AO_HAVE_char_compare_and_swap_full)
AO_INLINE int
AO_char_compare_and_swap_full(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_full(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_char_compare_and_swap_full
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_acquire) \
&& !defined(AO_HAVE_char_compare_and_swap_acquire)
AO_INLINE int
AO_char_compare_and_swap_acquire(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_acquire(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_char_compare_and_swap_acquire
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_release) \
&& !defined(AO_HAVE_char_compare_and_swap_release)
AO_INLINE int
AO_char_compare_and_swap_release(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_release(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_char_compare_and_swap_release
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_write) \
&& !defined(AO_HAVE_char_compare_and_swap_write)
AO_INLINE int
AO_char_compare_and_swap_write(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_write(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_char_compare_and_swap_write
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_read) \
&& !defined(AO_HAVE_char_compare_and_swap_read)
AO_INLINE int
AO_char_compare_and_swap_read(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_read(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_char_compare_and_swap_read
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap) \
&& !defined(AO_HAVE_char_compare_and_swap)
AO_INLINE int
AO_char_compare_and_swap(volatile unsignedchar *addr, unsignedchar old_val,
unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap(addr, old_val, new_val) == old_val;
}
# define AO_HAVE_char_compare_and_swap
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_release_write) \
&& !defined(AO_HAVE_char_compare_and_swap_release_write)
AO_INLINE int
AO_char_compare_and_swap_release_write(volatile unsignedchar *addr,
unsignedchar old_val, unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_release_write(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_char_compare_and_swap_release_write
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_acquire_read) \
&& !defined(AO_HAVE_char_compare_and_swap_acquire_read)
AO_INLINE int
AO_char_compare_and_swap_acquire_read(volatile unsignedchar *addr,
unsignedchar old_val, unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_char_compare_and_swap_acquire_read
#endif
#if defined(AO_HAVE_char_fetch_compare_and_swap_dd_acquire_read) \
&& !defined(AO_HAVE_char_compare_and_swap_dd_acquire_read)
AO_INLINE int
AO_char_compare_and_swap_dd_acquire_read(volatile unsignedchar *addr,
unsignedchar old_val, unsignedchar new_val)
{
return AO_char_fetch_compare_and_swap_dd_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_char_compare_and_swap_dd_acquire_read
#endif
#if defined(AO_HAVE_char_compare_and_swap_full) \
&& !defined(AO_HAVE_char_fetch_and_add_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedchar
AO_char_fetch_and_add_full(volatile unsignedchar *addr, unsignedchar incr)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_full(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_char_fetch_and_add_full
#endif
#if defined(AO_HAVE_char_compare_and_swap_acquire) \
&& !defined(AO_HAVE_char_fetch_and_add_acquire)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedchar
AO_char_fetch_and_add_acquire(volatile unsignedchar *addr, unsignedchar incr)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_acquire(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_char_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_char_compare_and_swap_release) \
&& !defined(AO_HAVE_char_fetch_and_add_release)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedchar
AO_char_fetch_and_add_release(volatile unsignedchar *addr, unsignedchar incr)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_release(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_char_fetch_and_add_release
#endif
#if defined(AO_HAVE_char_compare_and_swap) \
&& !defined(AO_HAVE_char_fetch_and_add)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedchar
AO_char_fetch_and_add(volatile unsignedchar *addr, unsignedchar incr)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_char_fetch_and_add
#endif
#if defined(AO_HAVE_char_fetch_and_add_full)
# if !defined(AO_HAVE_char_fetch_and_add_release)
# define AO_char_fetch_and_add_release(addr, val) \
AO_char_fetch_and_add_full(addr, val)
# define AO_HAVE_char_fetch_and_add_release
# endif
# if !defined(AO_HAVE_char_fetch_and_add_acquire)
# define AO_char_fetch_and_add_acquire(addr, val) \
AO_char_fetch_and_add_full(addr, val)
# define AO_HAVE_char_fetch_and_add_acquire
# endif
# if !defined(AO_HAVE_char_fetch_and_add_write)
# define AO_char_fetch_and_add_write(addr, val) \
AO_char_fetch_and_add_full(addr, val)
# define AO_HAVE_char_fetch_and_add_write
# endif
# if !defined(AO_HAVE_char_fetch_and_add_read)
# define AO_char_fetch_and_add_read(addr, val) \
AO_char_fetch_and_add_full(addr, val)
# define AO_HAVE_char_fetch_and_add_read
# endif
#endif
#if defined(AO_HAVE_char_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_fetch_and_add_acquire)
AO_INLINE unsignedchar
AO_char_fetch_and_add_acquire(volatile unsignedchar *addr, unsignedchar incr)
{
unsignedchar result = AO_char_fetch_and_add(addr, incr);
AO_nop_full();
return result;
}
# define AO_HAVE_char_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_char_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_fetch_and_add_release)
# define AO_char_fetch_and_add_release(addr, incr) \
(AO_nop_full(), AO_char_fetch_and_add(addr, incr))
# define AO_HAVE_char_fetch_and_add_release
#endif
#if !defined(AO_HAVE_char_fetch_and_add) \
&& defined(AO_HAVE_char_fetch_and_add_release)
# define AO_char_fetch_and_add(addr, val) \
AO_char_fetch_and_add_release(addr, val)
# define AO_HAVE_char_fetch_and_add
#endif
#if !defined(AO_HAVE_char_fetch_and_add) \
&& defined(AO_HAVE_char_fetch_and_add_acquire)
# define AO_char_fetch_and_add(addr, val) \
AO_char_fetch_and_add_acquire(addr, val)
# define AO_HAVE_char_fetch_and_add
#endif
#if !defined(AO_HAVE_char_fetch_and_add) \
&& defined(AO_HAVE_char_fetch_and_add_write)
# define AO_char_fetch_and_add(addr, val) \
AO_char_fetch_and_add_write(addr, val)
# define AO_HAVE_char_fetch_and_add
#endif
#if !defined(AO_HAVE_char_fetch_and_add) \
&& defined(AO_HAVE_char_fetch_and_add_read)
# define AO_char_fetch_and_add(addr, val) \
AO_char_fetch_and_add_read(addr, val)
# define AO_HAVE_char_fetch_and_add
#endif
#if defined(AO_HAVE_char_fetch_and_add_acquire) \
&& defined(AO_HAVE_nop_full) && !defined(AO_HAVE_char_fetch_and_add_full)
# define AO_char_fetch_and_add_full(addr, val) \
(AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val))
# define AO_HAVE_char_fetch_and_add_full
#endif
#if !defined(AO_HAVE_char_fetch_and_add_release_write) \
&& defined(AO_HAVE_char_fetch_and_add_write)
# define AO_char_fetch_and_add_release_write(addr, val) \
AO_char_fetch_and_add_write(addr, val)
# define AO_HAVE_char_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_add_release_write) \
&& defined(AO_HAVE_char_fetch_and_add_release)
# define AO_char_fetch_and_add_release_write(addr, val) \
AO_char_fetch_and_add_release(addr, val)
# define AO_HAVE_char_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_add_read)
# define AO_char_fetch_and_add_acquire_read(addr, val) \
AO_char_fetch_and_add_read(addr, val)
# define AO_HAVE_char_fetch_and_add_acquire_read
#endif
#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_add_acquire)
# define AO_char_fetch_and_add_acquire_read(addr, val) \
AO_char_fetch_and_add_acquire(addr, val)
# define AO_HAVE_char_fetch_and_add_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_char_fetch_and_add_acquire_read)
# define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
AO_char_fetch_and_add_acquire_read(addr, val)
# define AO_HAVE_char_fetch_and_add_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_char_fetch_and_add)
# define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
AO_char_fetch_and_add(addr, val)
# define AO_HAVE_char_fetch_and_add_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_char_fetch_and_add_full) \
&& !defined(AO_HAVE_char_fetch_and_add1_full)
# define AO_char_fetch_and_add1_full(addr) \
AO_char_fetch_and_add_full(addr, 1)
# define AO_HAVE_char_fetch_and_add1_full
#endif
#if defined(AO_HAVE_char_fetch_and_add_release) \
&& !defined(AO_HAVE_char_fetch_and_add1_release)
# define AO_char_fetch_and_add1_release(addr) \
AO_char_fetch_and_add_release(addr, 1)
# define AO_HAVE_char_fetch_and_add1_release
#endif
#if defined(AO_HAVE_char_fetch_and_add_acquire) \
&& !defined(AO_HAVE_char_fetch_and_add1_acquire)
# define AO_char_fetch_and_add1_acquire(addr) \
AO_char_fetch_and_add_acquire(addr, 1)
# define AO_HAVE_char_fetch_and_add1_acquire
#endif
#if defined(AO_HAVE_char_fetch_and_add_write) \
&& !defined(AO_HAVE_char_fetch_and_add1_write)
# define AO_char_fetch_and_add1_write(addr) \
AO_char_fetch_and_add_write(addr, 1)
# define AO_HAVE_char_fetch_and_add1_write
#endif
#if defined(AO_HAVE_char_fetch_and_add_read) \
&& !defined(AO_HAVE_char_fetch_and_add1_read)
# define AO_char_fetch_and_add1_read(addr) \
AO_char_fetch_and_add_read(addr, 1)
# define AO_HAVE_char_fetch_and_add1_read
#endif
#if defined(AO_HAVE_char_fetch_and_add_release_write) \
&& !defined(AO_HAVE_char_fetch_and_add1_release_write)
# define AO_char_fetch_and_add1_release_write(addr) \
AO_char_fetch_and_add_release_write(addr, 1)
# define AO_HAVE_char_fetch_and_add1_release_write
#endif
#if defined(AO_HAVE_char_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_char_fetch_and_add1_acquire_read)
# define AO_char_fetch_and_add1_acquire_read(addr) \
AO_char_fetch_and_add_acquire_read(addr, 1)
# define AO_HAVE_char_fetch_and_add1_acquire_read
#endif
#if defined(AO_HAVE_char_fetch_and_add) \
&& !defined(AO_HAVE_char_fetch_and_add1)
# define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add(addr, 1)
# define AO_HAVE_char_fetch_and_add1
#endif
#if defined(AO_HAVE_char_fetch_and_add1_full)
# if !defined(AO_HAVE_char_fetch_and_add1_release)
# define AO_char_fetch_and_add1_release(addr) \
AO_char_fetch_and_add1_full(addr)
# define AO_HAVE_char_fetch_and_add1_release
# endif
# if !defined(AO_HAVE_char_fetch_and_add1_acquire)
# define AO_char_fetch_and_add1_acquire(addr) \
AO_char_fetch_and_add1_full(addr)
# define AO_HAVE_char_fetch_and_add1_acquire
# endif
# if !defined(AO_HAVE_char_fetch_and_add1_write)
# define AO_char_fetch_and_add1_write(addr) \
AO_char_fetch_and_add1_full(addr)
# define AO_HAVE_char_fetch_and_add1_write
# endif
# if !defined(AO_HAVE_char_fetch_and_add1_read)
# define AO_char_fetch_and_add1_read(addr) \
AO_char_fetch_and_add1_full(addr)
# define AO_HAVE_char_fetch_and_add1_read
# endif
#endif
#if !defined(AO_HAVE_char_fetch_and_add1) \
&& defined(AO_HAVE_char_fetch_and_add1_release)
# define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_release(addr)
# define AO_HAVE_char_fetch_and_add1
#endif
#if !defined(AO_HAVE_char_fetch_and_add1) \
&& defined(AO_HAVE_char_fetch_and_add1_acquire)
# define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_acquire(addr)
# define AO_HAVE_char_fetch_and_add1
#endif
#if !defined(AO_HAVE_char_fetch_and_add1) \
&& defined(AO_HAVE_char_fetch_and_add1_write)
# define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_write(addr)
# define AO_HAVE_char_fetch_and_add1
#endif
#if !defined(AO_HAVE_char_fetch_and_add1) \
&& defined(AO_HAVE_char_fetch_and_add1_read)
# define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_read(addr)
# define AO_HAVE_char_fetch_and_add1
#endif
#if defined(AO_HAVE_char_fetch_and_add1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_fetch_and_add1_full)
# define AO_char_fetch_and_add1_full(addr) \
(AO_nop_full(), AO_char_fetch_and_add1_acquire(addr))
# define AO_HAVE_char_fetch_and_add1_full
#endif
#if !defined(AO_HAVE_char_fetch_and_add1_release_write) \
&& defined(AO_HAVE_char_fetch_and_add1_write)
# define AO_char_fetch_and_add1_release_write(addr) \
AO_char_fetch_and_add1_write(addr)
# define AO_HAVE_char_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_add1_release_write) \
&& defined(AO_HAVE_char_fetch_and_add1_release)
# define AO_char_fetch_and_add1_release_write(addr) \
AO_char_fetch_and_add1_release(addr)
# define AO_HAVE_char_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_add1_read)
# define AO_char_fetch_and_add1_acquire_read(addr) \
AO_char_fetch_and_add1_read(addr)
# define AO_HAVE_char_fetch_and_add1_acquire_read
#endif
#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_add1_acquire)
# define AO_char_fetch_and_add1_acquire_read(addr) \
AO_char_fetch_and_add1_acquire(addr)
# define AO_HAVE_char_fetch_and_add1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
# define AO_char_fetch_and_add1_dd_acquire_read(addr) \
AO_char_fetch_and_add1_acquire_read(addr)
# define AO_HAVE_char_fetch_and_add1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_char_fetch_and_add1)
# define AO_char_fetch_and_add1_dd_acquire_read(addr) \
AO_char_fetch_and_add1(addr)
# define AO_HAVE_char_fetch_and_add1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_char_fetch_and_add_full) \
&& !defined(AO_HAVE_char_fetch_and_sub1_full)
# define AO_char_fetch_and_sub1_full(addr) \
AO_char_fetch_and_add_full(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_full
#endif
#if defined(AO_HAVE_char_fetch_and_add_release) \
&& !defined(AO_HAVE_char_fetch_and_sub1_release)
# define AO_char_fetch_and_sub1_release(addr) \
AO_char_fetch_and_add_release(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_release
#endif
#if defined(AO_HAVE_char_fetch_and_add_acquire) \
&& !defined(AO_HAVE_char_fetch_and_sub1_acquire)
# define AO_char_fetch_and_sub1_acquire(addr) \
AO_char_fetch_and_add_acquire(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_acquire
#endif
#if defined(AO_HAVE_char_fetch_and_add_write) \
&& !defined(AO_HAVE_char_fetch_and_sub1_write)
# define AO_char_fetch_and_sub1_write(addr) \
AO_char_fetch_and_add_write(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_write
#endif
#if defined(AO_HAVE_char_fetch_and_add_read) \
&& !defined(AO_HAVE_char_fetch_and_sub1_read)
# define AO_char_fetch_and_sub1_read(addr) \
AO_char_fetch_and_add_read(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_read
#endif
#if defined(AO_HAVE_char_fetch_and_add_release_write) \
&& !defined(AO_HAVE_char_fetch_and_sub1_release_write)
# define AO_char_fetch_and_sub1_release_write(addr) \
AO_char_fetch_and_add_release_write(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_release_write
#endif
#if defined(AO_HAVE_char_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
# define AO_char_fetch_and_sub1_acquire_read(addr) \
AO_char_fetch_and_add_acquire_read(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1_acquire_read
#endif
#if defined(AO_HAVE_char_fetch_and_add) \
&& !defined(AO_HAVE_char_fetch_and_sub1)
# define AO_char_fetch_and_sub1(addr) \
AO_char_fetch_and_add(addr, (unsignedchar)(-1))
# define AO_HAVE_char_fetch_and_sub1
#endif
#if defined(AO_HAVE_char_fetch_and_sub1_full)
# if !defined(AO_HAVE_char_fetch_and_sub1_release)
# define AO_char_fetch_and_sub1_release(addr) \
AO_char_fetch_and_sub1_full(addr)
# define AO_HAVE_char_fetch_and_sub1_release
# endif
# if !defined(AO_HAVE_char_fetch_and_sub1_acquire)
# define AO_char_fetch_and_sub1_acquire(addr) \
AO_char_fetch_and_sub1_full(addr)
# define AO_HAVE_char_fetch_and_sub1_acquire
# endif
# if !defined(AO_HAVE_char_fetch_and_sub1_write)
# define AO_char_fetch_and_sub1_write(addr) \
AO_char_fetch_and_sub1_full(addr)
# define AO_HAVE_char_fetch_and_sub1_write
# endif
# if !defined(AO_HAVE_char_fetch_and_sub1_read)
# define AO_char_fetch_and_sub1_read(addr) \
AO_char_fetch_and_sub1_full(addr)
# define AO_HAVE_char_fetch_and_sub1_read
# endif
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1) \
&& defined(AO_HAVE_char_fetch_and_sub1_release)
# define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_release(addr)
# define AO_HAVE_char_fetch_and_sub1
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1) \
&& defined(AO_HAVE_char_fetch_and_sub1_acquire)
# define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_acquire(addr)
# define AO_HAVE_char_fetch_and_sub1
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1) \
&& defined(AO_HAVE_char_fetch_and_sub1_write)
# define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_write(addr)
# define AO_HAVE_char_fetch_and_sub1
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1) \
&& defined(AO_HAVE_char_fetch_and_sub1_read)
# define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_read(addr)
# define AO_HAVE_char_fetch_and_sub1
#endif
#if defined(AO_HAVE_char_fetch_and_sub1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_fetch_and_sub1_full)
# define AO_char_fetch_and_sub1_full(addr) \
(AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr))
# define AO_HAVE_char_fetch_and_sub1_full
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_char_fetch_and_sub1_write)
# define AO_char_fetch_and_sub1_release_write(addr) \
AO_char_fetch_and_sub1_write(addr)
# define AO_HAVE_char_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_char_fetch_and_sub1_release)
# define AO_char_fetch_and_sub1_release_write(addr) \
AO_char_fetch_and_sub1_release(addr)
# define AO_HAVE_char_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_sub1_read)
# define AO_char_fetch_and_sub1_acquire_read(addr) \
AO_char_fetch_and_sub1_read(addr)
# define AO_HAVE_char_fetch_and_sub1_acquire_read
#endif
#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_char_fetch_and_sub1_acquire)
# define AO_char_fetch_and_sub1_acquire_read(addr) \
AO_char_fetch_and_sub1_acquire(addr)
# define AO_HAVE_char_fetch_and_sub1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
# define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
AO_char_fetch_and_sub1_acquire_read(addr)
# define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_char_fetch_and_sub1)
# define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
AO_char_fetch_and_sub1(addr)
# define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_char_compare_and_swap_full) \
&& !defined(AO_HAVE_char_and_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_char_and_full(volatile unsignedchar *addr, unsignedchar value)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_full(addr, old,
old & value)));
}
# define AO_HAVE_char_and_full
#endif
#if defined(AO_HAVE_char_and_full)
# if !defined(AO_HAVE_char_and_release)
# define AO_char_and_release(addr, val) AO_char_and_full(addr, val)
# define AO_HAVE_char_and_release
# endif
# if !defined(AO_HAVE_char_and_acquire)
# define AO_char_and_acquire(addr, val) AO_char_and_full(addr, val)
# define AO_HAVE_char_and_acquire
# endif
# if !defined(AO_HAVE_char_and_write)
# define AO_char_and_write(addr, val) AO_char_and_full(addr, val)
# define AO_HAVE_char_and_write
# endif
# if !defined(AO_HAVE_char_and_read)
# define AO_char_and_read(addr, val) AO_char_and_full(addr, val)
# define AO_HAVE_char_and_read
# endif
#endif
#if !defined(AO_HAVE_char_and) && defined(AO_HAVE_char_and_release)
# define AO_char_and(addr, val) AO_char_and_release(addr, val)
# define AO_HAVE_char_and
#endif
#if !defined(AO_HAVE_char_and) && defined(AO_HAVE_char_and_acquire)
# define AO_char_and(addr, val) AO_char_and_acquire(addr, val)
# define AO_HAVE_char_and
#endif
#if !defined(AO_HAVE_char_and) && defined(AO_HAVE_char_and_write)
# define AO_char_and(addr, val) AO_char_and_write(addr, val)
# define AO_HAVE_char_and
#endif
#if !defined(AO_HAVE_char_and) && defined(AO_HAVE_char_and_read)
# define AO_char_and(addr, val) AO_char_and_read(addr, val)
# define AO_HAVE_char_and
#endif
#if defined(AO_HAVE_char_and_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_and_full)
# define AO_char_and_full(addr, val) \
(AO_nop_full(), AO_char_and_acquire(addr, val))
# define AO_HAVE_char_and_full
#endif
#if !defined(AO_HAVE_char_and_release_write) \
&& defined(AO_HAVE_char_and_write)
# define AO_char_and_release_write(addr, val) AO_char_and_write(addr, val)
# define AO_HAVE_char_and_release_write
#endif
#if !defined(AO_HAVE_char_and_release_write) \
&& defined(AO_HAVE_char_and_release)
# define AO_char_and_release_write(addr, val) AO_char_and_release(addr, val)
# define AO_HAVE_char_and_release_write
#endif
#if !defined(AO_HAVE_char_and_acquire_read) \
&& defined(AO_HAVE_char_and_read)
# define AO_char_and_acquire_read(addr, val) AO_char_and_read(addr, val)
# define AO_HAVE_char_and_acquire_read
#endif
#if !defined(AO_HAVE_char_and_acquire_read) \
&& defined(AO_HAVE_char_and_acquire)
# define AO_char_and_acquire_read(addr, val) AO_char_and_acquire(addr, val)
# define AO_HAVE_char_and_acquire_read
#endif
#if defined(AO_HAVE_char_compare_and_swap_full) \
&& !defined(AO_HAVE_char_or_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_char_or_full(volatile unsignedchar *addr, unsignedchar value)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_full(addr, old,
old | value)));
}
# define AO_HAVE_char_or_full
#endif
#if defined(AO_HAVE_char_or_full)
# if !defined(AO_HAVE_char_or_release)
# define AO_char_or_release(addr, val) AO_char_or_full(addr, val)
# define AO_HAVE_char_or_release
# endif
# if !defined(AO_HAVE_char_or_acquire)
# define AO_char_or_acquire(addr, val) AO_char_or_full(addr, val)
# define AO_HAVE_char_or_acquire
# endif
# if !defined(AO_HAVE_char_or_write)
# define AO_char_or_write(addr, val) AO_char_or_full(addr, val)
# define AO_HAVE_char_or_write
# endif
# if !defined(AO_HAVE_char_or_read)
# define AO_char_or_read(addr, val) AO_char_or_full(addr, val)
# define AO_HAVE_char_or_read
# endif
#endif
#if !defined(AO_HAVE_char_or) && defined(AO_HAVE_char_or_release)
# define AO_char_or(addr, val) AO_char_or_release(addr, val)
# define AO_HAVE_char_or
#endif
#if !defined(AO_HAVE_char_or) && defined(AO_HAVE_char_or_acquire)
# define AO_char_or(addr, val) AO_char_or_acquire(addr, val)
# define AO_HAVE_char_or
#endif
#if !defined(AO_HAVE_char_or) && defined(AO_HAVE_char_or_write)
# define AO_char_or(addr, val) AO_char_or_write(addr, val)
# define AO_HAVE_char_or
#endif
#if !defined(AO_HAVE_char_or) && defined(AO_HAVE_char_or_read)
# define AO_char_or(addr, val) AO_char_or_read(addr, val)
# define AO_HAVE_char_or
#endif
#if defined(AO_HAVE_char_or_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_or_full)
# define AO_char_or_full(addr, val) \
(AO_nop_full(), AO_char_or_acquire(addr, val))
# define AO_HAVE_char_or_full
#endif
#if !defined(AO_HAVE_char_or_release_write) \
&& defined(AO_HAVE_char_or_write)
# define AO_char_or_release_write(addr, val) AO_char_or_write(addr, val)
# define AO_HAVE_char_or_release_write
#endif
#if !defined(AO_HAVE_char_or_release_write) \
&& defined(AO_HAVE_char_or_release)
# define AO_char_or_release_write(addr, val) AO_char_or_release(addr, val)
# define AO_HAVE_char_or_release_write
#endif
#if !defined(AO_HAVE_char_or_acquire_read) && defined(AO_HAVE_char_or_read)
# define AO_char_or_acquire_read(addr, val) AO_char_or_read(addr, val)
# define AO_HAVE_char_or_acquire_read
#endif
#if !defined(AO_HAVE_char_or_acquire_read) \
&& defined(AO_HAVE_char_or_acquire)
# define AO_char_or_acquire_read(addr, val) AO_char_or_acquire(addr, val)
# define AO_HAVE_char_or_acquire_read
#endif
#if defined(AO_HAVE_char_compare_and_swap_full) \
&& !defined(AO_HAVE_char_xor_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_char_xor_full(volatile unsignedchar *addr, unsignedchar value)
{
unsignedchar old;
do
{
old = *(unsignedchar *)addr;
}
while (AO_EXPECT_FALSE(!AO_char_compare_and_swap_full(addr, old,
old ^ value)));
}
# define AO_HAVE_char_xor_full
#endif
#if defined(AO_HAVE_char_xor_full)
# if !defined(AO_HAVE_char_xor_release)
# define AO_char_xor_release(addr, val) AO_char_xor_full(addr, val)
# define AO_HAVE_char_xor_release
# endif
# if !defined(AO_HAVE_char_xor_acquire)
# define AO_char_xor_acquire(addr, val) AO_char_xor_full(addr, val)
# define AO_HAVE_char_xor_acquire
# endif
# if !defined(AO_HAVE_char_xor_write)
# define AO_char_xor_write(addr, val) AO_char_xor_full(addr, val)
# define AO_HAVE_char_xor_write
# endif
# if !defined(AO_HAVE_char_xor_read)
# define AO_char_xor_read(addr, val) AO_char_xor_full(addr, val)
# define AO_HAVE_char_xor_read
# endif
#endif
#if !defined(AO_HAVE_char_xor) && defined(AO_HAVE_char_xor_release)
# define AO_char_xor(addr, val) AO_char_xor_release(addr, val)
# define AO_HAVE_char_xor
#endif
#if !defined(AO_HAVE_char_xor) && defined(AO_HAVE_char_xor_acquire)
# define AO_char_xor(addr, val) AO_char_xor_acquire(addr, val)
# define AO_HAVE_char_xor
#endif
#if !defined(AO_HAVE_char_xor) && defined(AO_HAVE_char_xor_write)
# define AO_char_xor(addr, val) AO_char_xor_write(addr, val)
# define AO_HAVE_char_xor
#endif
#if !defined(AO_HAVE_char_xor) && defined(AO_HAVE_char_xor_read)
# define AO_char_xor(addr, val) AO_char_xor_read(addr, val)
# define AO_HAVE_char_xor
#endif
#if defined(AO_HAVE_char_xor_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_char_xor_full)
# define AO_char_xor_full(addr, val) \
(AO_nop_full(), AO_char_xor_acquire(addr, val))
# define AO_HAVE_char_xor_full
#endif
#if !defined(AO_HAVE_char_xor_release_write) \
&& defined(AO_HAVE_char_xor_write)
# define AO_char_xor_release_write(addr, val) AO_char_xor_write(addr, val)
# define AO_HAVE_char_xor_release_write
#endif
#if !defined(AO_HAVE_char_xor_release_write) \
&& defined(AO_HAVE_char_xor_release)
# define AO_char_xor_release_write(addr, val) AO_char_xor_release(addr, val)
# define AO_HAVE_char_xor_release_write
#endif
#if !defined(AO_HAVE_char_xor_acquire_read) \
&& defined(AO_HAVE_char_xor_read)
# define AO_char_xor_acquire_read(addr, val) AO_char_xor_read(addr, val)
# define AO_HAVE_char_xor_acquire_read
#endif
#if !defined(AO_HAVE_char_xor_acquire_read) \
&& defined(AO_HAVE_char_xor_acquire)
# define AO_char_xor_acquire_read(addr, val) AO_char_xor_acquire(addr, val)
# define AO_HAVE_char_xor_acquire_read
#endif
#if !defined(AO_ATOMIC_OPS_H) || defined(AO_ATOMIC_OPS_INCLUDED)
# error This file should not be included directly.
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_full) \
&& !defined(AO_HAVE_short_compare_and_swap_full)
AO_INLINE int
AO_short_compare_and_swap_full(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_full(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_short_compare_and_swap_full
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_acquire) \
&& !defined(AO_HAVE_short_compare_and_swap_acquire)
AO_INLINE int
AO_short_compare_and_swap_acquire(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_acquire(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_short_compare_and_swap_acquire
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_release) \
&& !defined(AO_HAVE_short_compare_and_swap_release)
AO_INLINE int
AO_short_compare_and_swap_release(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_release(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_short_compare_and_swap_release
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_write) \
&& !defined(AO_HAVE_short_compare_and_swap_write)
AO_INLINE int
AO_short_compare_and_swap_write(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_write(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_short_compare_and_swap_write
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_read) \
&& !defined(AO_HAVE_short_compare_and_swap_read)
AO_INLINE int
AO_short_compare_and_swap_read(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_read(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_short_compare_and_swap_read
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap) \
&& !defined(AO_HAVE_short_compare_and_swap)
AO_INLINE int
AO_short_compare_and_swap(volatile unsignedshort *addr, unsignedshort old_val,
unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap(addr, old_val, new_val) == old_val;
}
# define AO_HAVE_short_compare_and_swap
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_release_write) \
&& !defined(AO_HAVE_short_compare_and_swap_release_write)
AO_INLINE int
AO_short_compare_and_swap_release_write(volatile unsignedshort *addr,
unsignedshort old_val, unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_release_write(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_short_compare_and_swap_release_write
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_acquire_read) \
&& !defined(AO_HAVE_short_compare_and_swap_acquire_read)
AO_INLINE int
AO_short_compare_and_swap_acquire_read(volatile unsignedshort *addr,
unsignedshort old_val, unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_short_compare_and_swap_acquire_read
#endif
#if defined(AO_HAVE_short_fetch_compare_and_swap_dd_acquire_read) \
&& !defined(AO_HAVE_short_compare_and_swap_dd_acquire_read)
AO_INLINE int
AO_short_compare_and_swap_dd_acquire_read(volatile unsignedshort *addr,
unsignedshort old_val, unsignedshort new_val)
{
return AO_short_fetch_compare_and_swap_dd_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_short_compare_and_swap_dd_acquire_read
#endif
#if defined(AO_HAVE_short_compare_and_swap_full) \
&& !defined(AO_HAVE_short_fetch_and_add_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedshort
AO_short_fetch_and_add_full(volatile unsignedshort *addr, unsignedshort incr)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_full(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_short_fetch_and_add_full
#endif
#if defined(AO_HAVE_short_compare_and_swap_acquire) \
&& !defined(AO_HAVE_short_fetch_and_add_acquire)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedshort
AO_short_fetch_and_add_acquire(volatile unsignedshort *addr, unsignedshort incr)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_acquire(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_short_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_short_compare_and_swap_release) \
&& !defined(AO_HAVE_short_fetch_and_add_release)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedshort
AO_short_fetch_and_add_release(volatile unsignedshort *addr, unsignedshort incr)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_release(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_short_fetch_and_add_release
#endif
#if defined(AO_HAVE_short_compare_and_swap) \
&& !defined(AO_HAVE_short_fetch_and_add)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsignedshort
AO_short_fetch_and_add(volatile unsignedshort *addr, unsignedshort incr)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_short_fetch_and_add
#endif
#if defined(AO_HAVE_short_fetch_and_add_full)
# if !defined(AO_HAVE_short_fetch_and_add_release)
# define AO_short_fetch_and_add_release(addr, val) \
AO_short_fetch_and_add_full(addr, val)
# define AO_HAVE_short_fetch_and_add_release
# endif
# if !defined(AO_HAVE_short_fetch_and_add_acquire)
# define AO_short_fetch_and_add_acquire(addr, val) \
AO_short_fetch_and_add_full(addr, val)
# define AO_HAVE_short_fetch_and_add_acquire
# endif
# if !defined(AO_HAVE_short_fetch_and_add_write)
# define AO_short_fetch_and_add_write(addr, val) \
AO_short_fetch_and_add_full(addr, val)
# define AO_HAVE_short_fetch_and_add_write
# endif
# if !defined(AO_HAVE_short_fetch_and_add_read)
# define AO_short_fetch_and_add_read(addr, val) \
AO_short_fetch_and_add_full(addr, val)
# define AO_HAVE_short_fetch_and_add_read
# endif
#endif
#if defined(AO_HAVE_short_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_fetch_and_add_acquire)
AO_INLINE unsignedshort
AO_short_fetch_and_add_acquire(volatile unsignedshort *addr, unsignedshort incr)
{
unsignedshort result = AO_short_fetch_and_add(addr, incr);
AO_nop_full();
return result;
}
# define AO_HAVE_short_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_short_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_fetch_and_add_release)
# define AO_short_fetch_and_add_release(addr, incr) \
(AO_nop_full(), AO_short_fetch_and_add(addr, incr))
# define AO_HAVE_short_fetch_and_add_release
#endif
#if !defined(AO_HAVE_short_fetch_and_add) \
&& defined(AO_HAVE_short_fetch_and_add_release)
# define AO_short_fetch_and_add(addr, val) \
AO_short_fetch_and_add_release(addr, val)
# define AO_HAVE_short_fetch_and_add
#endif
#if !defined(AO_HAVE_short_fetch_and_add) \
&& defined(AO_HAVE_short_fetch_and_add_acquire)
# define AO_short_fetch_and_add(addr, val) \
AO_short_fetch_and_add_acquire(addr, val)
# define AO_HAVE_short_fetch_and_add
#endif
#if !defined(AO_HAVE_short_fetch_and_add) \
&& defined(AO_HAVE_short_fetch_and_add_write)
# define AO_short_fetch_and_add(addr, val) \
AO_short_fetch_and_add_write(addr, val)
# define AO_HAVE_short_fetch_and_add
#endif
#if !defined(AO_HAVE_short_fetch_and_add) \
&& defined(AO_HAVE_short_fetch_and_add_read)
# define AO_short_fetch_and_add(addr, val) \
AO_short_fetch_and_add_read(addr, val)
# define AO_HAVE_short_fetch_and_add
#endif
#if defined(AO_HAVE_short_fetch_and_add_acquire) \
&& defined(AO_HAVE_nop_full) && !defined(AO_HAVE_short_fetch_and_add_full)
# define AO_short_fetch_and_add_full(addr, val) \
(AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val))
# define AO_HAVE_short_fetch_and_add_full
#endif
#if !defined(AO_HAVE_short_fetch_and_add_release_write) \
&& defined(AO_HAVE_short_fetch_and_add_write)
# define AO_short_fetch_and_add_release_write(addr, val) \
AO_short_fetch_and_add_write(addr, val)
# define AO_HAVE_short_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_add_release_write) \
&& defined(AO_HAVE_short_fetch_and_add_release)
# define AO_short_fetch_and_add_release_write(addr, val) \
AO_short_fetch_and_add_release(addr, val)
# define AO_HAVE_short_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_add_read)
# define AO_short_fetch_and_add_acquire_read(addr, val) \
AO_short_fetch_and_add_read(addr, val)
# define AO_HAVE_short_fetch_and_add_acquire_read
#endif
#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_add_acquire)
# define AO_short_fetch_and_add_acquire_read(addr, val) \
AO_short_fetch_and_add_acquire(addr, val)
# define AO_HAVE_short_fetch_and_add_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_short_fetch_and_add_acquire_read)
# define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
AO_short_fetch_and_add_acquire_read(addr, val)
# define AO_HAVE_short_fetch_and_add_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_short_fetch_and_add)
# define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
AO_short_fetch_and_add(addr, val)
# define AO_HAVE_short_fetch_and_add_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_short_fetch_and_add_full) \
&& !defined(AO_HAVE_short_fetch_and_add1_full)
# define AO_short_fetch_and_add1_full(addr) \
AO_short_fetch_and_add_full(addr, 1)
# define AO_HAVE_short_fetch_and_add1_full
#endif
#if defined(AO_HAVE_short_fetch_and_add_release) \
&& !defined(AO_HAVE_short_fetch_and_add1_release)
# define AO_short_fetch_and_add1_release(addr) \
AO_short_fetch_and_add_release(addr, 1)
# define AO_HAVE_short_fetch_and_add1_release
#endif
#if defined(AO_HAVE_short_fetch_and_add_acquire) \
&& !defined(AO_HAVE_short_fetch_and_add1_acquire)
# define AO_short_fetch_and_add1_acquire(addr) \
AO_short_fetch_and_add_acquire(addr, 1)
# define AO_HAVE_short_fetch_and_add1_acquire
#endif
#if defined(AO_HAVE_short_fetch_and_add_write) \
&& !defined(AO_HAVE_short_fetch_and_add1_write)
# define AO_short_fetch_and_add1_write(addr) \
AO_short_fetch_and_add_write(addr, 1)
# define AO_HAVE_short_fetch_and_add1_write
#endif
#if defined(AO_HAVE_short_fetch_and_add_read) \
&& !defined(AO_HAVE_short_fetch_and_add1_read)
# define AO_short_fetch_and_add1_read(addr) \
AO_short_fetch_and_add_read(addr, 1)
# define AO_HAVE_short_fetch_and_add1_read
#endif
#if defined(AO_HAVE_short_fetch_and_add_release_write) \
&& !defined(AO_HAVE_short_fetch_and_add1_release_write)
# define AO_short_fetch_and_add1_release_write(addr) \
AO_short_fetch_and_add_release_write(addr, 1)
# define AO_HAVE_short_fetch_and_add1_release_write
#endif
#if defined(AO_HAVE_short_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_short_fetch_and_add1_acquire_read)
# define AO_short_fetch_and_add1_acquire_read(addr) \
AO_short_fetch_and_add_acquire_read(addr, 1)
# define AO_HAVE_short_fetch_and_add1_acquire_read
#endif
#if defined(AO_HAVE_short_fetch_and_add) \
&& !defined(AO_HAVE_short_fetch_and_add1)
# define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add(addr, 1)
# define AO_HAVE_short_fetch_and_add1
#endif
#if defined(AO_HAVE_short_fetch_and_add1_full)
# if !defined(AO_HAVE_short_fetch_and_add1_release)
# define AO_short_fetch_and_add1_release(addr) \
AO_short_fetch_and_add1_full(addr)
# define AO_HAVE_short_fetch_and_add1_release
# endif
# if !defined(AO_HAVE_short_fetch_and_add1_acquire)
# define AO_short_fetch_and_add1_acquire(addr) \
AO_short_fetch_and_add1_full(addr)
# define AO_HAVE_short_fetch_and_add1_acquire
# endif
# if !defined(AO_HAVE_short_fetch_and_add1_write)
# define AO_short_fetch_and_add1_write(addr) \
AO_short_fetch_and_add1_full(addr)
# define AO_HAVE_short_fetch_and_add1_write
# endif
# if !defined(AO_HAVE_short_fetch_and_add1_read)
# define AO_short_fetch_and_add1_read(addr) \
AO_short_fetch_and_add1_full(addr)
# define AO_HAVE_short_fetch_and_add1_read
# endif
#endif
#if !defined(AO_HAVE_short_fetch_and_add1) \
&& defined(AO_HAVE_short_fetch_and_add1_release)
# define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_release(addr)
# define AO_HAVE_short_fetch_and_add1
#endif
#if !defined(AO_HAVE_short_fetch_and_add1) \
&& defined(AO_HAVE_short_fetch_and_add1_acquire)
# define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_acquire(addr)
# define AO_HAVE_short_fetch_and_add1
#endif
#if !defined(AO_HAVE_short_fetch_and_add1) \
&& defined(AO_HAVE_short_fetch_and_add1_write)
# define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_write(addr)
# define AO_HAVE_short_fetch_and_add1
#endif
#if !defined(AO_HAVE_short_fetch_and_add1) \
&& defined(AO_HAVE_short_fetch_and_add1_read)
# define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_read(addr)
# define AO_HAVE_short_fetch_and_add1
#endif
#if defined(AO_HAVE_short_fetch_and_add1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_fetch_and_add1_full)
# define AO_short_fetch_and_add1_full(addr) \
(AO_nop_full(), AO_short_fetch_and_add1_acquire(addr))
# define AO_HAVE_short_fetch_and_add1_full
#endif
#if !defined(AO_HAVE_short_fetch_and_add1_release_write) \
&& defined(AO_HAVE_short_fetch_and_add1_write)
# define AO_short_fetch_and_add1_release_write(addr) \
AO_short_fetch_and_add1_write(addr)
# define AO_HAVE_short_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_add1_release_write) \
&& defined(AO_HAVE_short_fetch_and_add1_release)
# define AO_short_fetch_and_add1_release_write(addr) \
AO_short_fetch_and_add1_release(addr)
# define AO_HAVE_short_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_add1_read)
# define AO_short_fetch_and_add1_acquire_read(addr) \
AO_short_fetch_and_add1_read(addr)
# define AO_HAVE_short_fetch_and_add1_acquire_read
#endif
#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_add1_acquire)
# define AO_short_fetch_and_add1_acquire_read(addr) \
AO_short_fetch_and_add1_acquire(addr)
# define AO_HAVE_short_fetch_and_add1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
# define AO_short_fetch_and_add1_dd_acquire_read(addr) \
AO_short_fetch_and_add1_acquire_read(addr)
# define AO_HAVE_short_fetch_and_add1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_short_fetch_and_add1)
# define AO_short_fetch_and_add1_dd_acquire_read(addr) \
AO_short_fetch_and_add1(addr)
# define AO_HAVE_short_fetch_and_add1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_short_fetch_and_add_full) \
&& !defined(AO_HAVE_short_fetch_and_sub1_full)
# define AO_short_fetch_and_sub1_full(addr) \
AO_short_fetch_and_add_full(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_full
#endif
#if defined(AO_HAVE_short_fetch_and_add_release) \
&& !defined(AO_HAVE_short_fetch_and_sub1_release)
# define AO_short_fetch_and_sub1_release(addr) \
AO_short_fetch_and_add_release(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_release
#endif
#if defined(AO_HAVE_short_fetch_and_add_acquire) \
&& !defined(AO_HAVE_short_fetch_and_sub1_acquire)
# define AO_short_fetch_and_sub1_acquire(addr) \
AO_short_fetch_and_add_acquire(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_acquire
#endif
#if defined(AO_HAVE_short_fetch_and_add_write) \
&& !defined(AO_HAVE_short_fetch_and_sub1_write)
# define AO_short_fetch_and_sub1_write(addr) \
AO_short_fetch_and_add_write(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_write
#endif
#if defined(AO_HAVE_short_fetch_and_add_read) \
&& !defined(AO_HAVE_short_fetch_and_sub1_read)
# define AO_short_fetch_and_sub1_read(addr) \
AO_short_fetch_and_add_read(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_read
#endif
#if defined(AO_HAVE_short_fetch_and_add_release_write) \
&& !defined(AO_HAVE_short_fetch_and_sub1_release_write)
# define AO_short_fetch_and_sub1_release_write(addr) \
AO_short_fetch_and_add_release_write(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_release_write
#endif
#if defined(AO_HAVE_short_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
# define AO_short_fetch_and_sub1_acquire_read(addr) \
AO_short_fetch_and_add_acquire_read(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1_acquire_read
#endif
#if defined(AO_HAVE_short_fetch_and_add) \
&& !defined(AO_HAVE_short_fetch_and_sub1)
# define AO_short_fetch_and_sub1(addr) \
AO_short_fetch_and_add(addr, (unsignedshort)(-1))
# define AO_HAVE_short_fetch_and_sub1
#endif
#if defined(AO_HAVE_short_fetch_and_sub1_full)
# if !defined(AO_HAVE_short_fetch_and_sub1_release)
# define AO_short_fetch_and_sub1_release(addr) \
AO_short_fetch_and_sub1_full(addr)
# define AO_HAVE_short_fetch_and_sub1_release
# endif
# if !defined(AO_HAVE_short_fetch_and_sub1_acquire)
# define AO_short_fetch_and_sub1_acquire(addr) \
AO_short_fetch_and_sub1_full(addr)
# define AO_HAVE_short_fetch_and_sub1_acquire
# endif
# if !defined(AO_HAVE_short_fetch_and_sub1_write)
# define AO_short_fetch_and_sub1_write(addr) \
AO_short_fetch_and_sub1_full(addr)
# define AO_HAVE_short_fetch_and_sub1_write
# endif
# if !defined(AO_HAVE_short_fetch_and_sub1_read)
# define AO_short_fetch_and_sub1_read(addr) \
AO_short_fetch_and_sub1_full(addr)
# define AO_HAVE_short_fetch_and_sub1_read
# endif
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1) \
&& defined(AO_HAVE_short_fetch_and_sub1_release)
# define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_release(addr)
# define AO_HAVE_short_fetch_and_sub1
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1) \
&& defined(AO_HAVE_short_fetch_and_sub1_acquire)
# define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_acquire(addr)
# define AO_HAVE_short_fetch_and_sub1
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1) \
&& defined(AO_HAVE_short_fetch_and_sub1_write)
# define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_write(addr)
# define AO_HAVE_short_fetch_and_sub1
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1) \
&& defined(AO_HAVE_short_fetch_and_sub1_read)
# define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_read(addr)
# define AO_HAVE_short_fetch_and_sub1
#endif
#if defined(AO_HAVE_short_fetch_and_sub1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_fetch_and_sub1_full)
# define AO_short_fetch_and_sub1_full(addr) \
(AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr))
# define AO_HAVE_short_fetch_and_sub1_full
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_short_fetch_and_sub1_write)
# define AO_short_fetch_and_sub1_release_write(addr) \
AO_short_fetch_and_sub1_write(addr)
# define AO_HAVE_short_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_short_fetch_and_sub1_release)
# define AO_short_fetch_and_sub1_release_write(addr) \
AO_short_fetch_and_sub1_release(addr)
# define AO_HAVE_short_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_sub1_read)
# define AO_short_fetch_and_sub1_acquire_read(addr) \
AO_short_fetch_and_sub1_read(addr)
# define AO_HAVE_short_fetch_and_sub1_acquire_read
#endif
#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_short_fetch_and_sub1_acquire)
# define AO_short_fetch_and_sub1_acquire_read(addr) \
AO_short_fetch_and_sub1_acquire(addr)
# define AO_HAVE_short_fetch_and_sub1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
# define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
AO_short_fetch_and_sub1_acquire_read(addr)
# define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_short_fetch_and_sub1)
# define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
AO_short_fetch_and_sub1(addr)
# define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_short_compare_and_swap_full) \
&& !defined(AO_HAVE_short_and_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_short_and_full(volatile unsignedshort *addr, unsignedshort value)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_full(addr, old,
old & value)));
}
# define AO_HAVE_short_and_full
#endif
#if defined(AO_HAVE_short_and_full)
# if !defined(AO_HAVE_short_and_release)
# define AO_short_and_release(addr, val) AO_short_and_full(addr, val)
# define AO_HAVE_short_and_release
# endif
# if !defined(AO_HAVE_short_and_acquire)
# define AO_short_and_acquire(addr, val) AO_short_and_full(addr, val)
# define AO_HAVE_short_and_acquire
# endif
# if !defined(AO_HAVE_short_and_write)
# define AO_short_and_write(addr, val) AO_short_and_full(addr, val)
# define AO_HAVE_short_and_write
# endif
# if !defined(AO_HAVE_short_and_read)
# define AO_short_and_read(addr, val) AO_short_and_full(addr, val)
# define AO_HAVE_short_and_read
# endif
#endif
#if !defined(AO_HAVE_short_and) && defined(AO_HAVE_short_and_release)
# define AO_short_and(addr, val) AO_short_and_release(addr, val)
# define AO_HAVE_short_and
#endif
#if !defined(AO_HAVE_short_and) && defined(AO_HAVE_short_and_acquire)
# define AO_short_and(addr, val) AO_short_and_acquire(addr, val)
# define AO_HAVE_short_and
#endif
#if !defined(AO_HAVE_short_and) && defined(AO_HAVE_short_and_write)
# define AO_short_and(addr, val) AO_short_and_write(addr, val)
# define AO_HAVE_short_and
#endif
#if !defined(AO_HAVE_short_and) && defined(AO_HAVE_short_and_read)
# define AO_short_and(addr, val) AO_short_and_read(addr, val)
# define AO_HAVE_short_and
#endif
#if defined(AO_HAVE_short_and_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_and_full)
# define AO_short_and_full(addr, val) \
(AO_nop_full(), AO_short_and_acquire(addr, val))
# define AO_HAVE_short_and_full
#endif
#if !defined(AO_HAVE_short_and_release_write) \
&& defined(AO_HAVE_short_and_write)
# define AO_short_and_release_write(addr, val) AO_short_and_write(addr, val)
# define AO_HAVE_short_and_release_write
#endif
#if !defined(AO_HAVE_short_and_release_write) \
&& defined(AO_HAVE_short_and_release)
# define AO_short_and_release_write(addr, val) AO_short_and_release(addr, val)
# define AO_HAVE_short_and_release_write
#endif
#if !defined(AO_HAVE_short_and_acquire_read) \
&& defined(AO_HAVE_short_and_read)
# define AO_short_and_acquire_read(addr, val) AO_short_and_read(addr, val)
# define AO_HAVE_short_and_acquire_read
#endif
#if !defined(AO_HAVE_short_and_acquire_read) \
&& defined(AO_HAVE_short_and_acquire)
# define AO_short_and_acquire_read(addr, val) AO_short_and_acquire(addr, val)
# define AO_HAVE_short_and_acquire_read
#endif
#if defined(AO_HAVE_short_compare_and_swap_full) \
&& !defined(AO_HAVE_short_or_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_short_or_full(volatile unsignedshort *addr, unsignedshort value)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_full(addr, old,
old | value)));
}
# define AO_HAVE_short_or_full
#endif
#if defined(AO_HAVE_short_or_full)
# if !defined(AO_HAVE_short_or_release)
# define AO_short_or_release(addr, val) AO_short_or_full(addr, val)
# define AO_HAVE_short_or_release
# endif
# if !defined(AO_HAVE_short_or_acquire)
# define AO_short_or_acquire(addr, val) AO_short_or_full(addr, val)
# define AO_HAVE_short_or_acquire
# endif
# if !defined(AO_HAVE_short_or_write)
# define AO_short_or_write(addr, val) AO_short_or_full(addr, val)
# define AO_HAVE_short_or_write
# endif
# if !defined(AO_HAVE_short_or_read)
# define AO_short_or_read(addr, val) AO_short_or_full(addr, val)
# define AO_HAVE_short_or_read
# endif
#endif
#if !defined(AO_HAVE_short_or) && defined(AO_HAVE_short_or_release)
# define AO_short_or(addr, val) AO_short_or_release(addr, val)
# define AO_HAVE_short_or
#endif
#if !defined(AO_HAVE_short_or) && defined(AO_HAVE_short_or_acquire)
# define AO_short_or(addr, val) AO_short_or_acquire(addr, val)
# define AO_HAVE_short_or
#endif
#if !defined(AO_HAVE_short_or) && defined(AO_HAVE_short_or_write)
# define AO_short_or(addr, val) AO_short_or_write(addr, val)
# define AO_HAVE_short_or
#endif
#if !defined(AO_HAVE_short_or) && defined(AO_HAVE_short_or_read)
# define AO_short_or(addr, val) AO_short_or_read(addr, val)
# define AO_HAVE_short_or
#endif
#if defined(AO_HAVE_short_or_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_or_full)
# define AO_short_or_full(addr, val) \
(AO_nop_full(), AO_short_or_acquire(addr, val))
# define AO_HAVE_short_or_full
#endif
#if !defined(AO_HAVE_short_or_release_write) \
&& defined(AO_HAVE_short_or_write)
# define AO_short_or_release_write(addr, val) AO_short_or_write(addr, val)
# define AO_HAVE_short_or_release_write
#endif
#if !defined(AO_HAVE_short_or_release_write) \
&& defined(AO_HAVE_short_or_release)
# define AO_short_or_release_write(addr, val) AO_short_or_release(addr, val)
# define AO_HAVE_short_or_release_write
#endif
#if !defined(AO_HAVE_short_or_acquire_read) && defined(AO_HAVE_short_or_read)
# define AO_short_or_acquire_read(addr, val) AO_short_or_read(addr, val)
# define AO_HAVE_short_or_acquire_read
#endif
#if !defined(AO_HAVE_short_or_acquire_read) \
&& defined(AO_HAVE_short_or_acquire)
# define AO_short_or_acquire_read(addr, val) AO_short_or_acquire(addr, val)
# define AO_HAVE_short_or_acquire_read
#endif
#if defined(AO_HAVE_short_compare_and_swap_full) \
&& !defined(AO_HAVE_short_xor_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_short_xor_full(volatile unsignedshort *addr, unsignedshort value)
{
unsignedshort old;
do
{
old = *(unsignedshort *)addr;
}
while (AO_EXPECT_FALSE(!AO_short_compare_and_swap_full(addr, old,
old ^ value)));
}
# define AO_HAVE_short_xor_full
#endif
#if defined(AO_HAVE_short_xor_full)
# if !defined(AO_HAVE_short_xor_release)
# define AO_short_xor_release(addr, val) AO_short_xor_full(addr, val)
# define AO_HAVE_short_xor_release
# endif
# if !defined(AO_HAVE_short_xor_acquire)
# define AO_short_xor_acquire(addr, val) AO_short_xor_full(addr, val)
# define AO_HAVE_short_xor_acquire
# endif
# if !defined(AO_HAVE_short_xor_write)
# define AO_short_xor_write(addr, val) AO_short_xor_full(addr, val)
# define AO_HAVE_short_xor_write
# endif
# if !defined(AO_HAVE_short_xor_read)
# define AO_short_xor_read(addr, val) AO_short_xor_full(addr, val)
# define AO_HAVE_short_xor_read
# endif
#endif
#if !defined(AO_HAVE_short_xor) && defined(AO_HAVE_short_xor_release)
# define AO_short_xor(addr, val) AO_short_xor_release(addr, val)
# define AO_HAVE_short_xor
#endif
#if !defined(AO_HAVE_short_xor) && defined(AO_HAVE_short_xor_acquire)
# define AO_short_xor(addr, val) AO_short_xor_acquire(addr, val)
# define AO_HAVE_short_xor
#endif
#if !defined(AO_HAVE_short_xor) && defined(AO_HAVE_short_xor_write)
# define AO_short_xor(addr, val) AO_short_xor_write(addr, val)
# define AO_HAVE_short_xor
#endif
#if !defined(AO_HAVE_short_xor) && defined(AO_HAVE_short_xor_read)
# define AO_short_xor(addr, val) AO_short_xor_read(addr, val)
# define AO_HAVE_short_xor
#endif
#if defined(AO_HAVE_short_xor_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_short_xor_full)
# define AO_short_xor_full(addr, val) \
(AO_nop_full(), AO_short_xor_acquire(addr, val))
# define AO_HAVE_short_xor_full
#endif
#if !defined(AO_HAVE_short_xor_release_write) \
&& defined(AO_HAVE_short_xor_write)
# define AO_short_xor_release_write(addr, val) AO_short_xor_write(addr, val)
# define AO_HAVE_short_xor_release_write
#endif
#if !defined(AO_HAVE_short_xor_release_write) \
&& defined(AO_HAVE_short_xor_release)
# define AO_short_xor_release_write(addr, val) AO_short_xor_release(addr, val)
# define AO_HAVE_short_xor_release_write
#endif
#if !defined(AO_HAVE_short_xor_acquire_read) \
&& defined(AO_HAVE_short_xor_read)
# define AO_short_xor_acquire_read(addr, val) AO_short_xor_read(addr, val)
# define AO_HAVE_short_xor_acquire_read
#endif
#if !defined(AO_HAVE_short_xor_acquire_read) \
&& defined(AO_HAVE_short_xor_acquire)
# define AO_short_xor_acquire_read(addr, val) AO_short_xor_acquire(addr, val)
# define AO_HAVE_short_xor_acquire_read
#endif
#if !defined(AO_ATOMIC_OPS_H) || defined(AO_ATOMIC_OPS_INCLUDED)
# error This file should not be included directly.
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_full) \
&& !defined(AO_HAVE_int_compare_and_swap_full)
AO_INLINE int
AO_int_compare_and_swap_full(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap_full(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_int_compare_and_swap_full
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_acquire) \
&& !defined(AO_HAVE_int_compare_and_swap_acquire)
AO_INLINE int
AO_int_compare_and_swap_acquire(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap_acquire(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_int_compare_and_swap_acquire
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_release) \
&& !defined(AO_HAVE_int_compare_and_swap_release)
AO_INLINE int
AO_int_compare_and_swap_release(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap_release(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_int_compare_and_swap_release
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_write) \
&& !defined(AO_HAVE_int_compare_and_swap_write)
AO_INLINE int
AO_int_compare_and_swap_write(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap_write(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_int_compare_and_swap_write
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_read) \
&& !defined(AO_HAVE_int_compare_and_swap_read)
AO_INLINE int
AO_int_compare_and_swap_read(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap_read(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_int_compare_and_swap_read
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap) \
&& !defined(AO_HAVE_int_compare_and_swap)
AO_INLINE int
AO_int_compare_and_swap(volatile unsigned *addr, unsigned old_val,
unsigned new_val)
{
return AO_int_fetch_compare_and_swap(addr, old_val, new_val) == old_val;
}
# define AO_HAVE_int_compare_and_swap
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_release_write) \
&& !defined(AO_HAVE_int_compare_and_swap_release_write)
AO_INLINE int
AO_int_compare_and_swap_release_write(volatile unsigned *addr,
unsigned old_val, unsigned new_val)
{
return AO_int_fetch_compare_and_swap_release_write(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_int_compare_and_swap_release_write
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_acquire_read) \
&& !defined(AO_HAVE_int_compare_and_swap_acquire_read)
AO_INLINE int
AO_int_compare_and_swap_acquire_read(volatile unsigned *addr,
unsigned old_val, unsigned new_val)
{
return AO_int_fetch_compare_and_swap_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_int_compare_and_swap_acquire_read
#endif
#if defined(AO_HAVE_int_fetch_compare_and_swap_dd_acquire_read) \
&& !defined(AO_HAVE_int_compare_and_swap_dd_acquire_read)
AO_INLINE int
AO_int_compare_and_swap_dd_acquire_read(volatile unsigned *addr,
unsigned old_val, unsigned new_val)
{
return AO_int_fetch_compare_and_swap_dd_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_int_compare_and_swap_dd_acquire_read
#endif
#if defined(AO_HAVE_int_compare_and_swap_full) \
&& !defined(AO_HAVE_int_fetch_and_add_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsigned
AO_int_fetch_and_add_full(volatile unsigned *addr, unsigned incr)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_full(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_int_fetch_and_add_full
#endif
#if defined(AO_HAVE_int_compare_and_swap_acquire) \
&& !defined(AO_HAVE_int_fetch_and_add_acquire)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsigned
AO_int_fetch_and_add_acquire(volatile unsigned *addr, unsigned incr)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_acquire(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_int_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_int_compare_and_swap_release) \
&& !defined(AO_HAVE_int_fetch_and_add_release)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsigned
AO_int_fetch_and_add_release(volatile unsigned *addr, unsigned incr)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_release(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_int_fetch_and_add_release
#endif
#if defined(AO_HAVE_int_compare_and_swap) \
&& !defined(AO_HAVE_int_fetch_and_add)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE unsigned
AO_int_fetch_and_add(volatile unsigned *addr, unsigned incr)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_int_fetch_and_add
#endif
#if defined(AO_HAVE_int_fetch_and_add_full)
# if !defined(AO_HAVE_int_fetch_and_add_release)
# define AO_int_fetch_and_add_release(addr, val) \
AO_int_fetch_and_add_full(addr, val)
# define AO_HAVE_int_fetch_and_add_release
# endif
# if !defined(AO_HAVE_int_fetch_and_add_acquire)
# define AO_int_fetch_and_add_acquire(addr, val) \
AO_int_fetch_and_add_full(addr, val)
# define AO_HAVE_int_fetch_and_add_acquire
# endif
# if !defined(AO_HAVE_int_fetch_and_add_write)
# define AO_int_fetch_and_add_write(addr, val) \
AO_int_fetch_and_add_full(addr, val)
# define AO_HAVE_int_fetch_and_add_write
# endif
# if !defined(AO_HAVE_int_fetch_and_add_read)
# define AO_int_fetch_and_add_read(addr, val) \
AO_int_fetch_and_add_full(addr, val)
# define AO_HAVE_int_fetch_and_add_read
# endif
#endif
#if defined(AO_HAVE_int_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_fetch_and_add_acquire)
AO_INLINE unsigned
AO_int_fetch_and_add_acquire(volatile unsigned *addr, unsigned incr)
{
unsigned result = AO_int_fetch_and_add(addr, incr);
AO_nop_full();
return result;
}
# define AO_HAVE_int_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_int_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_fetch_and_add_release)
# define AO_int_fetch_and_add_release(addr, incr) \
(AO_nop_full(), AO_int_fetch_and_add(addr, incr))
# define AO_HAVE_int_fetch_and_add_release
#endif
#if !defined(AO_HAVE_int_fetch_and_add) \
&& defined(AO_HAVE_int_fetch_and_add_release)
# define AO_int_fetch_and_add(addr, val) \
AO_int_fetch_and_add_release(addr, val)
# define AO_HAVE_int_fetch_and_add
#endif
#if !defined(AO_HAVE_int_fetch_and_add) \
&& defined(AO_HAVE_int_fetch_and_add_acquire)
# define AO_int_fetch_and_add(addr, val) \
AO_int_fetch_and_add_acquire(addr, val)
# define AO_HAVE_int_fetch_and_add
#endif
#if !defined(AO_HAVE_int_fetch_and_add) \
&& defined(AO_HAVE_int_fetch_and_add_write)
# define AO_int_fetch_and_add(addr, val) \
AO_int_fetch_and_add_write(addr, val)
# define AO_HAVE_int_fetch_and_add
#endif
#if !defined(AO_HAVE_int_fetch_and_add) \
&& defined(AO_HAVE_int_fetch_and_add_read)
# define AO_int_fetch_and_add(addr, val) \
AO_int_fetch_and_add_read(addr, val)
# define AO_HAVE_int_fetch_and_add
#endif
#if defined(AO_HAVE_int_fetch_and_add_acquire) \
&& defined(AO_HAVE_nop_full) && !defined(AO_HAVE_int_fetch_and_add_full)
# define AO_int_fetch_and_add_full(addr, val) \
(AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val))
# define AO_HAVE_int_fetch_and_add_full
#endif
#if !defined(AO_HAVE_int_fetch_and_add_release_write) \
&& defined(AO_HAVE_int_fetch_and_add_write)
# define AO_int_fetch_and_add_release_write(addr, val) \
AO_int_fetch_and_add_write(addr, val)
# define AO_HAVE_int_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_add_release_write) \
&& defined(AO_HAVE_int_fetch_and_add_release)
# define AO_int_fetch_and_add_release_write(addr, val) \
AO_int_fetch_and_add_release(addr, val)
# define AO_HAVE_int_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_add_read)
# define AO_int_fetch_and_add_acquire_read(addr, val) \
AO_int_fetch_and_add_read(addr, val)
# define AO_HAVE_int_fetch_and_add_acquire_read
#endif
#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_add_acquire)
# define AO_int_fetch_and_add_acquire_read(addr, val) \
AO_int_fetch_and_add_acquire(addr, val)
# define AO_HAVE_int_fetch_and_add_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_int_fetch_and_add_acquire_read)
# define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
AO_int_fetch_and_add_acquire_read(addr, val)
# define AO_HAVE_int_fetch_and_add_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_int_fetch_and_add)
# define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
AO_int_fetch_and_add(addr, val)
# define AO_HAVE_int_fetch_and_add_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_int_fetch_and_add_full) \
&& !defined(AO_HAVE_int_fetch_and_add1_full)
# define AO_int_fetch_and_add1_full(addr) \
AO_int_fetch_and_add_full(addr, 1)
# define AO_HAVE_int_fetch_and_add1_full
#endif
#if defined(AO_HAVE_int_fetch_and_add_release) \
&& !defined(AO_HAVE_int_fetch_and_add1_release)
# define AO_int_fetch_and_add1_release(addr) \
AO_int_fetch_and_add_release(addr, 1)
# define AO_HAVE_int_fetch_and_add1_release
#endif
#if defined(AO_HAVE_int_fetch_and_add_acquire) \
&& !defined(AO_HAVE_int_fetch_and_add1_acquire)
# define AO_int_fetch_and_add1_acquire(addr) \
AO_int_fetch_and_add_acquire(addr, 1)
# define AO_HAVE_int_fetch_and_add1_acquire
#endif
#if defined(AO_HAVE_int_fetch_and_add_write) \
&& !defined(AO_HAVE_int_fetch_and_add1_write)
# define AO_int_fetch_and_add1_write(addr) \
AO_int_fetch_and_add_write(addr, 1)
# define AO_HAVE_int_fetch_and_add1_write
#endif
#if defined(AO_HAVE_int_fetch_and_add_read) \
&& !defined(AO_HAVE_int_fetch_and_add1_read)
# define AO_int_fetch_and_add1_read(addr) \
AO_int_fetch_and_add_read(addr, 1)
# define AO_HAVE_int_fetch_and_add1_read
#endif
#if defined(AO_HAVE_int_fetch_and_add_release_write) \
&& !defined(AO_HAVE_int_fetch_and_add1_release_write)
# define AO_int_fetch_and_add1_release_write(addr) \
AO_int_fetch_and_add_release_write(addr, 1)
# define AO_HAVE_int_fetch_and_add1_release_write
#endif
#if defined(AO_HAVE_int_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_int_fetch_and_add1_acquire_read)
# define AO_int_fetch_and_add1_acquire_read(addr) \
AO_int_fetch_and_add_acquire_read(addr, 1)
# define AO_HAVE_int_fetch_and_add1_acquire_read
#endif
#if defined(AO_HAVE_int_fetch_and_add) \
&& !defined(AO_HAVE_int_fetch_and_add1)
# define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add(addr, 1)
# define AO_HAVE_int_fetch_and_add1
#endif
#if defined(AO_HAVE_int_fetch_and_add1_full)
# if !defined(AO_HAVE_int_fetch_and_add1_release)
# define AO_int_fetch_and_add1_release(addr) \
AO_int_fetch_and_add1_full(addr)
# define AO_HAVE_int_fetch_and_add1_release
# endif
# if !defined(AO_HAVE_int_fetch_and_add1_acquire)
# define AO_int_fetch_and_add1_acquire(addr) \
AO_int_fetch_and_add1_full(addr)
# define AO_HAVE_int_fetch_and_add1_acquire
# endif
# if !defined(AO_HAVE_int_fetch_and_add1_write)
# define AO_int_fetch_and_add1_write(addr) \
AO_int_fetch_and_add1_full(addr)
# define AO_HAVE_int_fetch_and_add1_write
# endif
# if !defined(AO_HAVE_int_fetch_and_add1_read)
# define AO_int_fetch_and_add1_read(addr) \
AO_int_fetch_and_add1_full(addr)
# define AO_HAVE_int_fetch_and_add1_read
# endif
#endif
#if !defined(AO_HAVE_int_fetch_and_add1) \
&& defined(AO_HAVE_int_fetch_and_add1_release)
# define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_release(addr)
# define AO_HAVE_int_fetch_and_add1
#endif
#if !defined(AO_HAVE_int_fetch_and_add1) \
&& defined(AO_HAVE_int_fetch_and_add1_acquire)
# define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_acquire(addr)
# define AO_HAVE_int_fetch_and_add1
#endif
#if !defined(AO_HAVE_int_fetch_and_add1) \
&& defined(AO_HAVE_int_fetch_and_add1_write)
# define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_write(addr)
# define AO_HAVE_int_fetch_and_add1
#endif
#if !defined(AO_HAVE_int_fetch_and_add1) \
&& defined(AO_HAVE_int_fetch_and_add1_read)
# define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_read(addr)
# define AO_HAVE_int_fetch_and_add1
#endif
#if defined(AO_HAVE_int_fetch_and_add1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_fetch_and_add1_full)
# define AO_int_fetch_and_add1_full(addr) \
(AO_nop_full(), AO_int_fetch_and_add1_acquire(addr))
# define AO_HAVE_int_fetch_and_add1_full
#endif
#if !defined(AO_HAVE_int_fetch_and_add1_release_write) \
&& defined(AO_HAVE_int_fetch_and_add1_write)
# define AO_int_fetch_and_add1_release_write(addr) \
AO_int_fetch_and_add1_write(addr)
# define AO_HAVE_int_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_add1_release_write) \
&& defined(AO_HAVE_int_fetch_and_add1_release)
# define AO_int_fetch_and_add1_release_write(addr) \
AO_int_fetch_and_add1_release(addr)
# define AO_HAVE_int_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_add1_read)
# define AO_int_fetch_and_add1_acquire_read(addr) \
AO_int_fetch_and_add1_read(addr)
# define AO_HAVE_int_fetch_and_add1_acquire_read
#endif
#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_add1_acquire)
# define AO_int_fetch_and_add1_acquire_read(addr) \
AO_int_fetch_and_add1_acquire(addr)
# define AO_HAVE_int_fetch_and_add1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
# define AO_int_fetch_and_add1_dd_acquire_read(addr) \
AO_int_fetch_and_add1_acquire_read(addr)
# define AO_HAVE_int_fetch_and_add1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_int_fetch_and_add1)
# define AO_int_fetch_and_add1_dd_acquire_read(addr) \
AO_int_fetch_and_add1(addr)
# define AO_HAVE_int_fetch_and_add1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_int_fetch_and_add_full) \
&& !defined(AO_HAVE_int_fetch_and_sub1_full)
# define AO_int_fetch_and_sub1_full(addr) \
AO_int_fetch_and_add_full(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_full
#endif
#if defined(AO_HAVE_int_fetch_and_add_release) \
&& !defined(AO_HAVE_int_fetch_and_sub1_release)
# define AO_int_fetch_and_sub1_release(addr) \
AO_int_fetch_and_add_release(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_release
#endif
#if defined(AO_HAVE_int_fetch_and_add_acquire) \
&& !defined(AO_HAVE_int_fetch_and_sub1_acquire)
# define AO_int_fetch_and_sub1_acquire(addr) \
AO_int_fetch_and_add_acquire(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_acquire
#endif
#if defined(AO_HAVE_int_fetch_and_add_write) \
&& !defined(AO_HAVE_int_fetch_and_sub1_write)
# define AO_int_fetch_and_sub1_write(addr) \
AO_int_fetch_and_add_write(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_write
#endif
#if defined(AO_HAVE_int_fetch_and_add_read) \
&& !defined(AO_HAVE_int_fetch_and_sub1_read)
# define AO_int_fetch_and_sub1_read(addr) \
AO_int_fetch_and_add_read(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_read
#endif
#if defined(AO_HAVE_int_fetch_and_add_release_write) \
&& !defined(AO_HAVE_int_fetch_and_sub1_release_write)
# define AO_int_fetch_and_sub1_release_write(addr) \
AO_int_fetch_and_add_release_write(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_release_write
#endif
#if defined(AO_HAVE_int_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
# define AO_int_fetch_and_sub1_acquire_read(addr) \
AO_int_fetch_and_add_acquire_read(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1_acquire_read
#endif
#if defined(AO_HAVE_int_fetch_and_add) \
&& !defined(AO_HAVE_int_fetch_and_sub1)
# define AO_int_fetch_and_sub1(addr) \
AO_int_fetch_and_add(addr, (unsigned)(-1))
# define AO_HAVE_int_fetch_and_sub1
#endif
#if defined(AO_HAVE_int_fetch_and_sub1_full)
# if !defined(AO_HAVE_int_fetch_and_sub1_release)
# define AO_int_fetch_and_sub1_release(addr) \
AO_int_fetch_and_sub1_full(addr)
# define AO_HAVE_int_fetch_and_sub1_release
# endif
# if !defined(AO_HAVE_int_fetch_and_sub1_acquire)
# define AO_int_fetch_and_sub1_acquire(addr) \
AO_int_fetch_and_sub1_full(addr)
# define AO_HAVE_int_fetch_and_sub1_acquire
# endif
# if !defined(AO_HAVE_int_fetch_and_sub1_write)
# define AO_int_fetch_and_sub1_write(addr) \
AO_int_fetch_and_sub1_full(addr)
# define AO_HAVE_int_fetch_and_sub1_write
# endif
# if !defined(AO_HAVE_int_fetch_and_sub1_read)
# define AO_int_fetch_and_sub1_read(addr) \
AO_int_fetch_and_sub1_full(addr)
# define AO_HAVE_int_fetch_and_sub1_read
# endif
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1) \
&& defined(AO_HAVE_int_fetch_and_sub1_release)
# define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_release(addr)
# define AO_HAVE_int_fetch_and_sub1
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1) \
&& defined(AO_HAVE_int_fetch_and_sub1_acquire)
# define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_acquire(addr)
# define AO_HAVE_int_fetch_and_sub1
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1) \
&& defined(AO_HAVE_int_fetch_and_sub1_write)
# define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_write(addr)
# define AO_HAVE_int_fetch_and_sub1
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1) \
&& defined(AO_HAVE_int_fetch_and_sub1_read)
# define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_read(addr)
# define AO_HAVE_int_fetch_and_sub1
#endif
#if defined(AO_HAVE_int_fetch_and_sub1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_fetch_and_sub1_full)
# define AO_int_fetch_and_sub1_full(addr) \
(AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr))
# define AO_HAVE_int_fetch_and_sub1_full
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_int_fetch_and_sub1_write)
# define AO_int_fetch_and_sub1_release_write(addr) \
AO_int_fetch_and_sub1_write(addr)
# define AO_HAVE_int_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_int_fetch_and_sub1_release)
# define AO_int_fetch_and_sub1_release_write(addr) \
AO_int_fetch_and_sub1_release(addr)
# define AO_HAVE_int_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_sub1_read)
# define AO_int_fetch_and_sub1_acquire_read(addr) \
AO_int_fetch_and_sub1_read(addr)
# define AO_HAVE_int_fetch_and_sub1_acquire_read
#endif
#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_int_fetch_and_sub1_acquire)
# define AO_int_fetch_and_sub1_acquire_read(addr) \
AO_int_fetch_and_sub1_acquire(addr)
# define AO_HAVE_int_fetch_and_sub1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
# define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
AO_int_fetch_and_sub1_acquire_read(addr)
# define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_int_fetch_and_sub1)
# define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
AO_int_fetch_and_sub1(addr)
# define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_int_compare_and_swap_full) \
&& !defined(AO_HAVE_int_and_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_int_and_full(volatile unsigned *addr, unsigned value)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_full(addr, old,
old & value)));
}
# define AO_HAVE_int_and_full
#endif
#if defined(AO_HAVE_int_and_full)
# if !defined(AO_HAVE_int_and_release)
# define AO_int_and_release(addr, val) AO_int_and_full(addr, val)
# define AO_HAVE_int_and_release
# endif
# if !defined(AO_HAVE_int_and_acquire)
# define AO_int_and_acquire(addr, val) AO_int_and_full(addr, val)
# define AO_HAVE_int_and_acquire
# endif
# if !defined(AO_HAVE_int_and_write)
# define AO_int_and_write(addr, val) AO_int_and_full(addr, val)
# define AO_HAVE_int_and_write
# endif
# if !defined(AO_HAVE_int_and_read)
# define AO_int_and_read(addr, val) AO_int_and_full(addr, val)
# define AO_HAVE_int_and_read
# endif
#endif
#if !defined(AO_HAVE_int_and) && defined(AO_HAVE_int_and_release)
# define AO_int_and(addr, val) AO_int_and_release(addr, val)
# define AO_HAVE_int_and
#endif
#if !defined(AO_HAVE_int_and) && defined(AO_HAVE_int_and_acquire)
# define AO_int_and(addr, val) AO_int_and_acquire(addr, val)
# define AO_HAVE_int_and
#endif
#if !defined(AO_HAVE_int_and) && defined(AO_HAVE_int_and_write)
# define AO_int_and(addr, val) AO_int_and_write(addr, val)
# define AO_HAVE_int_and
#endif
#if !defined(AO_HAVE_int_and) && defined(AO_HAVE_int_and_read)
# define AO_int_and(addr, val) AO_int_and_read(addr, val)
# define AO_HAVE_int_and
#endif
#if defined(AO_HAVE_int_and_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_and_full)
# define AO_int_and_full(addr, val) \
(AO_nop_full(), AO_int_and_acquire(addr, val))
# define AO_HAVE_int_and_full
#endif
#if !defined(AO_HAVE_int_and_release_write) \
&& defined(AO_HAVE_int_and_write)
# define AO_int_and_release_write(addr, val) AO_int_and_write(addr, val)
# define AO_HAVE_int_and_release_write
#endif
#if !defined(AO_HAVE_int_and_release_write) \
&& defined(AO_HAVE_int_and_release)
# define AO_int_and_release_write(addr, val) AO_int_and_release(addr, val)
# define AO_HAVE_int_and_release_write
#endif
#if !defined(AO_HAVE_int_and_acquire_read) \
&& defined(AO_HAVE_int_and_read)
# define AO_int_and_acquire_read(addr, val) AO_int_and_read(addr, val)
# define AO_HAVE_int_and_acquire_read
#endif
#if !defined(AO_HAVE_int_and_acquire_read) \
&& defined(AO_HAVE_int_and_acquire)
# define AO_int_and_acquire_read(addr, val) AO_int_and_acquire(addr, val)
# define AO_HAVE_int_and_acquire_read
#endif
#if defined(AO_HAVE_int_compare_and_swap_full) \
&& !defined(AO_HAVE_int_or_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_int_or_full(volatile unsigned *addr, unsigned value)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_full(addr, old,
old | value)));
}
# define AO_HAVE_int_or_full
#endif
#if defined(AO_HAVE_int_or_full)
# if !defined(AO_HAVE_int_or_release)
# define AO_int_or_release(addr, val) AO_int_or_full(addr, val)
# define AO_HAVE_int_or_release
# endif
# if !defined(AO_HAVE_int_or_acquire)
# define AO_int_or_acquire(addr, val) AO_int_or_full(addr, val)
# define AO_HAVE_int_or_acquire
# endif
# if !defined(AO_HAVE_int_or_write)
# define AO_int_or_write(addr, val) AO_int_or_full(addr, val)
# define AO_HAVE_int_or_write
# endif
# if !defined(AO_HAVE_int_or_read)
# define AO_int_or_read(addr, val) AO_int_or_full(addr, val)
# define AO_HAVE_int_or_read
# endif
#endif
#if !defined(AO_HAVE_int_or) && defined(AO_HAVE_int_or_release)
# define AO_int_or(addr, val) AO_int_or_release(addr, val)
# define AO_HAVE_int_or
#endif
#if !defined(AO_HAVE_int_or) && defined(AO_HAVE_int_or_acquire)
# define AO_int_or(addr, val) AO_int_or_acquire(addr, val)
# define AO_HAVE_int_or
#endif
#if !defined(AO_HAVE_int_or) && defined(AO_HAVE_int_or_write)
# define AO_int_or(addr, val) AO_int_or_write(addr, val)
# define AO_HAVE_int_or
#endif
#if !defined(AO_HAVE_int_or) && defined(AO_HAVE_int_or_read)
# define AO_int_or(addr, val) AO_int_or_read(addr, val)
# define AO_HAVE_int_or
#endif
#if defined(AO_HAVE_int_or_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_or_full)
# define AO_int_or_full(addr, val) \
(AO_nop_full(), AO_int_or_acquire(addr, val))
# define AO_HAVE_int_or_full
#endif
#if !defined(AO_HAVE_int_or_release_write) \
&& defined(AO_HAVE_int_or_write)
# define AO_int_or_release_write(addr, val) AO_int_or_write(addr, val)
# define AO_HAVE_int_or_release_write
#endif
#if !defined(AO_HAVE_int_or_release_write) \
&& defined(AO_HAVE_int_or_release)
# define AO_int_or_release_write(addr, val) AO_int_or_release(addr, val)
# define AO_HAVE_int_or_release_write
#endif
#if !defined(AO_HAVE_int_or_acquire_read) && defined(AO_HAVE_int_or_read)
# define AO_int_or_acquire_read(addr, val) AO_int_or_read(addr, val)
# define AO_HAVE_int_or_acquire_read
#endif
#if !defined(AO_HAVE_int_or_acquire_read) \
&& defined(AO_HAVE_int_or_acquire)
# define AO_int_or_acquire_read(addr, val) AO_int_or_acquire(addr, val)
# define AO_HAVE_int_or_acquire_read
#endif
#if defined(AO_HAVE_int_compare_and_swap_full) \
&& !defined(AO_HAVE_int_xor_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_int_xor_full(volatile unsigned *addr, unsigned value)
{
unsigned old;
do
{
old = *(unsigned *)addr;
}
while (AO_EXPECT_FALSE(!AO_int_compare_and_swap_full(addr, old,
old ^ value)));
}
# define AO_HAVE_int_xor_full
#endif
#if defined(AO_HAVE_int_xor_full)
# if !defined(AO_HAVE_int_xor_release)
# define AO_int_xor_release(addr, val) AO_int_xor_full(addr, val)
# define AO_HAVE_int_xor_release
# endif
# if !defined(AO_HAVE_int_xor_acquire)
# define AO_int_xor_acquire(addr, val) AO_int_xor_full(addr, val)
# define AO_HAVE_int_xor_acquire
# endif
# if !defined(AO_HAVE_int_xor_write)
# define AO_int_xor_write(addr, val) AO_int_xor_full(addr, val)
# define AO_HAVE_int_xor_write
# endif
# if !defined(AO_HAVE_int_xor_read)
# define AO_int_xor_read(addr, val) AO_int_xor_full(addr, val)
# define AO_HAVE_int_xor_read
# endif
#endif
#if !defined(AO_HAVE_int_xor) && defined(AO_HAVE_int_xor_release)
# define AO_int_xor(addr, val) AO_int_xor_release(addr, val)
# define AO_HAVE_int_xor
#endif
#if !defined(AO_HAVE_int_xor) && defined(AO_HAVE_int_xor_acquire)
# define AO_int_xor(addr, val) AO_int_xor_acquire(addr, val)
# define AO_HAVE_int_xor
#endif
#if !defined(AO_HAVE_int_xor) && defined(AO_HAVE_int_xor_write)
# define AO_int_xor(addr, val) AO_int_xor_write(addr, val)
# define AO_HAVE_int_xor
#endif
#if !defined(AO_HAVE_int_xor) && defined(AO_HAVE_int_xor_read)
# define AO_int_xor(addr, val) AO_int_xor_read(addr, val)
# define AO_HAVE_int_xor
#endif
#if defined(AO_HAVE_int_xor_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_int_xor_full)
# define AO_int_xor_full(addr, val) \
(AO_nop_full(), AO_int_xor_acquire(addr, val))
# define AO_HAVE_int_xor_full
#endif
#if !defined(AO_HAVE_int_xor_release_write) \
&& defined(AO_HAVE_int_xor_write)
# define AO_int_xor_release_write(addr, val) AO_int_xor_write(addr, val)
# define AO_HAVE_int_xor_release_write
#endif
#if !defined(AO_HAVE_int_xor_release_write) \
&& defined(AO_HAVE_int_xor_release)
# define AO_int_xor_release_write(addr, val) AO_int_xor_release(addr, val)
# define AO_HAVE_int_xor_release_write
#endif
#if !defined(AO_HAVE_int_xor_acquire_read) \
&& defined(AO_HAVE_int_xor_read)
# define AO_int_xor_acquire_read(addr, val) AO_int_xor_read(addr, val)
# define AO_HAVE_int_xor_acquire_read
#endif
#if !defined(AO_HAVE_int_xor_acquire_read) \
&& defined(AO_HAVE_int_xor_acquire)
# define AO_int_xor_acquire_read(addr, val) AO_int_xor_acquire(addr, val)
# define AO_HAVE_int_xor_acquire_read
#endif
#if !defined(AO_ATOMIC_OPS_H) || defined(AO_ATOMIC_OPS_INCLUDED)
# error This file should not be included directly.
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_full) \
&& !defined(AO_HAVE_compare_and_swap_full)
AO_INLINE int
AO_compare_and_swap_full(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap_full(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_compare_and_swap_full
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_acquire) \
&& !defined(AO_HAVE_compare_and_swap_acquire)
AO_INLINE int
AO_compare_and_swap_acquire(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap_acquire(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_compare_and_swap_acquire
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_release) \
&& !defined(AO_HAVE_compare_and_swap_release)
AO_INLINE int
AO_compare_and_swap_release(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap_release(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_compare_and_swap_release
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_write) \
&& !defined(AO_HAVE_compare_and_swap_write)
AO_INLINE int
AO_compare_and_swap_write(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap_write(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_compare_and_swap_write
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_read) \
&& !defined(AO_HAVE_compare_and_swap_read)
AO_INLINE int
AO_compare_and_swap_read(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap_read(addr, old_val, new_val)
== old_val;
}
# define AO_HAVE_compare_and_swap_read
#endif
#if defined(AO_HAVE_fetch_compare_and_swap) \
&& !defined(AO_HAVE_compare_and_swap)
AO_INLINE int
AO_compare_and_swap(volatile AO_t *addr, AO_t old_val,
AO_t new_val)
{
return AO_fetch_compare_and_swap(addr, old_val, new_val) == old_val;
}
# define AO_HAVE_compare_and_swap
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_release_write) \
&& !defined(AO_HAVE_compare_and_swap_release_write)
AO_INLINE int
AO_compare_and_swap_release_write(volatile AO_t *addr,
AO_t old_val, AO_t new_val)
{
return AO_fetch_compare_and_swap_release_write(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_compare_and_swap_release_write
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_acquire_read) \
&& !defined(AO_HAVE_compare_and_swap_acquire_read)
AO_INLINE int
AO_compare_and_swap_acquire_read(volatile AO_t *addr,
AO_t old_val, AO_t new_val)
{
return AO_fetch_compare_and_swap_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_compare_and_swap_acquire_read
#endif
#if defined(AO_HAVE_fetch_compare_and_swap_dd_acquire_read) \
&& !defined(AO_HAVE_compare_and_swap_dd_acquire_read)
AO_INLINE int
AO_compare_and_swap_dd_acquire_read(volatile AO_t *addr,
AO_t old_val, AO_t new_val)
{
return AO_fetch_compare_and_swap_dd_acquire_read(addr, old_val,
new_val) == old_val;
}
# define AO_HAVE_compare_and_swap_dd_acquire_read
#endif
#if defined(AO_HAVE_compare_and_swap_full) \
&& !defined(AO_HAVE_fetch_and_add_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE AO_t
AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_full(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_fetch_and_add_full
#endif
#if defined(AO_HAVE_compare_and_swap_acquire) \
&& !defined(AO_HAVE_fetch_and_add_acquire)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE AO_t
AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_acquire(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_compare_and_swap_release) \
&& !defined(AO_HAVE_fetch_and_add_release)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE AO_t
AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_release(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_fetch_and_add_release
#endif
#if defined(AO_HAVE_compare_and_swap) \
&& !defined(AO_HAVE_fetch_and_add)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE AO_t
AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap(addr, old,
old + incr)));
return old;
}
# define AO_HAVE_fetch_and_add
#endif
#if defined(AO_HAVE_fetch_and_add_full)
# if !defined(AO_HAVE_fetch_and_add_release)
# define AO_fetch_and_add_release(addr, val) \
AO_fetch_and_add_full(addr, val)
# define AO_HAVE_fetch_and_add_release
# endif
# if !defined(AO_HAVE_fetch_and_add_acquire)
# define AO_fetch_and_add_acquire(addr, val) \
AO_fetch_and_add_full(addr, val)
# define AO_HAVE_fetch_and_add_acquire
# endif
# if !defined(AO_HAVE_fetch_and_add_write)
# define AO_fetch_and_add_write(addr, val) \
AO_fetch_and_add_full(addr, val)
# define AO_HAVE_fetch_and_add_write
# endif
# if !defined(AO_HAVE_fetch_and_add_read)
# define AO_fetch_and_add_read(addr, val) \
AO_fetch_and_add_full(addr, val)
# define AO_HAVE_fetch_and_add_read
# endif
#endif
#if defined(AO_HAVE_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_fetch_and_add_acquire)
AO_INLINE AO_t
AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
{
AO_t result = AO_fetch_and_add(addr, incr);
AO_nop_full();
return result;
}
# define AO_HAVE_fetch_and_add_acquire
#endif
#if defined(AO_HAVE_fetch_and_add) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_fetch_and_add_release)
# define AO_fetch_and_add_release(addr, incr) \
(AO_nop_full(), AO_fetch_and_add(addr, incr))
# define AO_HAVE_fetch_and_add_release
#endif
#if !defined(AO_HAVE_fetch_and_add) \
&& defined(AO_HAVE_fetch_and_add_release)
# define AO_fetch_and_add(addr, val) \
AO_fetch_and_add_release(addr, val)
# define AO_HAVE_fetch_and_add
#endif
#if !defined(AO_HAVE_fetch_and_add) \
&& defined(AO_HAVE_fetch_and_add_acquire)
# define AO_fetch_and_add(addr, val) \
AO_fetch_and_add_acquire(addr, val)
# define AO_HAVE_fetch_and_add
#endif
#if !defined(AO_HAVE_fetch_and_add) \
&& defined(AO_HAVE_fetch_and_add_write)
# define AO_fetch_and_add(addr, val) \
AO_fetch_and_add_write(addr, val)
# define AO_HAVE_fetch_and_add
#endif
#if !defined(AO_HAVE_fetch_and_add) \
&& defined(AO_HAVE_fetch_and_add_read)
# define AO_fetch_and_add(addr, val) \
AO_fetch_and_add_read(addr, val)
# define AO_HAVE_fetch_and_add
#endif
#if defined(AO_HAVE_fetch_and_add_acquire) \
&& defined(AO_HAVE_nop_full) && !defined(AO_HAVE_fetch_and_add_full)
# define AO_fetch_and_add_full(addr, val) \
(AO_nop_full(), AO_fetch_and_add_acquire(addr, val))
# define AO_HAVE_fetch_and_add_full
#endif
#if !defined(AO_HAVE_fetch_and_add_release_write) \
&& defined(AO_HAVE_fetch_and_add_write)
# define AO_fetch_and_add_release_write(addr, val) \
AO_fetch_and_add_write(addr, val)
# define AO_HAVE_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_fetch_and_add_release_write) \
&& defined(AO_HAVE_fetch_and_add_release)
# define AO_fetch_and_add_release_write(addr, val) \
AO_fetch_and_add_release(addr, val)
# define AO_HAVE_fetch_and_add_release_write
#endif
#if !defined(AO_HAVE_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_fetch_and_add_read)
# define AO_fetch_and_add_acquire_read(addr, val) \
AO_fetch_and_add_read(addr, val)
# define AO_HAVE_fetch_and_add_acquire_read
#endif
#if !defined(AO_HAVE_fetch_and_add_acquire_read) \
&& defined(AO_HAVE_fetch_and_add_acquire)
# define AO_fetch_and_add_acquire_read(addr, val) \
AO_fetch_and_add_acquire(addr, val)
# define AO_HAVE_fetch_and_add_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_fetch_and_add_acquire_read)
# define AO_fetch_and_add_dd_acquire_read(addr, val) \
AO_fetch_and_add_acquire_read(addr, val)
# define AO_HAVE_fetch_and_add_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_fetch_and_add)
# define AO_fetch_and_add_dd_acquire_read(addr, val) \
AO_fetch_and_add(addr, val)
# define AO_HAVE_fetch_and_add_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_fetch_and_add_full) \
&& !defined(AO_HAVE_fetch_and_add1_full)
# define AO_fetch_and_add1_full(addr) \
AO_fetch_and_add_full(addr, 1)
# define AO_HAVE_fetch_and_add1_full
#endif
#if defined(AO_HAVE_fetch_and_add_release) \
&& !defined(AO_HAVE_fetch_and_add1_release)
# define AO_fetch_and_add1_release(addr) \
AO_fetch_and_add_release(addr, 1)
# define AO_HAVE_fetch_and_add1_release
#endif
#if defined(AO_HAVE_fetch_and_add_acquire) \
&& !defined(AO_HAVE_fetch_and_add1_acquire)
# define AO_fetch_and_add1_acquire(addr) \
AO_fetch_and_add_acquire(addr, 1)
# define AO_HAVE_fetch_and_add1_acquire
#endif
#if defined(AO_HAVE_fetch_and_add_write) \
&& !defined(AO_HAVE_fetch_and_add1_write)
# define AO_fetch_and_add1_write(addr) \
AO_fetch_and_add_write(addr, 1)
# define AO_HAVE_fetch_and_add1_write
#endif
#if defined(AO_HAVE_fetch_and_add_read) \
&& !defined(AO_HAVE_fetch_and_add1_read)
# define AO_fetch_and_add1_read(addr) \
AO_fetch_and_add_read(addr, 1)
# define AO_HAVE_fetch_and_add1_read
#endif
#if defined(AO_HAVE_fetch_and_add_release_write) \
&& !defined(AO_HAVE_fetch_and_add1_release_write)
# define AO_fetch_and_add1_release_write(addr) \
AO_fetch_and_add_release_write(addr, 1)
# define AO_HAVE_fetch_and_add1_release_write
#endif
#if defined(AO_HAVE_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_fetch_and_add1_acquire_read)
# define AO_fetch_and_add1_acquire_read(addr) \
AO_fetch_and_add_acquire_read(addr, 1)
# define AO_HAVE_fetch_and_add1_acquire_read
#endif
#if defined(AO_HAVE_fetch_and_add) \
&& !defined(AO_HAVE_fetch_and_add1)
# define AO_fetch_and_add1(addr) AO_fetch_and_add(addr, 1)
# define AO_HAVE_fetch_and_add1
#endif
#if defined(AO_HAVE_fetch_and_add1_full)
# if !defined(AO_HAVE_fetch_and_add1_release)
# define AO_fetch_and_add1_release(addr) \
AO_fetch_and_add1_full(addr)
# define AO_HAVE_fetch_and_add1_release
# endif
# if !defined(AO_HAVE_fetch_and_add1_acquire)
# define AO_fetch_and_add1_acquire(addr) \
AO_fetch_and_add1_full(addr)
# define AO_HAVE_fetch_and_add1_acquire
# endif
# if !defined(AO_HAVE_fetch_and_add1_write)
# define AO_fetch_and_add1_write(addr) \
AO_fetch_and_add1_full(addr)
# define AO_HAVE_fetch_and_add1_write
# endif
# if !defined(AO_HAVE_fetch_and_add1_read)
# define AO_fetch_and_add1_read(addr) \
AO_fetch_and_add1_full(addr)
# define AO_HAVE_fetch_and_add1_read
# endif
#endif
#if !defined(AO_HAVE_fetch_and_add1) \
&& defined(AO_HAVE_fetch_and_add1_release)
# define AO_fetch_and_add1(addr) AO_fetch_and_add1_release(addr)
# define AO_HAVE_fetch_and_add1
#endif
#if !defined(AO_HAVE_fetch_and_add1) \
&& defined(AO_HAVE_fetch_and_add1_acquire)
# define AO_fetch_and_add1(addr) AO_fetch_and_add1_acquire(addr)
# define AO_HAVE_fetch_and_add1
#endif
#if !defined(AO_HAVE_fetch_and_add1) \
&& defined(AO_HAVE_fetch_and_add1_write)
# define AO_fetch_and_add1(addr) AO_fetch_and_add1_write(addr)
# define AO_HAVE_fetch_and_add1
#endif
#if !defined(AO_HAVE_fetch_and_add1) \
&& defined(AO_HAVE_fetch_and_add1_read)
# define AO_fetch_and_add1(addr) AO_fetch_and_add1_read(addr)
# define AO_HAVE_fetch_and_add1
#endif
#if defined(AO_HAVE_fetch_and_add1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_fetch_and_add1_full)
# define AO_fetch_and_add1_full(addr) \
(AO_nop_full(), AO_fetch_and_add1_acquire(addr))
# define AO_HAVE_fetch_and_add1_full
#endif
#if !defined(AO_HAVE_fetch_and_add1_release_write) \
&& defined(AO_HAVE_fetch_and_add1_write)
# define AO_fetch_and_add1_release_write(addr) \
AO_fetch_and_add1_write(addr)
# define AO_HAVE_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_fetch_and_add1_release_write) \
&& defined(AO_HAVE_fetch_and_add1_release)
# define AO_fetch_and_add1_release_write(addr) \
AO_fetch_and_add1_release(addr)
# define AO_HAVE_fetch_and_add1_release_write
#endif
#if !defined(AO_HAVE_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_fetch_and_add1_read)
# define AO_fetch_and_add1_acquire_read(addr) \
AO_fetch_and_add1_read(addr)
# define AO_HAVE_fetch_and_add1_acquire_read
#endif
#if !defined(AO_HAVE_fetch_and_add1_acquire_read) \
&& defined(AO_HAVE_fetch_and_add1_acquire)
# define AO_fetch_and_add1_acquire_read(addr) \
AO_fetch_and_add1_acquire(addr)
# define AO_HAVE_fetch_and_add1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_fetch_and_add1_acquire_read)
# define AO_fetch_and_add1_dd_acquire_read(addr) \
AO_fetch_and_add1_acquire_read(addr)
# define AO_HAVE_fetch_and_add1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_fetch_and_add1)
# define AO_fetch_and_add1_dd_acquire_read(addr) \
AO_fetch_and_add1(addr)
# define AO_HAVE_fetch_and_add1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_fetch_and_add_full) \
&& !defined(AO_HAVE_fetch_and_sub1_full)
# define AO_fetch_and_sub1_full(addr) \
AO_fetch_and_add_full(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_full
#endif
#if defined(AO_HAVE_fetch_and_add_release) \
&& !defined(AO_HAVE_fetch_and_sub1_release)
# define AO_fetch_and_sub1_release(addr) \
AO_fetch_and_add_release(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_release
#endif
#if defined(AO_HAVE_fetch_and_add_acquire) \
&& !defined(AO_HAVE_fetch_and_sub1_acquire)
# define AO_fetch_and_sub1_acquire(addr) \
AO_fetch_and_add_acquire(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_acquire
#endif
#if defined(AO_HAVE_fetch_and_add_write) \
&& !defined(AO_HAVE_fetch_and_sub1_write)
# define AO_fetch_and_sub1_write(addr) \
AO_fetch_and_add_write(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_write
#endif
#if defined(AO_HAVE_fetch_and_add_read) \
&& !defined(AO_HAVE_fetch_and_sub1_read)
# define AO_fetch_and_sub1_read(addr) \
AO_fetch_and_add_read(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_read
#endif
#if defined(AO_HAVE_fetch_and_add_release_write) \
&& !defined(AO_HAVE_fetch_and_sub1_release_write)
# define AO_fetch_and_sub1_release_write(addr) \
AO_fetch_and_add_release_write(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_release_write
#endif
#if defined(AO_HAVE_fetch_and_add_acquire_read) \
&& !defined(AO_HAVE_fetch_and_sub1_acquire_read)
# define AO_fetch_and_sub1_acquire_read(addr) \
AO_fetch_and_add_acquire_read(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1_acquire_read
#endif
#if defined(AO_HAVE_fetch_and_add) \
&& !defined(AO_HAVE_fetch_and_sub1)
# define AO_fetch_and_sub1(addr) \
AO_fetch_and_add(addr, (AO_t)(-1))
# define AO_HAVE_fetch_and_sub1
#endif
#if defined(AO_HAVE_fetch_and_sub1_full)
# if !defined(AO_HAVE_fetch_and_sub1_release)
# define AO_fetch_and_sub1_release(addr) \
AO_fetch_and_sub1_full(addr)
# define AO_HAVE_fetch_and_sub1_release
# endif
# if !defined(AO_HAVE_fetch_and_sub1_acquire)
# define AO_fetch_and_sub1_acquire(addr) \
AO_fetch_and_sub1_full(addr)
# define AO_HAVE_fetch_and_sub1_acquire
# endif
# if !defined(AO_HAVE_fetch_and_sub1_write)
# define AO_fetch_and_sub1_write(addr) \
AO_fetch_and_sub1_full(addr)
# define AO_HAVE_fetch_and_sub1_write
# endif
# if !defined(AO_HAVE_fetch_and_sub1_read)
# define AO_fetch_and_sub1_read(addr) \
AO_fetch_and_sub1_full(addr)
# define AO_HAVE_fetch_and_sub1_read
# endif
#endif
#if !defined(AO_HAVE_fetch_and_sub1) \
&& defined(AO_HAVE_fetch_and_sub1_release)
# define AO_fetch_and_sub1(addr) AO_fetch_and_sub1_release(addr)
# define AO_HAVE_fetch_and_sub1
#endif
#if !defined(AO_HAVE_fetch_and_sub1) \
&& defined(AO_HAVE_fetch_and_sub1_acquire)
# define AO_fetch_and_sub1(addr) AO_fetch_and_sub1_acquire(addr)
# define AO_HAVE_fetch_and_sub1
#endif
#if !defined(AO_HAVE_fetch_and_sub1) \
&& defined(AO_HAVE_fetch_and_sub1_write)
# define AO_fetch_and_sub1(addr) AO_fetch_and_sub1_write(addr)
# define AO_HAVE_fetch_and_sub1
#endif
#if !defined(AO_HAVE_fetch_and_sub1) \
&& defined(AO_HAVE_fetch_and_sub1_read)
# define AO_fetch_and_sub1(addr) AO_fetch_and_sub1_read(addr)
# define AO_HAVE_fetch_and_sub1
#endif
#if defined(AO_HAVE_fetch_and_sub1_acquire) \
&& defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_fetch_and_sub1_full)
# define AO_fetch_and_sub1_full(addr) \
(AO_nop_full(), AO_fetch_and_sub1_acquire(addr))
# define AO_HAVE_fetch_and_sub1_full
#endif
#if !defined(AO_HAVE_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_fetch_and_sub1_write)
# define AO_fetch_and_sub1_release_write(addr) \
AO_fetch_and_sub1_write(addr)
# define AO_HAVE_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_fetch_and_sub1_release_write) \
&& defined(AO_HAVE_fetch_and_sub1_release)
# define AO_fetch_and_sub1_release_write(addr) \
AO_fetch_and_sub1_release(addr)
# define AO_HAVE_fetch_and_sub1_release_write
#endif
#if !defined(AO_HAVE_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_fetch_and_sub1_read)
# define AO_fetch_and_sub1_acquire_read(addr) \
AO_fetch_and_sub1_read(addr)
# define AO_HAVE_fetch_and_sub1_acquire_read
#endif
#if !defined(AO_HAVE_fetch_and_sub1_acquire_read) \
&& defined(AO_HAVE_fetch_and_sub1_acquire)
# define AO_fetch_and_sub1_acquire_read(addr) \
AO_fetch_and_sub1_acquire(addr)
# define AO_HAVE_fetch_and_sub1_acquire_read
#endif
#ifdef AO_NO_DD_ORDERING
# if defined(AO_HAVE_fetch_and_sub1_acquire_read)
# define AO_fetch_and_sub1_dd_acquire_read(addr) \
AO_fetch_and_sub1_acquire_read(addr)
# define AO_HAVE_fetch_and_sub1_dd_acquire_read
# endif
#else
# if defined(AO_HAVE_fetch_and_sub1)
# define AO_fetch_and_sub1_dd_acquire_read(addr) \
AO_fetch_and_sub1(addr)
# define AO_HAVE_fetch_and_sub1_dd_acquire_read
# endif
#endif
#if defined(AO_HAVE_compare_and_swap_full) \
&& !defined(AO_HAVE_and_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_and_full(volatile AO_t *addr, AO_t value)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_full(addr, old,
old & value)));
}
# define AO_HAVE_and_full
#endif
#if defined(AO_HAVE_and_full)
# if !defined(AO_HAVE_and_release)
# define AO_and_release(addr, val) AO_and_full(addr, val)
# define AO_HAVE_and_release
# endif
# if !defined(AO_HAVE_and_acquire)
# define AO_and_acquire(addr, val) AO_and_full(addr, val)
# define AO_HAVE_and_acquire
# endif
# if !defined(AO_HAVE_and_write)
# define AO_and_write(addr, val) AO_and_full(addr, val)
# define AO_HAVE_and_write
# endif
# if !defined(AO_HAVE_and_read)
# define AO_and_read(addr, val) AO_and_full(addr, val)
# define AO_HAVE_and_read
# endif
#endif
#if !defined(AO_HAVE_and) && defined(AO_HAVE_and_release)
# define AO_and(addr, val) AO_and_release(addr, val)
# define AO_HAVE_and
#endif
#if !defined(AO_HAVE_and) && defined(AO_HAVE_and_acquire)
# define AO_and(addr, val) AO_and_acquire(addr, val)
# define AO_HAVE_and
#endif
#if !defined(AO_HAVE_and) && defined(AO_HAVE_and_write)
# define AO_and(addr, val) AO_and_write(addr, val)
# define AO_HAVE_and
#endif
#if !defined(AO_HAVE_and) && defined(AO_HAVE_and_read)
# define AO_and(addr, val) AO_and_read(addr, val)
# define AO_HAVE_and
#endif
#if defined(AO_HAVE_and_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_and_full)
# define AO_and_full(addr, val) \
(AO_nop_full(), AO_and_acquire(addr, val))
# define AO_HAVE_and_full
#endif
#if !defined(AO_HAVE_and_release_write) \
&& defined(AO_HAVE_and_write)
# define AO_and_release_write(addr, val) AO_and_write(addr, val)
# define AO_HAVE_and_release_write
#endif
#if !defined(AO_HAVE_and_release_write) \
&& defined(AO_HAVE_and_release)
# define AO_and_release_write(addr, val) AO_and_release(addr, val)
# define AO_HAVE_and_release_write
#endif
#if !defined(AO_HAVE_and_acquire_read) \
&& defined(AO_HAVE_and_read)
# define AO_and_acquire_read(addr, val) AO_and_read(addr, val)
# define AO_HAVE_and_acquire_read
#endif
#if !defined(AO_HAVE_and_acquire_read) \
&& defined(AO_HAVE_and_acquire)
# define AO_and_acquire_read(addr, val) AO_and_acquire(addr, val)
# define AO_HAVE_and_acquire_read
#endif
#if defined(AO_HAVE_compare_and_swap_full) \
&& !defined(AO_HAVE_or_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_or_full(volatile AO_t *addr, AO_t value)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_full(addr, old,
old | value)));
}
# define AO_HAVE_or_full
#endif
#if defined(AO_HAVE_or_full)
# if !defined(AO_HAVE_or_release)
# define AO_or_release(addr, val) AO_or_full(addr, val)
# define AO_HAVE_or_release
# endif
# if !defined(AO_HAVE_or_acquire)
# define AO_or_acquire(addr, val) AO_or_full(addr, val)
# define AO_HAVE_or_acquire
# endif
# if !defined(AO_HAVE_or_write)
# define AO_or_write(addr, val) AO_or_full(addr, val)
# define AO_HAVE_or_write
# endif
# if !defined(AO_HAVE_or_read)
# define AO_or_read(addr, val) AO_or_full(addr, val)
# define AO_HAVE_or_read
# endif
#endif
#if !defined(AO_HAVE_or) && defined(AO_HAVE_or_release)
# define AO_or(addr, val) AO_or_release(addr, val)
# define AO_HAVE_or
#endif
#if !defined(AO_HAVE_or) && defined(AO_HAVE_or_acquire)
# define AO_or(addr, val) AO_or_acquire(addr, val)
# define AO_HAVE_or
#endif
#if !defined(AO_HAVE_or) && defined(AO_HAVE_or_write)
# define AO_or(addr, val) AO_or_write(addr, val)
# define AO_HAVE_or
#endif
#if !defined(AO_HAVE_or) && defined(AO_HAVE_or_read)
# define AO_or(addr, val) AO_or_read(addr, val)
# define AO_HAVE_or
#endif
#if defined(AO_HAVE_or_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_or_full)
# define AO_or_full(addr, val) \
(AO_nop_full(), AO_or_acquire(addr, val))
# define AO_HAVE_or_full
#endif
#if !defined(AO_HAVE_or_release_write) \
&& defined(AO_HAVE_or_write)
# define AO_or_release_write(addr, val) AO_or_write(addr, val)
# define AO_HAVE_or_release_write
#endif
#if !defined(AO_HAVE_or_release_write) \
&& defined(AO_HAVE_or_release)
# define AO_or_release_write(addr, val) AO_or_release(addr, val)
# define AO_HAVE_or_release_write
#endif
#if !defined(AO_HAVE_or_acquire_read) && defined(AO_HAVE_or_read)
# define AO_or_acquire_read(addr, val) AO_or_read(addr, val)
# define AO_HAVE_or_acquire_read
#endif
#if !defined(AO_HAVE_or_acquire_read) \
&& defined(AO_HAVE_or_acquire)
# define AO_or_acquire_read(addr, val) AO_or_acquire(addr, val)
# define AO_HAVE_or_acquire_read
#endif
#if defined(AO_HAVE_compare_and_swap_full) \
&& !defined(AO_HAVE_xor_full)
AO_ATTR_NO_SANITIZE_THREAD
AO_INLINE void
AO_xor_full(volatile AO_t *addr, AO_t value)
{
AO_t old;
do
{
old = *(AO_t *)addr;
}
while (AO_EXPECT_FALSE(!AO_compare_and_swap_full(addr, old,
old ^ value)));
}
# define AO_HAVE_xor_full
#endif
#if defined(AO_HAVE_xor_full)
# if !defined(AO_HAVE_xor_release)
# define AO_xor_release(addr, val) AO_xor_full(addr, val)
# define AO_HAVE_xor_release
# endif
# if !defined(AO_HAVE_xor_acquire)
# define AO_xor_acquire(addr, val) AO_xor_full(addr, val)
# define AO_HAVE_xor_acquire
# endif
# if !defined(AO_HAVE_xor_write)
# define AO_xor_write(addr, val) AO_xor_full(addr, val)
# define AO_HAVE_xor_write
# endif
# if !defined(AO_HAVE_xor_read)
# define AO_xor_read(addr, val) AO_xor_full(addr, val)
# define AO_HAVE_xor_read
# endif
#endif
#if !defined(AO_HAVE_xor) && defined(AO_HAVE_xor_release)
# define AO_xor(addr, val) AO_xor_release(addr, val)
# define AO_HAVE_xor
#endif
#if !defined(AO_HAVE_xor) && defined(AO_HAVE_xor_acquire)
# define AO_xor(addr, val) AO_xor_acquire(addr, val)
# define AO_HAVE_xor
#endif
#if !defined(AO_HAVE_xor) && defined(AO_HAVE_xor_write)
# define AO_xor(addr, val) AO_xor_write(addr, val)
# define AO_HAVE_xor
#endif
#if !defined(AO_HAVE_xor) && defined(AO_HAVE_xor_read)
# define AO_xor(addr, val) AO_xor_read(addr, val)
# define AO_HAVE_xor
#endif
#if defined(AO_HAVE_xor_acquire) && defined(AO_HAVE_nop_full) \
&& !defined(AO_HAVE_xor_full)
# define AO_xor_full(addr, val) \
(AO_nop_full(), AO_xor_acquire(addr, val))
# define AO_HAVE_xor_full
#endif
#if !defined(AO_HAVE_xor_release_write) \
&& defined(AO_HAVE_xor_write)
# define AO_xor_release_write(addr, val) AO_xor_write(addr, val)
# define AO_HAVE_xor_release_write
#endif
#if !defined(AO_HAVE_xor_release_write) \
&& defined(AO_HAVE_xor_release)
# define AO_xor_release_write(addr, val) AO_xor_release(addr, val)
# define AO_HAVE_xor_release_write
#endif
#if !defined(AO_HAVE_xor_acquire_read) \
&& defined(AO_HAVE_xor_read)
# define AO_xor_acquire_read(addr, val) AO_xor_read(addr, val)
# define AO_HAVE_xor_acquire_read
#endif
#if !defined(AO_HAVE_xor_acquire_read) \
&& defined(AO_HAVE_xor_acquire)
# define AO_xor_acquire_read(addr, val) AO_xor_acquire(addr, val)
# define AO_HAVE_xor_acquire_read
#endif