42 #error "atomics.h may not be included from frontend code"
45 #define INSIDE_ATOMICS_H
66 #if defined(__arm__) || defined(__arm) || defined(__aarch64__)
68 #elif defined(__i386__) || defined(__i386) || defined(__x86_64__)
70 #elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__)
72 #elif defined(__hppa) || defined(__hppa__)
91 #if (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__IBMC__) || defined(__IBMCPP__))
93 #elif defined(_MSC_VER)
95 #elif defined(__SUNPRO_C) && !defined(__GNUC__)
128 #define pg_compiler_barrier() pg_compiler_barrier_impl()
140 #define pg_memory_barrier() pg_memory_barrier_impl()
153 #define pg_read_barrier() pg_read_barrier_impl()
154 #define pg_write_barrier() pg_write_barrier_impl()
159 #define pg_spin_delay() pg_spin_delay_impl()
291 return pg_atomic_exchange_u32_impl(ptr,
newval);
342 return pg_atomic_fetch_sub_u32_impl(ptr, sub_);
356 return pg_atomic_fetch_and_u32_impl(ptr, and_);
370 return pg_atomic_fetch_or_u32_impl(ptr, or_);
384 return pg_atomic_add_fetch_u32_impl(ptr, add_);
400 return pg_atomic_sub_fetch_u32_impl(ptr, sub_);
417 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
426 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
435 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
444 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
447 return pg_atomic_exchange_u64_impl(ptr,
newval);
452 uint64 *expected, uint64
newval)
454 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
464 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
473 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
477 return pg_atomic_fetch_sub_u64_impl(ptr, sub_);
483 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
486 return pg_atomic_fetch_and_u64_impl(ptr, and_);
492 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
495 return pg_atomic_fetch_or_u64_impl(ptr, or_);
501 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
504 return pg_atomic_add_fetch_u64_impl(ptr, add_);
510 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION
514 return pg_atomic_sub_fetch_u64_impl(ptr, sub_);
517 #undef INSIDE_ATOMICS_H
bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
void pg_atomic_clear_flag_impl(volatile pg_atomic_flag *ptr)
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_)
uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
bool pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
bool pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
void pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val)
void pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_)
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
void pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
static uint32 pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_)
static bool pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
static uint32 pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
static uint32 pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
static bool pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
static void pg_atomic_unlocked_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint32 pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
static uint32 pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
static uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
static bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint64 pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_)
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
static uint64 pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_)
static uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
static uint64 pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
static uint64 pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval)
static void pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
#define AssertPointerAlignment(ptr, bndr)
static void pg_atomic_unlocked_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint64 pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr)
static void pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
static uint32 pg_atomic_read_u32_impl(volatile pg_atomic_uint32 *ptr)
Assert(fmt[strlen(fmt) - 1] !='\n')