Commit edd2819c authored by David Schleef's avatar David Schleef

Added atomic code for PowerPC

Original commit message from CVS:
Added atomic code for PowerPC
parent 2b647a95
......@@ -163,6 +163,42 @@ G_STMT_START { \
: "ecx", "ebx"); \
} G_STMT_END
#elif defined (__powerpc__) && defined (__GNUC__) && __GNUC__ >= 2
#define _GST_ATOMIC_SWAP_INIT(swap,val) \
G_STMT_START { \
(swap)->value = (gpointer)(val); \
(swap)->cnt = 0; \
} G_STMT_END
#define _GST_ATOMIC_SWAP(swap, val) \
G_STMT_START { \
__asm__ __volatile__ ("1:" \
" lwarx %0, 0, %2 \n" \
" stwcx. %3, 0, %2 \n" \
" bne- 1b \n" \
: "=&r", \
"=m" (*swap) \
: "r" (swap), \
"r" (val), \
"m" (*swap) \
: "cc", "memory"); \
} G_STMT_END
#define _GST_ATOMIC_SWAP_GET(swap, val, res) \
G_STMT_START { \
__asm__ __volatile__ ("1:" \
" lwarx %0, 0, %2 \n" \
" stwcx. %3, 0, %2 \n" \
" bne- 1b \n" \
: "=&r" (*(res)), \
"=m" (*swap) \
: "r" (swap), \
"r" (val), \
"m" (*swap) \
: "cc", "memory"); \
} G_STMT_END
#else
#define _GST_ATOMIC_SWAP_INIT(swap,val) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment