summaryrefslogtreecommitdiff
path: root/sysdeps/ia64/bits
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-03-20 10:18:24 +0000
committerUlrich Drepper <drepper@redhat.com>2003-03-20 10:18:24 +0000
commitf79466a8e909930237d882da8916bbbb1401edf6 (patch)
tree460afefe452e8550b56d9a01d90dc129012dfd27 /sysdeps/ia64/bits
parent5132931e18d50a1caf7399aa46dafd0142a7c7ae (diff)
Update.
2003-03-20 Ulrich Drepper <drepper@redhat.com> * 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
Diffstat (limited to 'sysdeps/ia64/bits')
-rw-r--r--sysdeps/ia64/bits/atomic.h10
1 files changed, 7 insertions, 3 deletions
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); \