42 #ifndef QATOMIC_SH4A_H 43 #define QATOMIC_SH4A_H 54 #define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_ALWAYS_NATIVE 61 #define Q_ATOMIC_INT_TEST_AND_SET_IS_ALWAYS_NATIVE 68 #define Q_ATOMIC_INT_FETCH_AND_STORE_IS_ALWAYS_NATIVE 75 #define Q_ATOMIC_INT_FETCH_AND_ADD_IS_ALWAYS_NATIVE 82 #define Q_ATOMIC_POINTER_TEST_AND_SET_IS_ALWAYS_NATIVE 91 #define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_ALWAYS_NATIVE 100 #define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_ALWAYS_NATIVE 102 template <
typename T>
105 template <
typename T>
111 #if !defined(Q_CC_GNU) 112 # error "SH-4A support has not been added for this compiler" 117 register int newValue
asm(
"r0");
119 "movli.l @%[_q_value], %[newValue]\n" 120 "add #1,%[newValue]\n" 121 "movco.l %[newValue], @%[_q_value]\n" 123 : [newValue]
"=&r" (newValue),
127 return newValue != 0;
132 register int newValue
asm(
"r0");
134 "movli.l @%[_q_value], %[newValue]\n" 135 "add #-1,%[newValue]\n" 136 "movco.l %[newValue], @%[_q_value]\n" 138 : [newValue]
"=&r" (newValue),
142 return newValue != 0;
149 "movli.l @%[_q_value], r0\n" 150 "xor %[expectedValue], r0\n" 153 "mov r0, %[result]\n" 154 "mov %[newValue], r0\n" 155 "movco.l r0, @%[_q_value]\n" 158 : [result]
"=&r" (result),
161 [expectedValue]
"r" (expectedValue),
162 [newValue]
"r" (newValue)
163 :
"r0",
"cc",
"memory");
171 "movli.l @%[_q_value], r0\n" 172 "xor %[expectedValue], r0\n" 175 "mov r0, %[result]\n" 176 "mov %[newValue], r0\n" 177 "movco.l r0, @%[_q_value]\n" 181 : [result]
"=&r" (result),
184 [expectedValue]
"r" (expectedValue),
185 [newValue]
"r" (newValue)
186 :
"r0",
"cc",
"memory");
193 asm volatile(
"synco\n" 195 "movli.l @%[_q_value], r0\n" 196 "xor %[expectedValue], r0\n" 199 "mov r0, %[result]\n" 200 "mov %[newValue], r0\n" 201 "movco.l r0, @%[_q_value]\n" 204 : [result]
"=&r" (result),
207 [expectedValue]
"r" (expectedValue),
208 [newValue]
"r" (newValue)
209 :
"r0",
"cc",
"memory");
220 register int originalValue;
222 "movli.l @%[_q_value], r0\n" 223 "mov r0, %[originalValue]\n" 224 "mov %[newValue], r0\n" 225 "movco.l r0, @%[_q_value]\n" 227 : [originalValue]
"=&r" (originalValue),
230 [newValue]
"r" (newValue)
231 :
"r0",
"cc",
"memory");
232 return originalValue;
237 register int originalValue;
239 "movli.l @%[_q_value], r0\n" 240 "mov r0, %[originalValue]\n" 241 "mov %[newValue], r0\n" 242 "movco.l r0, @%[_q_value]\n" 245 : [originalValue]
"=&r" (originalValue),
248 [newValue]
"r" (newValue)
249 :
"r0",
"cc",
"memory");
250 return originalValue;
255 register int originalValue;
256 asm volatile(
"synco\n" 258 "movli.l @%[_q_value], r0\n" 259 "mov r0, %[originalValue]\n" 260 "mov %[newValue], r0\n" 261 "movco.l r0, @%[_q_value]\n" 263 : [originalValue]
"=&r" (originalValue),
266 [newValue]
"r" (newValue)
267 :
"r0",
"cc",
"memory");
268 return originalValue;
278 register int originalValue;
280 "movli.l @%[_q_value], r0\n" 281 "mov r0, %[originalValue]\n" 282 "add %[valueToAdd], r0\n" 283 "movco.l r0, @%[_q_value]\n" 285 : [originalValue]
"=&r" (originalValue),
288 [valueToAdd]
"r" (valueToAdd)
289 :
"r0",
"cc",
"memory");
290 return originalValue;
295 register int originalValue;
297 "movli.l @%[_q_value], r0\n" 298 "mov r0, %[originalValue]\n" 299 "add %[valueToAdd], r0\n" 300 "movco.l r0, @%[_q_value]\n" 303 : [originalValue]
"=&r" (originalValue),
306 [valueToAdd]
"r" (valueToAdd)
307 :
"r0",
"cc",
"memory");
308 return originalValue;
313 register int originalValue;
314 asm volatile(
"synco\n" 316 "movli.l @%[_q_value], r0\n" 317 "mov r0, %[originalValue]\n" 318 "add %[valueToAdd], r0\n" 319 "movco.l r0, @%[_q_value]\n" 321 : [originalValue]
"=&r" (originalValue),
324 [valueToAdd]
"r" (valueToAdd)
325 :
"r0",
"cc",
"memory");
326 return originalValue;
334 template <
typename T>
339 "movli.l @%[_q_value], r0\n" 340 "xor %[expectedValue], r0\n" 343 "mov r0, %[result]\n" 344 "mov %[newValue], r0\n" 345 "movco.l r0, @%[_q_value]\n" 348 : [result]
"=&r" (result),
351 [expectedValue]
"r" (expectedValue),
352 [newValue]
"r" (newValue)
353 :
"r0",
"cc",
"memory");
357 template <
typename T>
362 "movli.l @%[_q_value], r0\n" 363 "xor %[expectedValue], r0\n" 366 "mov r0, %[result]\n" 367 "mov %[newValue], r0\n" 368 "movco.l r0, @%[_q_value]\n" 372 : [result]
"=&r" (result),
375 [expectedValue]
"r" (expectedValue),
376 [newValue]
"r" (newValue)
377 :
"r0",
"cc",
"memory");
381 template <
typename T>
385 asm volatile(
"synco\n" 387 "movli.l @%[_q_value], r0\n" 388 "xor %[expectedValue], r0\n" 391 "mov r0, %[result]\n" 392 "mov %[newValue], r0\n" 393 "movco.l r0, @%[_q_value]\n" 396 : [result]
"=&r" (result),
399 [expectedValue]
"r" (expectedValue),
400 [newValue]
"r" (newValue)
401 :
"r0",
"cc",
"memory");
405 template <
typename T>
411 template <
typename T>
414 register T *originalValue;
416 "movli.l @%[_q_value], r0\n" 417 "mov r0, %[originalValue]\n" 418 "mov %[newValue], r0\n" 419 "movco.l r0, @%[_q_value]\n" 421 : [originalValue]
"=&r" (originalValue),
424 [newValue]
"r" (newValue)
425 :
"r0",
"cc",
"memory");
426 return originalValue;
429 template <
typename T>
432 register T *originalValue;
434 "movli.l @%[_q_value], r0\n" 435 "mov r0, %[originalValue]\n" 436 "mov %[newValue], r0\n" 437 "movco.l r0, @%[_q_value]\n" 440 : [originalValue]
"=&r" (originalValue),
443 [newValue]
"r" (newValue)
444 :
"r0",
"cc",
"memory");
445 return originalValue;
448 template <
typename T>
451 register T *originalValue;
452 asm volatile(
"synco\n" 454 "movli.l @%[_q_value], r0\n" 455 "mov r0, %[originalValue]\n" 456 "mov %[newValue], r0\n" 457 "movco.l r0, @%[_q_value]\n" 459 : [originalValue]
"=&r" (originalValue),
462 [newValue]
"r" (newValue)
463 :
"r0",
"cc",
"memory");
464 return originalValue;
467 template <
typename T>
473 template <
typename T>
476 register T *originalValue;
478 "movli.l @%[_q_value], r0\n" 479 "mov r0, %[originalValue]\n" 480 "add %[valueToAdd], r0\n" 481 "movco.l r0, @%[_q_value]\n" 483 : [originalValue]
"=&r" (originalValue),
486 [valueToAdd]
"r" (valueToAdd *
sizeof(T))
487 :
"r0",
"cc",
"memory");
488 return originalValue;
491 template <
typename T>
494 register T *originalValue;
496 "movli.l @%[_q_value], r0\n" 497 "mov r0, %[originalValue]\n" 498 "add %[valueToAdd], r0\n" 499 "movco.l r0, @%[_q_value]\n" 502 : [originalValue]
"=&r" (originalValue),
505 [valueToAdd]
"r" (valueToAdd *
sizeof(T))
506 :
"r0",
"cc",
"memory");
507 return originalValue;
510 template <
typename T>
513 register T *originalValue;
514 asm volatile(
"synco\n" 516 "movli.l @%[_q_value], r0\n" 517 "mov r0, %[originalValue]\n" 518 "add %[valueToAdd], r0\n" 519 "movco.l r0, @%[_q_value]\n" 521 : [originalValue]
"=&r" (originalValue),
524 [valueToAdd]
"r" (valueToAdd *
sizeof(T))
525 :
"r0",
"cc",
"memory");
526 return originalValue;
529 template <
typename T>
537 #endif // QATOMIC_SH4A_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()
bool testAndSetRelease(int expectedValue, int newValue)
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)