From 859e708f0e44d50deff617c7fd939f4fba295afb Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 26 Mar 2003 04:02:03 +0000 Subject: * csu/tst-atomic.c (do_test): Add some new atomic_compare_and_exchange_val_acq, atomic_add_zero, atomic_compare_and_exchange_bool_acq and atomic_add_negative tests. * include/atomic.h (atomic_add_negative, atomic_add_zero): Prefix local variable so that it doesn't clash with the one in atomic_exchange_and_add. * sysdeps/ia64/bits/atomic.h (atomic_exchange): Fix for long/void * pointers. (atomic_exchange_and_add): Implement using __sync_fetch_and_add_?i. * sysdeps/powerpc/bits/atomic.h (atomic_exchange_and_add): Force value into register. * sysdeps/s390/bits/atomic.h (__arch_compare_and_exchange_val_64_acq): Cast newval to long. * sysdeps/x86_64/bits/atomic.h (__arch_compare_and_exchange_val_64_acq): Cast newval and oldval to long. (atomic_exchange): Cast newvalue to long if sizeof == 8. (atomic_exchange_and_add): Cast value to long if sizeof == 8. (atomic_add, atomic_add_negative, atomic_add_zero): Likewise. (atomic_bit_set): Shift 1L up in all cases to shut up warnings. --- sysdeps/powerpc/bits/atomic.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/bits/atomic.h b/sysdeps/powerpc/bits/atomic.h index e0f2bd4881..bde0ded10b 100644 --- a/sysdeps/powerpc/bits/atomic.h +++ b/sysdeps/powerpc/bits/atomic.h @@ -143,8 +143,8 @@ typedef uintmax_t uatomic_max_t; __typeof (*mem) __val; \ __asm __volatile (__ARCH_REL_INSTR "\n" \ "1: lwarx %0,0,%2\n" \ - " stwcx. %3,0,%2\n" \ - " bne- 1b" \ + " stwcx. %3,0,%2\n" \ + " bne- 1b" \ : "=&r" (__val), "=m" (*mem) \ : "r" (mem), "r" (value), "1" (*mem) \ : "cr0"); \ @@ -155,11 +155,11 @@ typedef uintmax_t uatomic_max_t; ({ \ __typeof (*mem) __val, __tmp; \ __asm __volatile ("1: lwarx %0,0,%3\n" \ - " addi %1,%0,%4\n" \ - " stwcx. %1,0,%3\n" \ - " bne- 1b" \ + " add %1,%0,%4\n" \ + " stwcx. %1,0,%3\n" \ + " bne- 1b" \ : "=&b" (__val), "=&r" (__tmp), "=m" (*mem) \ - : "r" (mem), "I" (value), "2" (*mem) \ + : "r" (mem), "r" (value), "2" (*mem) \ : "cr0"); \ __val; \ }) -- cgit v1.2.3