42 #error "atomics.h may not be included from frontend code" 45 #define INSIDE_ATOMICS_H 66 #if defined(__arm__) || defined(__arm) || \ 67 defined(__aarch64__) || defined(__aarch64) 69 #elif defined(__i386__) || defined(__i386) || defined(__x86_64__) 71 #elif defined(__ia64__) || defined(__ia64) 73 #elif defined(__ppc__) || defined(__powerpc__) || defined(__ppc64__) || defined(__powerpc64__) 75 #elif defined(__hppa) || defined(__hppa__) 94 #if (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__IBMC__) || defined(__IBMCPP__)) 96 #elif defined(_MSC_VER) 98 #elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__) 100 #elif defined(__SUNPRO_C) && !defined(__GNUC__) 133 #define pg_compiler_barrier() pg_compiler_barrier_impl() 145 #define pg_memory_barrier() pg_memory_barrier_impl() 158 #define pg_read_barrier() pg_read_barrier_impl() 159 #define pg_write_barrier() pg_write_barrier_impl() 164 #define pg_spin_delay() pg_spin_delay_impl() 296 return pg_atomic_exchange_u32_impl(ptr, newval);
347 return pg_atomic_fetch_sub_u32_impl(ptr, sub_);
361 return pg_atomic_fetch_and_u32_impl(ptr, and_);
375 return pg_atomic_fetch_or_u32_impl(ptr, or_);
389 return pg_atomic_add_fetch_u32_impl(ptr, add_);
405 return pg_atomic_sub_fetch_u32_impl(ptr, sub_);
422 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 431 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 440 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 449 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 452 return pg_atomic_exchange_u64_impl(ptr, newval);
457 uint64 *expected, uint64
newval)
459 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 469 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 478 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 482 return pg_atomic_fetch_sub_u64_impl(ptr, sub_);
488 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 491 return pg_atomic_fetch_and_u64_impl(ptr, and_);
497 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 500 return pg_atomic_fetch_or_u64_impl(ptr, or_);
506 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 509 return pg_atomic_add_fetch_u64_impl(ptr, add_);
515 #ifndef PG_HAVE_ATOMIC_U64_SIMULATION 519 return pg_atomic_sub_fetch_u64_impl(ptr, sub_);
522 #undef INSIDE_ATOMICS_H static uint32 pg_atomic_read_u32_impl(volatile pg_atomic_uint32 *ptr)
static void pg_atomic_clear_flag(volatile pg_atomic_flag *ptr)
static uint32 pg_atomic_fetch_sub_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
static uint64 pg_atomic_fetch_add_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static bool pg_atomic_compare_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
static uint32 pg_atomic_sub_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 sub_)
void pg_atomic_write_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val)
static uint64 pg_atomic_sub_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
static void pg_atomic_unlocked_write_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_clear_flag_impl(volatile pg_atomic_flag *ptr)
bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
static uint32 pg_atomic_add_fetch_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
static uint64 pg_atomic_fetch_sub_u64(volatile pg_atomic_uint64 *ptr, int64 sub_)
static void pg_atomic_write_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
static bool pg_atomic_compare_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
static uint32 pg_atomic_exchange_u32(volatile pg_atomic_uint32 *ptr, uint32 newval)
uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
static uint64 pg_atomic_exchange_u64(volatile pg_atomic_uint64 *ptr, uint64 newval)
static void pg_atomic_init_u64(volatile pg_atomic_uint64 *ptr, uint64 val)
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
static bool pg_atomic_test_set_flag(volatile pg_atomic_flag *ptr)
static uint64 pg_atomic_fetch_or_u64(volatile pg_atomic_uint64 *ptr, uint64 or_)
static uint32 pg_atomic_fetch_and_u32(volatile pg_atomic_uint32 *ptr, uint32 and_)
void pg_atomic_init_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 val_)
void pg_atomic_init_flag_impl(volatile pg_atomic_flag *ptr)
#define AssertPointerAlignment(ptr, bndr)
static uint32 pg_atomic_fetch_add_u32(volatile pg_atomic_uint32 *ptr, int32 add_)
#define Assert(condition)
static uint64 pg_atomic_fetch_and_u64(volatile pg_atomic_uint64 *ptr, uint64 and_)
static bool pg_atomic_unlocked_test_flag(volatile pg_atomic_flag *ptr)
static uint64 pg_atomic_add_fetch_u64(volatile pg_atomic_uint64 *ptr, int64 add_)
static uint64 pg_atomic_read_u64(volatile pg_atomic_uint64 *ptr)
bool pg_atomic_unlocked_test_flag_impl(volatile pg_atomic_flag *ptr)
static void pg_atomic_write_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val)
static void pg_atomic_unlocked_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
bool pg_atomic_test_set_flag_impl(volatile pg_atomic_flag *ptr)
static uint32 pg_atomic_fetch_or_u32(volatile pg_atomic_uint32 *ptr, uint32 or_)
static void pg_atomic_init_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static void pg_atomic_write_u32(volatile pg_atomic_uint32 *ptr, uint32 val)
static void pg_atomic_init_flag(volatile pg_atomic_flag *ptr)
void pg_atomic_init_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 val_)
static uint32 pg_atomic_read_u32(volatile pg_atomic_uint32 *ptr)
static uint64 pg_atomic_read_u64_impl(volatile pg_atomic_uint64 *ptr)