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)
101 :
"i"(*expected),
"r"(newval),
"r"(&ptr->
value)
105 __asm__ __volatile__(
114 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
115 :
"r"(*expected),
"r"(newval),
"r"(&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__(
146 :
"=&r"(_t),
"=&b"(res),
"+m"(ptr->
value)
147 :
"i"(add_),
"r"(&ptr->
value)
151 __asm__ __volatile__(
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__(
190 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
191 :
"i"(*expected),
"r"(newval),
"r"(&ptr->
value)
195 __asm__ __volatile__(
204 :
"=&r"(found),
"=r"(condition_register),
"+m"(ptr->
value)
205 :
"r"(*expected),
"r"(newval),
"r"(&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__(
232 :
"=&r"(_t),
"=&b"(res),
"+m"(ptr->
value)
233 :
"i"(add_),
"r"(&ptr->
value)
237 __asm__ __volatile__(
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)
struct pg_atomic_uint32 pg_atomic_uint32
static uint32 pg_atomic_fetch_add_u32_impl(volatile pg_atomic_uint32 *ptr, int32 add_)
bool pg_atomic_compare_exchange_u64_impl(volatile pg_atomic_uint64 *ptr, uint64 *expected, uint64 newval)
struct pg_atomic_uint64 pg_atomic_uint64
uint64 pg_atomic_fetch_add_u64_impl(volatile pg_atomic_uint64 *ptr, int64 add_)