]> granicus.if.org Git - libatomic_ops/commitdiff
Fix AO_TS_VAL_t used for __atomic_test_and_set (gcc)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 15 Apr 2016 08:00:44 +0000 (11:00 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 15 Apr 2016 08:00:44 +0000 (11:00 +0300)
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_ATOMIC_TEST_AND_SET):
Remove.
* src/atomic_ops/sysdeps/gcc/mips.h [!AO_DISABLE_GCC_ATOMICS]
(AO_GCC_ATOMIC_TEST_AND_SET): Likewise.
* src/atomic_ops/sysdeps/gcc/nios2.h (AO_GCC_ATOMIC_TEST_AND_SET):
Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_SET_TRUEVAL):
Likewise.
* src/atomic_ops/sysdeps/gcc/aarch64.h: Remove include
test_and_set_t_is_ao_t.h file.
* src/atomic_ops/sysdeps/gcc/mips.h [!AO_DISABLE_GCC_ATOMICS]: Likewise.
* src/atomic_ops/sysdeps/gcc/nios2.h: Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Include test_and_set_t_is_ao_t.h
only if not AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_GCC_ATOMIC_TEST_AND_SET):
Define macro.
* src/atomic_ops/sysdeps/gcc/generic.h: Include
test_and_set_t_is_char.h file.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_val): Define
AO_TS_set to 1; update comment.

src/atomic_ops/sysdeps/gcc/aarch64.h
src/atomic_ops/sysdeps/gcc/arm.h
src/atomic_ops/sysdeps/gcc/generic.h
src/atomic_ops/sysdeps/gcc/mips.h
src/atomic_ops/sysdeps/gcc/nios2.h
src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h

index 9a6ef5af1def400e73d0b5708b82274a3625bd91..11bc6c5719184ed52536ed92b39b4220a9fde694 100644 (file)
@@ -15,9 +15,6 @@
  *
  */
 
-#define AO_GCC_ATOMIC_TEST_AND_SET
-#include "../test_and_set_t_is_ao_t.h"
-
 #include "../standard_ao_double_t.h"
 
 #ifdef AO_PREFER_BUILTIN_ATOMICS
index 9e9b70145eeb7d9f7bb43c9a0ae61277b55133e7..d4bf028a8172271a85dd0c673ea38e4efffdc91a 100644 (file)
@@ -25,8 +25,6 @@
 # define AO_GCC_ATOMIC_TEST_AND_SET
 #endif
 
-#include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal */
-
 #ifdef __native_client__
   /* Mask instruction should immediately precede access instruction.    */
 # define AO_MASK_PTR(reg) "       bical " reg ", " reg ", #0xc0000000\n"
 
 #ifndef AO_GCC_ATOMIC_TEST_AND_SET
 
+# include "../test_and_set_t_is_ao_t.h" /* Probably suboptimal  */
+
 #ifdef AO_ARM_HAVE_LDREX
 
   /* AO_t/char/short/int load is simple reading.                */
index ffe993df6d970959c03df9efb3346d361dd9b968..256a97e93f579e5937c16e6b1ec198385e10a3a6 100644 (file)
@@ -19,6 +19,9 @@
 /* For the details, see GNU Manual, chapter 6.52 (Built-in functions    */
 /* for memory model aware atomic operations).                           */
 
+#define AO_GCC_ATOMIC_TEST_AND_SET
+#include "../test_and_set_t_is_char.h"
+
 #if defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) \
     || defined(AO_GCC_FORCE_HAVE_CAS)
 # define AO_GCC_HAVE_char_SYNC_CAS
index 9cfc3377265f130f9bd5c421c535d9aec1c4a811..13c7cc7a6b07c45707d3d43b3f9e8f6d422615ff 100644 (file)
@@ -35,9 +35,6 @@
     && !defined(AO_DISABLE_GCC_ATOMICS)
   /* Probably, it could be enabled even for earlier gcc/clang versions. */
 
-# define AO_GCC_ATOMIC_TEST_AND_SET
-# include "../test_and_set_t_is_ao_t.h"
-
   /* As of clang-3.6/mips[64], __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n missing. */
 # if defined(__clang__)
 #   define AO_GCC_FORCE_HAVE_CAS
index a7f2ef828056bd52c7cd71dee695b7a7b506c7ab..5b976be17941538896012d03329de79df63743d1 100644 (file)
@@ -11,9 +11,6 @@
  * modified is included with the above copyright notice.
  */
 
-#define AO_GCC_ATOMIC_TEST_AND_SET
-#include "../test_and_set_t_is_ao_t.h"
-
 #include "generic.h"
 
 #define AO_T_IS_INT
index d05f498946bf9c35fa364c57ce5071acf33b9c2d..606f7ac6b2ac0b56872ccd9e6a29c6c63e5a2580 100644 (file)
 /*
  * These are common definitions for architectures on which test_and_set
  * operates on pointer-sized quantities, the "clear" value contains
- * all zeroes, and the "set" value contains only one lowest bit set typically.
+ * all zeroes, and the "set" value contains only one lowest bit set.
+ * This can be used if test_and_set is synthesized from compare_and_swap.
  */
-
-#if defined(AO_GCC_ATOMIC_TEST_AND_SET) && !defined(AO_PREFER_GENERALIZED) \
-    && defined(__GCC_ATOMIC_TEST_AND_SET_TRUEVAL)
-# define AO_TS_SET_TRUEVAL __GCC_ATOMIC_TEST_AND_SET_TRUEVAL
-#else
-# define AO_TS_SET_TRUEVAL 1
-#endif
-
-typedef enum { AO_TS_clear = 0, AO_TS_set = AO_TS_SET_TRUEVAL } AO_TS_val;
+typedef enum {AO_TS_clear = 0, AO_TS_set = 1} AO_TS_val;
 #define AO_TS_VAL_t AO_TS_val
 #define AO_TS_CLEAR AO_TS_clear
 #define AO_TS_SET AO_TS_set