42 #ifndef QATOMIC_ARMV5_H
43 #define QATOMIC_ARMV5_H
49 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE
56 #define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE
63 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE
64 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_WAIT_FREE
71 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE
78 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE
87 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE
88 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_WAIT_FREE
97 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE
102 template <
typename T>
106 #ifndef QT_NO_ARM_EABI
111 #define qt_atomic_eabi_cmpxchg_int (*reinterpret_cast<qt_atomic_eabi_cmpxchg_int_t *>(0xffff0fc0))
112 #define qt_atomic_eabi_cmpxchg_ptr (*reinterpret_cast<qt_atomic_eabi_cmpxchg_ptr_t *>(0xffff0fc0))
121 Q_CORE_EXPORT __asm
char q_atomic_swp(
volatile char *ptr,
char newval);
125 inline char q_atomic_swp(
volatile char *ptr,
char newval)
128 asm volatile(
"swpb %0,%2,[%3]"
129 :
"=&r"(ret),
"=m" (*ptr)
130 :
"r"(newval),
"r"(ptr)
137 #endif // QT_NO_ARM_EABI
143 #ifndef QT_NO_ARM_EABI
144 register int originalValue;
145 register int newValue;
148 newValue = originalValue + 1;
150 return newValue != 0;
157 return originalValue != -1;
163 #ifndef QT_NO_ARM_EABI
164 register int originalValue;
165 register int newValue;
168 newValue = originalValue - 1;
170 return newValue != 0;
177 return originalValue != 1;
185 #ifndef QT_NO_ARM_EABI
186 register int originalValue;
189 if (originalValue != expectedValue)
194 bool returnValue =
false;
229 #ifndef QT_NO_ARM_EABI
230 asm volatile(
"swp %0,%2,[%3]"
231 :
"=&r"(originalValue),
"=m" (
_q_value)
242 return originalValue;
266 #ifndef QT_NO_ARM_EABI
267 register int originalValue;
268 register int newValue;
271 newValue = originalValue + valueToAdd;
273 return originalValue;
281 return originalValue;
302 template <
typename T>
305 #ifndef QT_NO_ARM_EABI
306 register T *originalValue;
308 originalValue = _q_value;
309 if (originalValue != expectedValue)
314 bool returnValue =
false;
318 if (_q_value == expectedValue) {
327 template <
typename T>
330 return testAndSetOrdered(expectedValue, newValue);
333 template <
typename T>
336 return testAndSetOrdered(expectedValue, newValue);
339 template <
typename T>
342 return testAndSetOrdered(expectedValue, newValue);
349 template <
typename T>
363 template <
typename T>
367 #ifndef QT_NO_ARM_EABI
368 asm volatile(
"swp %0,%2,[%3]"
369 :
"=&r"(originalValue),
"=m" (_q_value)
370 :
"r"(newValue),
"r"(&_q_value)
376 originalValue=_q_value;
380 return originalValue;
385 template <
typename T>
388 return fetchAndStoreOrdered(newValue);
391 template <
typename T>
394 return fetchAndStoreOrdered(newValue);
397 template <
typename T>
400 return fetchAndStoreOrdered(newValue);
405 template <
typename T>
408 #ifndef QT_NO_ARM_EABI
409 register T *originalValue;
410 register T *newValue;
412 originalValue = _q_value;
413 newValue = originalValue + valueToAdd;
415 return originalValue;
420 T *originalValue = (_q_value);
421 _q_value += valueToAdd;
423 return originalValue;
427 template <
typename T>
430 return fetchAndAddOrdered(valueToAdd);
433 template <
typename T>
436 return fetchAndAddOrdered(valueToAdd);
439 template <
typename T>
442 return fetchAndAddOrdered(valueToAdd);
449 #endif // QATOMIC_ARMV5_H
int fetchAndStoreRelaxed(int newValue)
#define qt_atomic_eabi_cmpxchg_int
bool testAndSetRelease(int expectedValue, int newValue)
unsigned int(APIENTRYP PFNGLXGETAGPOFFSETMESAPROC)(const void *pointer)
static bool isFetchAndAddNative()
T * fetchAndAddAcquire(qptrdiff valueToAdd)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
static bool isReferenceCountingNative()
int fetchAndAddRelaxed(int valueToAdd)
T * fetchAndStoreAcquire(T *newValue)
T * fetchAndAddRelease(qptrdiff valueToAdd)
int fetchAndAddAcquire(int valueToAdd)
static bool isReferenceCountingWaitFree()
T * fetchAndAddRelaxed(qptrdiff valueToAdd)
static bool isFetchAndAddNative()
bool testAndSetOrdered(T *expectedValue, T *newValue)
bool testAndSetAcquire(int expectedValue, int newValue)
static bool isFetchAndStoreNative()
#define QT_BEGIN_NAMESPACE
static bool isTestAndSetNative()
static bool isTestAndSetNative()
static bool isFetchAndStoreNative()
T * fetchAndStoreRelaxed(T *newValue)
int( qt_atomic_eabi_cmpxchg_ptr_t)(const void *oldval, const void *newval, volatile void *ptr)
static bool isFetchAndAddWaitFree()
bool testAndSetRelaxed(int expectedValue, int newValue)
Q_CORE_EXPORT void qt_atomic_yield(int *count)
T * fetchAndStoreRelease(T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
GLuint GLuint GLsizei count
static bool isFetchAndStoreWaitFree()
int( qt_atomic_eabi_cmpxchg_int_t)(int oldval, int newval, volatile int *ptr)
static bool isTestAndSetWaitFree()
bool testAndSetAcquire(T *expectedValue, T *newValue)
static bool isFetchAndAddWaitFree()
T * fetchAndStoreOrdered(T *newValue)
static bool isFetchAndStoreWaitFree()
bool testAndSetRelaxed(T *expectedValue, T *newValue)
int fetchAndStoreAcquire(int newValue)
static bool isTestAndSetWaitFree()
bool testAndSetOrdered(int expectedValue, int newValue)
int fetchAndAddOrdered(int valueToAdd)
int fetchAndStoreOrdered(int newValue)
#define qt_atomic_eabi_cmpxchg_ptr
int fetchAndAddRelease(int valueToAdd)
Q_CORE_EXPORT void q_atomic_lock(int *lock)
int fetchAndStoreRelease(int newValue)