15#define __INLINE__ extern inline __attribute__((always_inline))
19#if defined(__bgq__) || defined(__bgp__) || defined(__powerpc__)
20__INLINE__ int32_t LoadReservedSigned32(
volatile int32_t *pVar )
23 asm volatile (
"lwarx %[rc],0,%[pVar];"
29__INLINE__ int StoreConditionalSigned32(
volatile int32_t *pVar, int32_t Val )
32 asm volatile (
" stwcx. %2,0,%1;"
44__INLINE__ int32_t CompareAndSwapSigned32(
volatile int32_t *var, int32_t Compare, int32_t NewValue )
46 asm volatile (
"msync" : : :
"memory");
48 int32_t OldValue = *var;
51 int32_t TmpValue = LoadReservedSigned32( var );
52 if ( Compare != TmpValue )
return(OldValue);
54 while( !StoreConditionalSigned32( var, NewValue ) );
59__INLINE__ int32_t FetchAndAddSigned32(
volatile int32_t *pVar, int32_t value )
61 asm volatile (
"msync" : : :
"memory");
63 register int32_t old_val, tmp_val;
67 old_val = LoadReservedSigned32( pVar );
68 tmp_val = old_val + value;
70 while ( !StoreConditionalSigned32( pVar, tmp_val ) );
77 asm volatile (
"msync" : : :
"memory");
83#error You cannot use PowerPC assembly on a non-PowerPC architecture!
#define __INLINE__
Definition bgq_atomics.h:15