This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Remove MIPS16 atomics using __sync_* (bug 17404) [committed]


MIPS16 atomics used __sync_* with GCC before 4.7, which as noted in
bug 17404 is missing the required barrier semantics for
atomic_exchange_rel.  This patch removes the code in question as dead
now GCC before 4.7 is no longer supported for building glibc.

Sanity tested with builds for MIPS.  Committed.

2015-10-27  Joseph Myers  <joseph@codesourcery.com>

	[BZ #17404]
	* sysdeps/mips/atomic-machine.h
	[__GNUC_PREREQ (4, 8) || (__mips16 && __GNUC_PREREQ (4, 7))]:
	Change conditional to [__GNUC_PREREQ (4, 8) || __mips16].
	[__mips16 && !__GNUC_PREREQ (4, 7)]: Remove conditional code.

diff --git a/sysdeps/mips/atomic-machine.h b/sysdeps/mips/atomic-machine.h
index 6db8fee..f0a8902 100644
--- a/sysdeps/mips/atomic-machine.h
+++ b/sysdeps/mips/atomic-machine.h
@@ -85,7 +85,7 @@ typedef uintmax_t uatomic_max_t;
 #define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X)
 #define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC)
 
-#if __GNUC_PREREQ (4, 8) || (defined __mips16 && __GNUC_PREREQ (4, 7))
+#if __GNUC_PREREQ (4, 8) || defined __mips16
 /* The __atomic_* builtins are available in GCC 4.7 and later, but MIPS
    support for their efficient implementation was added only in GCC 4.8.
    We still want to use them even with GCC 4.7 for MIPS16 code where we
@@ -213,31 +213,6 @@ typedef uintmax_t uatomic_max_t;
   __atomic_val_bysize (__arch_exchange_and_add, int, mem, value,	\
 		       __ATOMIC_RELEASE)
 
-#elif defined __mips16 /* !__GNUC_PREREQ (4, 7) */
-/* This implementation using __sync* builtins will be removed once glibc
-   requires GCC 4.7 or later to build.  */
-
-# define atomic_compare_and_exchange_val_acq(mem, newval, oldval)	\
-  __sync_val_compare_and_swap ((mem), (oldval), (newval))
-# define atomic_compare_and_exchange_bool_acq(mem, newval, oldval)	\
-  (!__sync_bool_compare_and_swap ((mem), (oldval), (newval)))
-
-# define atomic_exchange_acq(mem, newval)				\
-  __sync_lock_test_and_set ((mem), (newval))
-
-# define atomic_exchange_and_add(mem, val)				\
-  __sync_fetch_and_add ((mem), (val))
-
-# define atomic_bit_test_set(mem, bit)					\
-  ({ __typeof (bit) __bit = (bit);					\
-     (__sync_fetch_and_or ((mem), 1 << (__bit)) & (1 << (__bit))); })
-
-# define atomic_and(mem, mask) (void) __sync_fetch_and_and ((mem), (mask))
-# define atomic_and_val(mem, mask) __sync_fetch_and_and ((mem), (mask))
-
-# define atomic_or(mem, mask) (void) __sync_fetch_and_or ((mem), (mask))
-# define atomic_or_val(mem, mask) __sync_fetch_and_or ((mem), (mask))
-
 #else /* !__mips16 && !__GNUC_PREREQ (4, 8) */
 /* This implementation using inline assembly will be removed once glibc
    requires GCC 4.8 or later to build.  */

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]