From 7a90bbdc60244ae9b0eef03c8353f7fe89c72a99 Mon Sep 17 00:00:00 2001 From: ivmai Date: Tue, 2 Feb 2010 19:42:29 +0000 Subject: [PATCH] 2010-02-02 Ivan Maidanski * src/atomic_ops/sysdeps/sunc/x86.h (AO_test_and_set_full): Fix "xchg" data size (remove "l" suffix). * src/atomic_ops/sysdeps/sunc/x86_64.h (AO_test_and_set_full): Ditto. * src/atomic_ops/sysdeps/sunc/x86_64.h (AO_test_and_set_full): Use AO_TS_t for oldval. * src/atomic_ops/sysdeps/sunc/x86.h (AO_compare_double_and_swap_double_full, AO_HAVE_compare_double_and_swap_double_full): Comment out (since not tested, might be wrong, and tickles a bug in some Sun CC versions; besides, __PIC__ macro is never predefined by Sun CC). --- ChangeLog | 14 ++++++++++++++ src/atomic_ops/sysdeps/sunc/x86.h | 8 +++++--- src/atomic_ops/sysdeps/sunc/x86_64.h | 5 ++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e27588a..afa0ef3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-02-02 Ivan Maidanski + + * src/atomic_ops/sysdeps/sunc/x86.h (AO_test_and_set_full): Fix + "xchg" data size (remove "l" suffix). + * src/atomic_ops/sysdeps/sunc/x86_64.h (AO_test_and_set_full): + Ditto. + * src/atomic_ops/sysdeps/sunc/x86_64.h (AO_test_and_set_full): Use + AO_TS_t for oldval. + * src/atomic_ops/sysdeps/sunc/x86.h + (AO_compare_double_and_swap_double_full, + AO_HAVE_compare_double_and_swap_double_full): Comment out (since + not tested, might be wrong, and tickles a bug in some Sun CC + versions; besides, __PIC__ macro is never predefined by Sun CC). + 2010-01-29 Ivan Maidanski * INSTALL: Regenerate (by autoreconf -vif using libtool-2.2.6b, diff --git a/src/atomic_ops/sysdeps/sunc/x86.h b/src/atomic_ops/sysdeps/sunc/x86.h index a3236b5..96bbe12 100644 --- a/src/atomic_ops/sysdeps/sunc/x86.h +++ b/src/atomic_ops/sysdeps/sunc/x86.h @@ -109,8 +109,7 @@ AO_test_and_set_full(volatile AO_TS_t *addr) { AO_TS_t oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ - /* Note 2: "xchgb" is not recognized by Sun CC assembler yet. */ - __asm__ __volatile__("xchgl %0, %1" + __asm__ __volatile__("xchg %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff) /* , "m"(*addr) */ : "memory"); @@ -133,6 +132,9 @@ AO_compare_and_swap_full(volatile AO_t *addr, #define AO_HAVE_compare_and_swap_full +#if 0 +/* FIXME: not tested (and probably wrong). Besides, */ +/* it tickles a bug in Sun C 5.10 (when optimizing). */ /* Returns nonzero if the comparison succeeded. */ /* Really requires at least a Pentium. */ AO_INLINE int @@ -141,7 +143,6 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, AO_t new_val1, AO_t new_val2) { char result; - /* FIXME: not tested */ #if __PIC__ /* If PIC is turned on, we can't use %ebx as it is reserved for the GOT pointer. We can save and restore %ebx because GCC won't be @@ -167,5 +168,6 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, } #define AO_HAVE_compare_double_and_swap_double_full +#endif #include "../ao_t_is_int.h" diff --git a/src/atomic_ops/sysdeps/sunc/x86_64.h b/src/atomic_ops/sysdeps/sunc/x86_64.h index 9822833..ca5995a 100644 --- a/src/atomic_ops/sysdeps/sunc/x86_64.h +++ b/src/atomic_ops/sysdeps/sunc/x86_64.h @@ -108,10 +108,9 @@ AO_or_full (volatile AO_t *p, AO_t incr) AO_INLINE AO_TS_VAL_t AO_test_and_set_full(volatile AO_TS_t *addr) { - unsigned int oldval; + AO_TS_t oldval; /* Note: the "xchg" instruction does not need a "lock" prefix */ - /* Note 2: "xchgb" is not recognized by Sun CC assembler yet. */ - __asm__ __volatile__("xchgl %0, %1" + __asm__ __volatile__("xchg %0, %1" : "=q"(oldval), "=m"(*addr) : "0"(0xff) /* , "m"(*addr) */ : "memory"); -- 2.40.0