42 #ifndef QATOMIC_BFIN_H
43 #define QATOMIC_BFIN_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_NOT_NATIVE
70 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE
77 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE
86 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE
95 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE
100 template <
typename T>
104 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
107 #include <asm/fixed_code.h>
113 asm volatile(
"R0 = 1;\n\t"
119 :
"R0",
"R1",
"P0",
"RETS",
"memory");
126 asm volatile(
"R0 = 1;\n\t"
132 :
"R0",
"R1",
"P0",
"RETS",
"memory");
139 asm volatile (
"P0 = %2;\n\t"
146 "da" (expectedValue),
150 :
"P0",
"R0",
"R1",
"R2",
"RETS",
"memory",
"cc");
151 return readval == expectedValue;
156 asm volatile(
"R1 = %2;\n\t"
162 :
"R0",
"R1",
"P0",
"RETS",
"memory");
169 asm volatile(
"R0 = %[val];\n\t"
171 "CALL (%[addr]);\n\t"
173 : [ret]
"=da" (ret),
"=m" (
_q_value)
175 :
"R0",
"R1",
"P0",
"RETS",
"memory");
179 template <
typename T>
183 asm volatile (
"P0 = %2;\n\t"
188 :
"=da" (readval),
"=m" (_q_value)
190 "da" (expectedValue),
194 :
"P0",
"R0",
"R1",
"R2",
"RETS",
"memory",
"cc");
195 return readval == expectedValue;
198 template <
typename T>
201 asm volatile(
"R1 = %2;\n\t"
205 :
"=da" (newValue),
"=m" (_q_value)
206 :
"da" (newValue),
"a" (ATOMIC_XCHG32),
"da" (&_q_value),
"m" (_q_value)
207 :
"R0",
"R1",
"P0",
"RETS",
"memory");
211 template <
typename T>
215 asm volatile(
"R0 = %[val];\n\t"
217 "CALL (%[addr]);\n\t"
219 : [ret]
"=da" (ret),
"=m" (_q_value)
220 : [
addr]
"a" (ATOMIC_ADD32), [qvalp]
"da" (&_q_value),
"m" (_q_value), [val]
"da" (valueToAdd *
sizeof(T))
221 :
"R0",
"R1",
"P0",
"RETS",
"memory");
226 #endif // Q_OS_LINUX && Q_CC_GNU
281 template <
typename T>
284 return testAndSetOrdered(expectedValue, newValue);
287 template <
typename T>
290 return testAndSetOrdered(expectedValue, newValue);
293 template <
typename T>
296 return testAndSetOrdered(expectedValue, newValue);
301 template <
typename T>
304 return fetchAndStoreOrdered(newValue);
307 template <
typename T>
310 return fetchAndStoreOrdered(newValue);
313 template <
typename T>
316 return fetchAndStoreOrdered(newValue);
321 template <
typename T>
324 return fetchAndAddOrdered(valueToAdd);
327 template <
typename T>
330 return fetchAndAddOrdered(valueToAdd);
333 template <
typename T>
336 return fetchAndAddOrdered(valueToAdd);
343 #endif // QATOMIC_BFIN_H
int fetchAndStoreRelaxed(int newValue)
bool testAndSetRelease(int expectedValue, int newValue)
static bool isFetchAndAddNative()
T * fetchAndAddAcquire(qptrdiff valueToAdd)
T * fetchAndAddOrdered(qptrdiff valueToAdd)
static bool isReferenceCountingNative()
int fetchAndAddRelaxed(int valueToAdd)
#define QT_END_INCLUDE_NAMESPACE
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)
static bool isFetchAndAddWaitFree()
bool testAndSetRelaxed(int expectedValue, int newValue)
T * fetchAndStoreRelease(T *newValue)
bool testAndSetRelease(T *expectedValue, T *newValue)
GLenum const GLvoid * addr
static bool isFetchAndStoreWaitFree()
static bool isTestAndSetWaitFree()
bool testAndSetAcquire(T *expectedValue, T *newValue)
static bool isFetchAndAddWaitFree()
T * fetchAndStoreOrdered(T *newValue)
#define QT_BEGIN_INCLUDE_NAMESPACE
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)
int fetchAndAddRelease(int valueToAdd)
int fetchAndStoreRelease(int newValue)