summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/x86_64/bits
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/x86_64/bits')
-rw-r--r--libc/sysdeps/linux/x86_64/bits/atomic.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/libc/sysdeps/linux/x86_64/bits/atomic.h b/libc/sysdeps/linux/x86_64/bits/atomic.h
index 04870cbf5..6739afa43 100644
--- a/libc/sysdeps/linux/x86_64/bits/atomic.h
+++ b/libc/sysdeps/linux/x86_64/bits/atomic.h
@@ -57,28 +57,28 @@ typedef uintmax_t uatomic_max_t;
#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
({ __typeof (*mem) ret; \
- __asm__ __volatile__ (LOCK_PREFIX "cmpxchgb %b2, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "cmpxchgb %b2, %1" \
: "=a" (ret), "=m" (*mem) \
: "q" (newval), "m" (*mem), "0" (oldval)); \
ret; })
#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
({ __typeof (*mem) ret; \
- __asm__ __volatile__ (LOCK_PREFIX "cmpxchgw %w2, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "cmpxchgw %w2, %1" \
: "=a" (ret), "=m" (*mem) \
: "r" (newval), "m" (*mem), "0" (oldval)); \
ret; })
#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
({ __typeof (*mem) ret; \
- __asm__ __volatile__ (LOCK_PREFIX "cmpxchgl %2, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "cmpxchgl %2, %1" \
: "=a" (ret), "=m" (*mem) \
: "r" (newval), "m" (*mem), "0" (oldval)); \
ret; })
#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
({ __typeof (*mem) ret; \
- __asm__ __volatile__ (LOCK_PREFIX "cmpxchgq %q2, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "cmpxchgq %q2, %1" \
: "=a" (ret), "=m" (*mem) \
: "r" ((long) (newval)), "m" (*mem), \
"0" ((long) (oldval))); \
@@ -97,7 +97,7 @@ typedef uintmax_t uatomic_max_t;
: "=r" (result), "=m" (*mem) \
: "0" (newvalue), "m" (*mem)); \
else if (sizeof (*mem) == 4) \
- __asm__ __volatile__ ("xchgl %0, %1" \
+ __asm__ __volatile__ ("xchgl %0, %1" \
: "=r" (result), "=m" (*mem) \
: "0" (newvalue), "m" (*mem)); \
else \
@@ -110,11 +110,11 @@ typedef uintmax_t uatomic_max_t;
#define atomic_exchange_and_add(mem, value) \
({ __typeof (*mem) result; \
if (sizeof (*mem) == 1) \
- __asm__ __volatile__ (LOCK_PREFIX "xaddb %b0, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "xaddb %b0, %1" \
: "=r" (result), "=m" (*mem) \
: "0" (value), "m" (*mem)); \
else if (sizeof (*mem) == 2) \
- __asm__ __volatile__ (LOCK_PREFIX "xaddw %w0, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "xaddw %w0, %1" \
: "=r" (result), "=m" (*mem) \
: "0" (value), "m" (*mem)); \
else if (sizeof (*mem) == 4) \
@@ -122,7 +122,7 @@ typedef uintmax_t uatomic_max_t;
: "=r" (result), "=m" (*mem) \
: "0" (value), "m" (*mem)); \
else \
- __asm__ __volatile__ (LOCK_PREFIX "xaddq %q0, %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "xaddq %q0, %1" \
: "=r" (result), "=m" (*mem) \
: "0" ((long) (value)), "m" (*mem)); \
result; })
@@ -155,11 +155,11 @@ typedef uintmax_t uatomic_max_t;
#define atomic_add_negative(mem, value) \
({ unsigned char __result; \
if (sizeof (*mem) == 1) \
- __asm__ __volatile__ (LOCK_PREFIX "addb %b2, %0; sets %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addb %b2, %0; sets %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else if (sizeof (*mem) == 2) \
- __asm__ __volatile__ (LOCK_PREFIX "addw %w2, %0; sets %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addw %w2, %0; sets %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else if (sizeof (*mem) == 4) \
@@ -167,7 +167,7 @@ typedef uintmax_t uatomic_max_t;
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else \
- __asm__ __volatile__ (LOCK_PREFIX "addq %q2, %0; sets %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addq %q2, %0; sets %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" ((long) (value)), "m" (*mem)); \
__result; })
@@ -176,11 +176,11 @@ typedef uintmax_t uatomic_max_t;
#define atomic_add_zero(mem, value) \
({ unsigned char __result; \
if (sizeof (*mem) == 1) \
- __asm__ __volatile__ (LOCK_PREFIX "addb %b2, %0; setz %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addb %b2, %0; setz %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else if (sizeof (*mem) == 2) \
- __asm__ __volatile__ (LOCK_PREFIX "addw %w2, %0; setz %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addw %w2, %0; setz %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else if (sizeof (*mem) == 4) \
@@ -188,7 +188,7 @@ typedef uintmax_t uatomic_max_t;
: "=m" (*mem), "=qm" (__result) \
: "ir" (value), "m" (*mem)); \
else \
- __asm__ __volatile__ (LOCK_PREFIX "addq %q2, %0; setz %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "addq %q2, %0; setz %1" \
: "=m" (*mem), "=qm" (__result) \
: "ir" ((long) (value)), "m" (*mem)); \
__result; })
@@ -196,19 +196,19 @@ typedef uintmax_t uatomic_max_t;
#define atomic_increment(mem) \
(void) ({ if (sizeof (*mem) == 1) \
- __asm__ __volatile__ (LOCK_PREFIX "incb %b0" \
+ __asm__ __volatile__ (LOCK_PREFIX "incb %b0" \
: "=m" (*mem) \
: "m" (*mem)); \
else if (sizeof (*mem) == 2) \
- __asm__ __volatile__ (LOCK_PREFIX "incw %w0" \
+ __asm__ __volatile__ (LOCK_PREFIX "incw %w0" \
: "=m" (*mem) \
: "m" (*mem)); \
else if (sizeof (*mem) == 4) \
- __asm__ __volatile__ (LOCK_PREFIX "incl %0" \
+ __asm__ __volatile__ (LOCK_PREFIX "incl %0" \
: "=m" (*mem) \
: "m" (*mem)); \
else \
- __asm__ __volatile__ (LOCK_PREFIX "incq %q0" \
+ __asm__ __volatile__ (LOCK_PREFIX "incq %q0" \
: "=m" (*mem) \
: "m" (*mem)); \
})
@@ -225,7 +225,7 @@ typedef uintmax_t uatomic_max_t;
: "=m" (*mem), "=qm" (__result) \
: "m" (*mem)); \
else if (sizeof (*mem) == 4) \
- __asm__ __volatile__ (LOCK_PREFIX "incl %0; sete %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "incl %0; sete %1" \
: "=m" (*mem), "=qm" (__result) \
: "m" (*mem)); \
else \
@@ -237,19 +237,19 @@ typedef uintmax_t uatomic_max_t;
#define atomic_decrement(mem) \
(void) ({ if (sizeof (*mem) == 1) \
- __asm__ __volatile__ (LOCK_PREFIX "decb %b0" \
+ __asm__ __volatile__ (LOCK_PREFIX "decb %b0" \
: "=m" (*mem) \
: "m" (*mem)); \
else if (sizeof (*mem) == 2) \
- __asm__ __volatile__ (LOCK_PREFIX "decw %w0" \
+ __asm__ __volatile__ (LOCK_PREFIX "decw %w0" \
: "=m" (*mem) \
: "m" (*mem)); \
else if (sizeof (*mem) == 4) \
- __asm__ __volatile__ (LOCK_PREFIX "decl %0" \
+ __asm__ __volatile__ (LOCK_PREFIX "decl %0" \
: "=m" (*mem) \
: "m" (*mem)); \
else \
- __asm__ __volatile__ (LOCK_PREFIX "decq %q0" \
+ __asm__ __volatile__ (LOCK_PREFIX "decq %q0" \
: "=m" (*mem) \
: "m" (*mem)); \
})
@@ -266,7 +266,7 @@ typedef uintmax_t uatomic_max_t;
: "=m" (*mem), "=qm" (__result) \
: "m" (*mem)); \
else if (sizeof (*mem) == 4) \
- __asm__ __volatile__ (LOCK_PREFIX "decl %0; sete %1" \
+ __asm__ __volatile__ (LOCK_PREFIX "decl %0; sete %1" \
: "=m" (*mem), "=qm" (__result) \
: "m" (*mem)); \
else \
@@ -314,7 +314,7 @@ typedef uintmax_t uatomic_max_t;
__asm__ __volatile__ (LOCK_PREFIX "btsl %3, %1; setc %0" \
: "=q" (__result), "=m" (*mem) \
: "m" (*mem), "ir" (bit)); \
- else \
+ else \
__asm__ __volatile__ (LOCK_PREFIX "btsq %3, %1; setc %0" \
: "=q" (__result), "=m" (*mem) \
: "m" (*mem), "ir" (bit)); \