diff options
Diffstat (limited to 'sysdeps/x86_64')
-rw-r--r-- | sysdeps/x86_64/bits/atomic.h | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/sysdeps/x86_64/bits/atomic.h b/sysdeps/x86_64/bits/atomic.h index b98c25f1fe..00f55862e6 100644 --- a/sysdeps/x86_64/bits/atomic.h +++ b/sysdeps/x86_64/bits/atomic.h @@ -59,28 +59,28 @@ typedef uintmax_t uatomic_max_t; ({ __typeof (*mem) ret; \ __asm __volatile (LOCK "cmpxchgb %b2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "q" (newval), "1" (*mem), "0" (oldval)); \ + : "q" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile (LOCK "cmpxchgw %w2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "1" (*mem), "0" (oldval)); \ + : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile (LOCK "cmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "1" (*mem), "0" (oldval)); \ + : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile (LOCK "cmpxchgq %q2, %1" \ : "=a" (ret), "=m" (*mem) \ - : "r" (newval), "1" (*mem), "0" (oldval)); \ + : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) @@ -90,19 +90,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile ("xchgb %b0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "1" (*mem)); \ + : "0" (newvalue), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile ("xchgw %w0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "1" (*mem)); \ + : "0" (newvalue), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile ("xchgl %0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "1" (*mem)); \ + : "0" (newvalue), "m" (*mem)); \ else \ __asm __volatile ("xchgq %q0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (newvalue), "1" (*mem)); \ + : "0" (newvalue), "m" (*mem)); \ result; }) @@ -111,19 +111,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "xaddb %b0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "1" (*mem)); \ + : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "xaddw %w0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "1" (*mem)); \ + : "0" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "xaddl %0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "1" (*mem)); \ + : "0" (value), "m" (*mem)); \ else \ __asm __volatile (LOCK "xaddq %q0, %1" \ : "=r" (result), "=m" (*mem) \ - : "0" (value), "1" (*mem)); \ + : "0" (value), "m" (*mem)); \ result; }) @@ -135,19 +135,19 @@ typedef uintmax_t uatomic_max_t; else if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "addb %b1, %0" \ : "=m" (*mem) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "addw %w1, %0" \ : "=m" (*mem) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "addl %1, %0" \ : "=m" (*mem) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else \ __asm __volatile (LOCK "addq %q1, %0" \ : "=m" (*mem) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ }) @@ -156,19 +156,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "addb %b2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "addw %w2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "addl %2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else \ __asm __volatile (LOCK "addq %q2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ __result; }) @@ -177,19 +177,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "addb %b2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "addw %w2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "addl %2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ else \ __asm __volatile (LOCK "addq %q2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ - : "ir" (value), "0" (*mem)); \ + : "ir" (value), "m" (*mem)); \ __result; }) @@ -197,19 +197,19 @@ typedef uintmax_t uatomic_max_t; (void) ({ if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "incb %b0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "incw %w0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "incl %0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else \ __asm __volatile (LOCK "incq %q0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ }) @@ -218,19 +218,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "incb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "incw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "incl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else \ __asm __volatile (LOCK "incq %q0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ __result; }) @@ -238,19 +238,19 @@ typedef uintmax_t uatomic_max_t; (void) ({ if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "decb %b0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "decw %w0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "decl %0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else \ __asm __volatile (LOCK "decq %q0" \ : "=m" (*mem) \ - : "0" (*mem)); \ + : "m" (*mem)); \ }) @@ -259,19 +259,19 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "decb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "decw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "decl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ else \ __asm __volatile (LOCK "decq %q0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ - : "0" (*mem)); \ + : "m" (*mem)); \ __result; }) @@ -279,19 +279,19 @@ typedef uintmax_t uatomic_max_t; (void) ({ if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "orb %b2, %0" \ : "=m" (*mem) \ - : "0" (*mem), "i" (1 << (bit))); \ + : "m" (*mem), "i" (1 << (bit))); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "orw %w2, %0" \ : "=m" (*mem) \ - : "0" (*mem), "i" (1 << (bit))); \ + : "m" (*mem), "i" (1 << (bit))); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "orl %2, %0" \ : "=m" (*mem) \ - : "0" (*mem), "i" (1 << (bit))); \ + : "m" (*mem), "i" (1 << (bit))); \ else \ __asm __volatile (LOCK "orq %q2, %0" \ : "=m" (*mem) \ - : "0" (*mem), "i" (1 << (bit))); \ + : "m" (*mem), "i" (1 << (bit))); \ }) @@ -300,17 +300,17 @@ typedef uintmax_t uatomic_max_t; if (sizeof (*mem) == 1) \ __asm __volatile (LOCK "btsb %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ - : "1" (*mem), "i" (bit)); \ + : "m" (*mem), "i" (bit)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (LOCK "btsw %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ - : "1" (*mem), "i" (bit)); \ + : "m" (*mem), "i" (bit)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (LOCK "btsl %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ - : "1" (*mem), "i" (bit)); \ + : "m" (*mem), "i" (bit)); \ else \ __asm __volatile (LOCK "btsq %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ - : "1" (*mem), "i" (bit)); \ + : "m" (*mem), "i" (bit)); \ __result; }) |