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. */
|
and later, but NOT on i486. */
|
||||||
#if 1
|
#if 1
|
||||||
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
||||||
(abort (), 0)
|
({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
|
||||||
#else
|
#else
|
||||||
# ifdef __PIC__
|
# ifdef __PIC__
|
||||||
# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
|
# 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)); \
|
"d" (((unsigned long long int) (oldval)) >> 32)); \
|
||||||
ret; })
|
ret; })
|
||||||
# else
|
# 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; \
|
({ __typeof (*mem) ret; \
|
||||||
__asm __volatile (LOCK "cmpxchg8b %1" \
|
__asm __volatile (LOCK "cmpxchg8b %1" \
|
||||||
: "=A" (ret), "=m" (*mem) \
|
: "=A" (ret), "=m" (*mem) \
|
||||||
: "b" (((unsigned long long int) (newval)) \
|
: "b" (((unsigned long long int) (newval)) \
|
||||||
& 0xffffffff), \
|
& 0xffffffff), \
|
||||||
"c" (((unsigned long long int) (newval)) >> 32), \
|
"c" (((unsigned long long int) (newval)) >> 32), \
|
||||||
"m" (*mem), "a" (((unsigned long long int) (oldval)) \
|
"m" (*mem), "a" (((unsigned long long int) (oldval)) \
|
||||||
& 0xffffffff), \
|
& 0xffffffff), \
|
||||||
"d" (((unsigned long long int) (oldval)) >> 32)); \
|
"d" (((unsigned long long int) (oldval)) >> 32)); \
|
||||||
|
@ -159,8 +159,9 @@ typedef uintmax_t uatomic_max_t;
|
||||||
__typeof (mem) memp = (mem); \
|
__typeof (mem) memp = (mem); \
|
||||||
do \
|
do \
|
||||||
result = *memp; \
|
result = *memp; \
|
||||||
while (__arch_compare_and_exchange_64_acq (memp, result + addval, \
|
while (__arch_compare_and_exchange_val_64_acq (memp, \
|
||||||
result)); \
|
result + addval, \
|
||||||
|
result) == result); \
|
||||||
} \
|
} \
|
||||||
result; })
|
result; })
|
||||||
|
|
||||||
|
@ -189,9 +190,8 @@ typedef uintmax_t uatomic_max_t;
|
||||||
__typeof (mem) memp = (mem); \
|
__typeof (mem) memp = (mem); \
|
||||||
do \
|
do \
|
||||||
oldval = *memp; \
|
oldval = *memp; \
|
||||||
while (__arch_compare_and_exchange_64_acq (memp, \
|
while (__arch_compare_and_exchange_val_64_acq \
|
||||||
oldval + addval, \
|
(memp, oldval + addval, oldval) == oldval); \
|
||||||
oldval)); \
|
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -253,8 +253,8 @@ typedef uintmax_t uatomic_max_t;
|
||||||
__typeof (mem) memp = (mem); \
|
__typeof (mem) memp = (mem); \
|
||||||
do \
|
do \
|
||||||
oldval = *memp; \
|
oldval = *memp; \
|
||||||
while (__arch_compare_and_exchange_64_acq (memp, oldval + 1, \
|
while (__arch_compare_and_exchange_val_64_acq \
|
||||||
oldval)); \
|
(memp, oldval + 1, oldval) == oldval); \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -297,8 +297,8 @@ typedef uintmax_t uatomic_max_t;
|
||||||
__typeof (mem) memp = (mem); \
|
__typeof (mem) memp = (mem); \
|
||||||
do \
|
do \
|
||||||
oldval = *memp; \
|
oldval = *memp; \
|
||||||
while (__arch_compare_and_exchange_64_acq (memp, oldval - 1, \
|
while (__arch_compare_and_exchange_val_64_acq \
|
||||||
oldval)); \
|
(memp, oldval - 1, oldval) == oldval); \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue