42 #ifndef QATOMIC_X86_64_H 43 #define QATOMIC_X86_64_H 49 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE 50 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_WAIT_FREE 57 #define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE 58 #define Q_ATOMIC_INT_TEST_AND_SET_IS_WAIT_FREE 65 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE 66 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE 73 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE 74 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_WAIT_FREE 81 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE 82 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_WAIT_FREE 91 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE 92 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE 101 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE 102 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_WAIT_FREE 104 template <
typename T>
107 template <
typename T>
111 #if defined(Q_CC_GNU) || defined(Q_CC_INTEL) 116 asm volatile(
"lock\n" 128 asm volatile(
"lock\n" 140 asm volatile(
"lock\n" 143 :
"=a" (newValue),
"=qm" (ret),
"+m" (
_q_value)
144 :
"r" (newValue),
"0" (expectedValue)
151 asm volatile(
"xchgl %0,%1" 160 asm volatile(
"lock\n" 162 :
"=r" (valueToAdd),
"+m" (
_q_value)
168 template <
typename T>
172 asm volatile(
"lock\n" 175 :
"=a" (newValue),
"=qm" (ret),
"+m" (
_q_value)
176 :
"r" (newValue),
"0" (expectedValue)
181 template <
typename T>
184 asm volatile(
"xchg %0,%1" 191 template <
typename T>
194 asm volatile(
"lock\n" 196 :
"=r" (valueToAdd),
"+m" (
_q_value)
197 :
"0" (valueToAdd *
sizeof(T))
199 return reinterpret_cast<T *
>(valueToAdd);
202 #else // !Q_CC_INTEL && !Q_CC_GNU 240 template <
typename T>
246 template <
typename T>
252 template <
typename T>
258 #endif // Q_CC_GNU || Q_CC_INTEL 305 template <
typename T>
311 template <
typename T>
317 template <
typename T>
323 template <
typename T>
329 template <
typename T>
335 template <
typename T>
341 template <
typename T>
347 template <
typename T>
353 template <
typename T>
363 #endif // QATOMIC_X86_64_H static bool isFetchAndStoreNative()
static bool isTestAndSetNative()
int fetchAndStoreRelease(int newValue)
static bool isReferenceCountingNative()
T * fetchAndAddRelaxed(qptrdiff valueToAdd)
#define QT_END_NAMESPACE
This macro expands to.
static bool isFetchAndAddNative()
static bool isTestAndSetNative()
static bool isFetchAndAddNative()
T * fetchAndStoreRelease(T *newValue)
static bool isTestAndSetWaitFree()
T * fetchAndAddRelease(qptrdiff valueToAdd)
bool testAndSetOrdered(T *expectedValue, T *newValue)
int fetchAndAddAcquire(int valueToAdd)
Q_CORE_EXPORT int q_atomic_fetch_and_add_int(volatile int *ptr, int value)
Q_CORE_EXPORT int q_atomic_increment(volatile int *ptr)
T * fetchAndAddAcquire(qptrdiff valueToAdd)
Q_CORE_EXPORT int q_atomic_test_and_set_ptr(volatile void *ptr, void *expected, void *newval)
int fetchAndStoreRelaxed(int newValue)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
bool testAndSetAcquire(int expectedValue, int newValue)
Q_CORE_EXPORT int q_atomic_set_int(volatile int *ptr, int newval)
Q_CORE_EXPORT int q_atomic_decrement(volatile int *ptr)
bool testAndSetRelaxed(int expectedValue, int newValue)
#define QT_BEGIN_NAMESPACE
This macro expands to.
int fetchAndStoreAcquire(int newValue)
QIntegerForSizeof< void * >::Signed qptrdiff
T * fetchAndStoreOrdered(T *newValue)
#define Q_INLINE_TEMPLATE
int fetchAndAddRelease(int valueToAdd)
const T * ptr(const T &t)
bool testAndSetOrdered(int expectedValue, int newValue)
T * fetchAndStoreAcquire(T *newValue)
Q_CORE_EXPORT void * q_atomic_fetch_and_add_ptr(volatile void *ptr, qptrdiff value)
static bool isFetchAndStoreWaitFree()
static bool isTestAndSetWaitFree()
static bool isReferenceCountingWaitFree()
int fetchAndAddOrdered(int valueToAdd)
static bool isFetchAndStoreWaitFree()
static bool isFetchAndAddWaitFree()
static bool isFetchAndAddWaitFree()
bool testAndSetRelease(int expectedValue, int newValue)
Q_CORE_EXPORT void * q_atomic_set_ptr(volatile void *ptr, void *newval)
int fetchAndAddRelaxed(int valueToAdd)
int fetchAndStoreOrdered(int newValue)
bool testAndSetRelaxed(T *expectedValue, T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
Q_CORE_EXPORT int q_atomic_test_and_set_int(volatile int *ptr, int expected, int newval)
T * fetchAndStoreRelaxed(T *newValue)
static bool isFetchAndStoreNative()
bool testAndSetAcquire(T *expectedValue, T *newValue)