diff options
Diffstat (limited to 'sysdeps/i386/i486')
-rw-r--r-- | sysdeps/i386/i486/bits/atomic.h | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/sysdeps/i386/i486/bits/atomic.h b/sysdeps/i386/i486/bits/atomic.h index 33c47dc63b..aff8cd9f2a 100644 --- a/sysdeps/i386/i486/bits/atomic.h +++ b/sysdeps/i386/i486/bits/atomic.h @@ -46,32 +46,32 @@ typedef intmax_t atomic_max_t; typedef uintmax_t uatomic_max_t; -#ifndef LOCK +#ifndef LOCK_PREFIX # ifdef UP -# define LOCK /* nothing */ +# define LOCK_PREFIX /* nothing */ # else -# define LOCK "lock;" +# define LOCK_PREFIX "lock;" # endif #endif #define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "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 "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 "cmpxchgl %2, %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" (newval), "m" (*mem), "0" (oldval)); \ ret; }) @@ -90,7 +90,7 @@ typedef uintmax_t uatomic_max_t; # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile ("xchgl %2, %%ebx\n\t" \ - LOCK "cmpxchg8b %1\n\t" \ + LOCK_PREFIX "cmpxchg8b %1\n\t" \ "xchgl %2, %%ebx" \ : "=A" (ret), "=m" (*mem) \ : "DS" (((unsigned long long int) (newval)) \ @@ -103,11 +103,11 @@ typedef uintmax_t uatomic_max_t; # else # define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile (LOCK "cmpxchg8b %1" \ + __asm __volatile (LOCK_PREFIX "cmpxchg8b %1" \ : "=A" (ret), "=m" (*mem) \ : "b" (((unsigned long long int) (newval)) \ & 0xffffffff), \ - "c" (((unsigned long long int) (newval)) >> 32), \ + "c" (((unsigned long long int) (newval)) >> 32), \ "m" (*mem), "a" (((unsigned long long int) (oldval)) \ & 0xffffffff), \ "d" (((unsigned long long int) (oldval)) >> 32)); \ @@ -143,15 +143,15 @@ typedef uintmax_t uatomic_max_t; ({ __typeof (*mem) result; \ __typeof (value) addval = (value); \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "xaddb %b0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "xaddw %w0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "xaddl %0, %1" \ + __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \ : "=r" (result), "=m" (*mem) \ : "0" (addval), "m" (*mem)); \ else \ @@ -172,15 +172,15 @@ typedef uintmax_t uatomic_max_t; else if (__builtin_constant_p (value) && (value) == 1) \ atomic_decrement (mem); \ else if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b1, %0" \ + __asm __volatile (LOCK_PREFIX "addb %b1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "addw %w1, %0" \ + __asm __volatile (LOCK_PREFIX "addw %w1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "addl %1, %0" \ + __asm __volatile (LOCK_PREFIX "addl %1, %0" \ : "=m" (*mem) \ : "ir" (value), "m" (*mem)); \ else \ @@ -199,15 +199,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_negative(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "addb %b2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "iq" (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "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) \ - __asm __volatile (LOCK "addl %2, %0; sets %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ @@ -218,15 +218,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_add_zero(mem, value) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "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 "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) \ - __asm __volatile (LOCK "addl %2, %0; setz %1" \ + __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \ : "=m" (*mem), "=qm" (__result) \ : "ir" (value), "m" (*mem)); \ else \ @@ -236,15 +236,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %b0" \ + __asm __volatile (LOCK_PREFIX "incb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %w0" \ + __asm __volatile (LOCK_PREFIX "incw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0" \ + __asm __volatile (LOCK_PREFIX "incl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ @@ -262,15 +262,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_increment_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "incb %0; sete %b1" \ + __asm __volatile (LOCK_PREFIX "incb %0; sete %b1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "incw %0; sete %w1" \ + __asm __volatile (LOCK_PREFIX "incw %0; sete %w1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "incl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ @@ -280,15 +280,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement(mem) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0" \ + __asm __volatile (LOCK_PREFIX "decb %b0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0" \ + __asm __volatile (LOCK_PREFIX "decw %w0" \ : "=m" (*mem) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0" \ + __asm __volatile (LOCK_PREFIX "decl %0" \ : "=m" (*mem) \ : "m" (*mem)); \ else \ @@ -306,15 +306,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_decrement_and_test(mem) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "decb %b0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "decw %w0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "decl %0; sete %1" \ + __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \ : "=m" (*mem), "=qm" (__result) \ : "m" (*mem)); \ else \ @@ -324,15 +324,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_set(mem, bit) \ (void) ({ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "orb %b2, %0" \ + __asm __volatile (LOCK_PREFIX "orb %b2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "orw %w2, %0" \ + __asm __volatile (LOCK_PREFIX "orw %w2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "orl %2, %0" \ + __asm __volatile (LOCK_PREFIX "orl %2, %0" \ : "=m" (*mem) \ : "m" (*mem), "ir" (1 << (bit))); \ else \ @@ -343,15 +343,15 @@ typedef uintmax_t uatomic_max_t; #define atomic_bit_test_set(mem, bit) \ ({ unsigned char __result; \ if (sizeof (*mem) == 1) \ - __asm __volatile (LOCK "btsb %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 2) \ - __asm __volatile (LOCK "btsw %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else if (sizeof (*mem) == 4) \ - __asm __volatile (LOCK "btsl %3, %1; setc %0" \ + __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \ : "=q" (__result), "=m" (*mem) \ : "m" (*mem), "ir" (bit)); \ else \ |