*
*/
-#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
# 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. */
/* 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
&& !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
* 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
/*
* 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