mirror of
git://sourceware.org/git/glibc.git
synced 2025-02-17 13:00:43 +08:00
2003-03-21 Roland McGrath <roland@redhat.com>
* sysdeps/i386/i486/bits/atomic.h (__arch_compare_and_exchange_val_64_acq): Rewrite abort-calling version of the macro to avoid compile-time warnings. [! __PIC__] (__arch_compare_and_exchange_64_acq): Rename to above. (__arch_compare_and_exchange_bool_64_acq): New macro. (atomic_exchange_and_add, atomic_add): Fix name and usage of it. (atomic_increment, atomic_decrement): Likewise.
This commit is contained in:
parent
4541b483a9
commit
26f24355d4
@ -84,7 +84,7 @@ typedef uintmax_t uatomic_max_t;
|
||||
and later, but NOT on i486. */
|
||||
#if 1
|
||||
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
||||
(abort (), 0)
|
||||
({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
|
||||
#else
|
||||
# ifdef __PIC__
|
||||
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
||||
@ -101,13 +101,13 @@ typedef uintmax_t uatomic_max_t;
|
||||
"d" (((unsigned long long int) (oldval)) >> 32)); \
|
||||
ret; })
|
||||
# else
|
||||
# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \
|
||||
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
||||
({ __typeof (*mem) ret; \
|
||||
__asm __volatile (LOCK "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)); \
|
||||
@ -159,8 +159,9 @@ typedef uintmax_t uatomic_max_t;
|
||||
__typeof (mem) memp = (mem); \
|
||||
do \
|
||||
result = *memp; \
|
||||
while (__arch_compare_and_exchange_64_acq (memp, result + addval, \
|
||||
result)); \
|
||||
while (__arch_compare_and_exchange_val_64_acq (memp, \
|
||||
result + addval, \
|
||||
result) == result); \
|
||||
} \
|
||||
result; })
|
||||
|
||||
@ -189,9 +190,8 @@ typedef uintmax_t uatomic_max_t;
|
||||
__typeof (mem) memp = (mem); \
|
||||
do \
|
||||
oldval = *memp; \
|
||||
while (__arch_compare_and_exchange_64_acq (memp, \
|
||||
oldval + addval, \
|
||||
oldval)); \
|
||||
while (__arch_compare_and_exchange_val_64_acq \
|
||||
(memp, oldval + addval, oldval) == oldval); \
|
||||
} \
|
||||
})
|
||||
|
||||
@ -253,8 +253,8 @@ typedef uintmax_t uatomic_max_t;
|
||||
__typeof (mem) memp = (mem); \
|
||||
do \
|
||||
oldval = *memp; \
|
||||
while (__arch_compare_and_exchange_64_acq (memp, oldval + 1, \
|
||||
oldval)); \
|
||||
while (__arch_compare_and_exchange_val_64_acq \
|
||||
(memp, oldval + 1, oldval) == oldval); \
|
||||
} \
|
||||
})
|
||||
|
||||
@ -297,8 +297,8 @@ typedef uintmax_t uatomic_max_t;
|
||||
__typeof (mem) memp = (mem); \
|
||||
do \
|
||||
oldval = *memp; \
|
||||
while (__arch_compare_and_exchange_64_acq (memp, oldval - 1, \
|
||||
oldval)); \
|
||||
while (__arch_compare_and_exchange_val_64_acq \
|
||||
(memp, oldval - 1, oldval) == oldval); \
|
||||
} \
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user