From f79466a8e909930237d882da8916bbbb1401edf6 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 20 Mar 2003 10:18:24 +0000 Subject: Update. 2003-03-20 Ulrich Drepper * include/atomic.h: Define atomic_exchange and atomic_decrement_if_positive if not already defined. Add some __builtin_expect. * sysdeps/i386/i486/bits/atomic.h: Define atomic_exchange. * sysdeps/x86_64/bits/atomic.h: Likewise. * sysdeps/ia64/bits/atomic.h: Pretty printing. Define atomic_exchange. * sysdeps/powerpc/bits/atomic.h: Pretty printing. Define atomic_exchange, atomic_exchange_and_add, and atomic_decrement_if_positive --- sysdeps/ia64/bits/atomic.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'sysdeps/ia64') diff --git a/sysdeps/ia64/bits/atomic.h b/sysdeps/ia64/bits/atomic.h index fab23076cd..7c6ebf13ff 100644 --- a/sysdeps/ia64/bits/atomic.h +++ b/sysdeps/ia64/bits/atomic.h @@ -55,7 +55,7 @@ typedef uintmax_t uatomic_max_t; (!__sync_bool_compare_and_swap_si ((int *) (mem), (int) (long) (oldval), \ (int) (long) (newval))) -# define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \ +#define __arch_compare_and_exchange_64_acq(mem, newval, oldval) \ (!__sync_bool_compare_and_swap_di ((long *) (mem), (long) (oldval), \ (long) (newval))) @@ -63,11 +63,15 @@ typedef uintmax_t uatomic_max_t; __sync_val_compare_and_swap_si ((int *) (mem), (int) (long) (oldval), \ (int) (long) (newval)) -# define __arch_compare_and_exchange_64_val_acq(mem, newval, oldval) \ +#define __arch_compare_and_exchange_64_val_acq(mem, newval, oldval) \ __sync_val_compare_and_swap_di ((long *) (mem), (long) (oldval), \ (long) (newval)) -# define atomic_exchange_and_add(mem, value) \ +/* Atomically store newval and return the old value. */ +#define atomic_exchange(mem, value) \ + __sync_lock_test_and_set_si (mem, value) + +#define atomic_exchange_and_add(mem, value) \ ({ \ __typeof (*mem) __oldval, __val; \ __typeof (mem) __memp = (mem); \ -- cgit 1.4.1