42 #ifndef QATOMIC_ARMV6_H 43 #define QATOMIC_ARMV6_H 49 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE 56 #define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE 63 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE 70 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE 77 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE 86 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE 95 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE 100 template <
typename T>
106 #ifndef Q_DATA_MEMORY_BARRIER 107 # define Q_DATA_MEMORY_BARRIER asm volatile("":::"memory") 109 #ifndef Q_COMPILER_MEMORY_BARRIER 110 # define Q_COMPILER_MEMORY_BARRIER asm volatile("":::"memory") 115 register int newValue;
118 "ldrex %[newValue], [%[_q_value]]\n" 119 "add %[newValue], %[newValue], #1\n" 120 "strex %[result], %[newValue], [%[_q_value]]\n" 121 "teq %[result], #0\n" 123 : [newValue]
"=&r" (newValue),
124 [result]
"=&r" (result),
128 return newValue != 0;
133 register int newValue;
136 "ldrex %[newValue], [%[_q_value]]\n" 137 "sub %[newValue], %[newValue], #1\n" 138 "strex %[result], %[newValue], [%[_q_value]]\n" 139 "teq %[result], #0\n" 141 : [newValue]
"=&r" (newValue),
142 [result]
"=&r" (result),
146 return newValue != 0;
153 "ldrex %[result], [%[_q_value]]\n" 154 "eors %[result], %[result], %[expectedValue]\n" 156 "strexeq %[result], %[newValue], [%[_q_value]]\n" 157 "teqeq %[result], #1\n" 159 : [result]
"=&r" (result),
161 : [expectedValue]
"r" (expectedValue),
162 [newValue]
"r" (newValue),
170 register int originalValue;
173 "ldrex %[originalValue], [%[_q_value]]\n" 174 "strex %[result], %[newValue], [%[_q_value]]\n" 175 "teq %[result], #0\n" 177 : [originalValue]
"=&r" (originalValue),
178 [result]
"=&r" (result),
180 : [newValue]
"r" (newValue),
183 return originalValue;
188 register int originalValue;
189 register int newValue;
192 "ldrex %[originalValue], [%[_q_value]]\n" 193 "add %[newValue], %[originalValue], %[valueToAdd]\n" 194 "strex %[result], %[newValue], [%[_q_value]]\n" 195 "teq %[result], #0\n" 197 : [originalValue]
"=&r" (originalValue),
198 [newValue]
"=&r" (newValue),
199 [result]
"=&r" (result),
201 : [valueToAdd]
"r" (valueToAdd),
204 return originalValue;
207 template <
typename T>
212 "ldrex %[result], [%[_q_value]]\n" 213 "eors %[result], %[result], %[expectedValue]\n" 215 "strexeq %[result], %[newValue], [%[_q_value]]\n" 216 "teqeq %[result], #1\n" 218 : [result]
"=&r" (result),
220 : [expectedValue]
"r" (expectedValue),
221 [newValue]
"r" (newValue),
227 template <
typename T>
230 register T *originalValue;
233 "ldrex %[originalValue], [%[_q_value]]\n" 234 "strex %[result], %[newValue], [%[_q_value]]\n" 235 "teq %[result], #0\n" 237 : [originalValue]
"=&r" (originalValue),
238 [result]
"=&r" (result),
240 : [newValue]
"r" (newValue),
243 return originalValue;
246 template <
typename T>
249 register T *originalValue;
250 register T *newValue;
253 "ldrex %[originalValue], [%[_q_value]]\n" 254 "add %[newValue], %[originalValue], %[valueToAdd]\n" 255 "strex %[result], %[newValue], [%[_q_value]]\n" 256 "teq %[result], #0\n" 258 : [originalValue]
"=&r" (originalValue),
259 [newValue]
"=&r" (newValue),
260 [result]
"=&r" (result),
262 : [valueToAdd]
"r" (valueToAdd *
sizeof(T)),
265 return originalValue;
276 #if __TARGET_ARCH_THUMB-0 < 4 282 #ifndef Q_DATA_MEMORY_BARRIER 283 # define Q_DATA_MEMORY_BARRIER __schedule_barrier() 285 #ifndef Q_COMPILER_MEMORY_BARRIER 286 # define Q_COMPILER_MEMORY_BARRIER __schedule_barrier() 291 register int newValue;
296 add newValue, newValue, #1
301 return newValue != 0;
306 register int newValue;
311 sub newValue, newValue, #1
316 return newValue != 0;
325 eors result, result, expectedValue
326 strexeq result, newValue, [&
_q_value]
335 register int originalValue;
344 return originalValue;
349 register int originalValue;
350 register int newValue;
355 add newValue, originalValue, valueToAdd
360 return originalValue;
363 template <
typename T>
370 eors result, result, expectedValue
371 strexeq result, newValue, [&
_q_value]
378 template <
typename T>
381 register T *originalValue;
390 return originalValue;
393 template <
typename T>
396 register T *originalValue;
397 register T *newValue;
402 add newValue, originalValue, valueToAdd *
sizeof(T)
407 return originalValue;
410 #if __TARGET_ARCH_THUMB-0 < 4 482 template <
typename T>
490 template <
typename T>
497 template <
typename T>
506 template <
typename T>
514 template <
typename T>
521 template <
typename T>
530 template <
typename T>
538 template <
typename T>
545 template <
typename T>
554 #undef Q_DATA_MEMORY_BARRIER 555 #undef Q_COMPILER_MEMORY_BARRIER 561 #endif // QATOMIC_ARMV6_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)
T * fetchAndAddAcquire(qptrdiff valueToAdd)
int fetchAndStoreRelaxed(int newValue)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
bool testAndSetAcquire(int expectedValue, int newValue)
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)
bool testAndSetOrdered(int expectedValue, int newValue)
T * fetchAndStoreAcquire(T *newValue)
static bool isFetchAndStoreWaitFree()
static bool isTestAndSetWaitFree()
static bool isReferenceCountingWaitFree()
int fetchAndAddOrdered(int valueToAdd)
static bool isFetchAndStoreWaitFree()
static bool isFetchAndAddWaitFree()
static bool isFetchAndAddWaitFree()
#define Q_COMPILER_MEMORY_BARRIER
bool testAndSetRelease(int expectedValue, int newValue)
#define Q_DATA_MEMORY_BARRIER
int fetchAndAddRelaxed(int valueToAdd)
int fetchAndStoreOrdered(int newValue)
bool testAndSetRelaxed(T *expectedValue, T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
T * fetchAndStoreRelaxed(T *newValue)
static bool isFetchAndStoreNative()
bool testAndSetAcquire(T *expectedValue, T *newValue)