34 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
35 #if defined(__i386__) || defined(__i386)
36 #define pg_memory_barrier_impl() \
37 __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory", "cc")
38 #elif defined(__x86_64__)
39 #define pg_memory_barrier_impl() \
40 __asm__ __volatile__ ("lock; addl $0,0(%%rsp)" : : : "memory", "cc")
44 #define pg_read_barrier_impl() pg_compiler_barrier_impl()
45 #define pg_write_barrier_impl() pg_compiler_barrier_impl()
52 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
54 #define PG_HAVE_ATOMIC_FLAG_SUPPORT
55 typedef struct pg_atomic_flag
60 #define PG_HAVE_ATOMIC_U32_SUPPORT
71 #define PG_HAVE_ATOMIC_U64_SUPPORT
75 volatile uint64
value;
81 #if !defined(PG_HAVE_SPIN_DELAY)
105 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
106 #define PG_HAVE_SPIN_DELAY
107 static __inline__
void
110 __asm__ __volatile__(
" rep; nop \n");
112 #elif defined(_MSC_VER) && defined(__x86_64__)
113 #define PG_HAVE_SPIN_DELAY
114 static __forceinline
void
119 #elif defined(_MSC_VER)
120 #define PG_HAVE_SPIN_DELAY
121 static __forceinline
void
131 #if defined(__GNUC__) || defined(__INTEL_COMPILER)
133 #define PG_HAVE_ATOMIC_TEST_SET_FLAG
135 pg_atomic_test_set_flag_impl(
volatile pg_atomic_flag *ptr)
139 __asm__ __volatile__(
142 :
"+q"(_res),
"+m"(ptr->value)
148 #define PG_HAVE_ATOMIC_CLEAR_FLAG
150 pg_atomic_clear_flag_impl(
volatile pg_atomic_flag *ptr)
156 __asm__ __volatile__(
"" :::
"memory");
160 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
171 __asm__ __volatile__(
175 :
"=a" (*expected),
"=m"(ptr->
value),
"=q" (ret)
181 #define PG_HAVE_ATOMIC_FETCH_ADD_U32
186 __asm__ __volatile__(
190 :
"0" (add_),
"m"(ptr->
value)
197 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
200 uint64 *expected, uint64
newval)
210 __asm__ __volatile__(
214 :
"=a" (*expected),
"=m"(ptr->
value),
"=q" (ret)
220 #define PG_HAVE_ATOMIC_FETCH_ADD_U64
225 __asm__ __volatile__(
229 :
"0" (add_),
"m"(ptr->
value)
242 #if defined(__i568__) || defined(__i668__) || \
243 (defined(_M_IX86) && _M_IX86 >= 500) || \
244 defined(__x86_64__) || defined(__x86_64) || defined(_M_X64)
245 #define PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY
static bool pg_atomic_compare_exchange_u32_impl(volatile pg_atomic_uint32 *ptr, uint32 *expected, uint32 newval)
static uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
struct pg_atomic_uint32 pg_atomic_uint32
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
#define AssertPointerAlignment(ptr, bndr)
static void PGresult * res
struct pg_atomic_uint64 pg_atomic_uint64
#define pg_spin_delay_impl()