Use GCC atomic intrinsics for Hexagon (clang 3.9+)
authorIvan Maidanski <ivmai@mail.ru>
Fri, 9 Jun 2017 07:59:55 +0000 (10:59 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 20 Sep 2017 07:48:43 +0000 (10:48 +0300)
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS] (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Define.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Include standard_ao_double_t.h, generic.h.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Do not include test_and_set_t_is_ao_t.h,
all_aligned_atomic_load_store.h.
* src/atomic_ops/sysdeps/gcc/hexagon.h [AO_CLANG_PREREQ(3, 9)
&& !AO_DISABLE_GCC_ATOMICS]: Do not define AO_nop_full,
AO_fetch_and_add, AO_test_and_set, AO_compare_and_swap,
AO_fetch_compare_and_swap, AO_T_IS_INT.

src/atomic_ops/sysdeps/gcc/hexagon.h

index 93a236b..19b348b 100644 (file)
@@ -9,6 +9,19 @@
  * modified is included with the above copyright notice.
  */
 
+#if AO_CLANG_PREREQ(3, 9) && !defined(AO_DISABLE_GCC_ATOMICS)
+  /* Probably, it could be enabled for earlier clang versions as well.  */
+
+  /* As of clang-3.9, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n are missing.   */
+# define AO_GCC_FORCE_HAVE_CAS
+
+# define AO_GCC_HAVE_double_SYNC_CAS
+# include "../standard_ao_double_t.h"
+
+# include "generic.h"
+
+#else /* AO_DISABLE_GCC_ATOMICS */
+
 #include "../all_aligned_atomic_load_store.h"
 
 #include "../test_and_set_t_is_ao_t.h"
@@ -120,3 +133,5 @@ AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
 #define AO_HAVE_fetch_compare_and_swap
 
 #define AO_T_IS_INT
+
+#endif /* AO_DISABLE_GCC_ATOMICS */