23 #define pg_memory_barrier_impl() __asm__ __volatile__ ("sync" : : : "memory")
24 #define pg_read_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory")
25 #define pg_write_barrier_impl() __asm__ __volatile__ ("lwsync" : : : "memory")
28 #define PG_HAVE_ATOMIC_U32_SUPPORT
35 #if SIZEOF_VOID_P >= 8
36 #define PG_HAVE_ATOMIC_U64_SUPPORT
39 volatile uint64
value pg_attribute_aligned(8);
78 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U32
87 #ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P
88 if (__builtin_constant_p(*expected) &&
100 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
105 __asm__ __volatile__(
107 " lwarx %0,0,%5,1 \n"
114 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
118 ret = (condition_register >> 29) & 1;
129 #define PG_HAVE_ATOMIC_FETCH_ADD_U32
136 #ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P
137 if (__builtin_constant_p(add_) &&
139 __asm__ __volatile__(
141 " lwarx %1,0,%4,1 \n"
146 :
"=&r"(_t),
"=&b"(
res),
"+m"(ptr->
value)
147 :
"i"(add_),
"r"(&ptr->
value)
151 __asm__ __volatile__(
153 " lwarx %1,0,%4,1 \n"
158 :
"=&r"(_t),
"=&r"(
res),
"+m"(ptr->
value)
159 :
"r"(add_),
"r"(&ptr->
value)
165 #ifdef PG_HAVE_ATOMIC_U64_SUPPORT
167 #define PG_HAVE_ATOMIC_COMPARE_EXCHANGE_U64
170 uint64 *expected, uint64
newval)
173 uint32 condition_register;
177 #ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P
178 if (__builtin_constant_p(*expected) &&
181 __asm__ __volatile__(
183 " ldarx %0,0,%5,1 \n"
190 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
195 __asm__ __volatile__(
197 " ldarx %0,0,%5,1 \n"
204 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
208 ret = (condition_register >> 29) & 1;
214 #define PG_HAVE_ATOMIC_FETCH_ADD_U64
222 #ifdef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P
223 if (__builtin_constant_p(add_) &&
225 __asm__ __volatile__(
227 " ldarx %1,0,%4,1 \n"
232 :
"=&r"(_t),
"=&b"(
res),
"+m"(ptr->
value)
233 :
"i"(add_),
"r"(&ptr->
value)
237 __asm__ __volatile__(
239 " ldarx %1,0,%4,1 \n"
244 :
"=&r"(_t),
"=&r"(
res),
"+m"(ptr->
value)
245 :
"r"(add_),
"r"(&ptr->
value)
254 #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)
static void PGresult * res
struct pg_atomic_uint64 pg_atomic_uint64