summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-12-06 11:42:35 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-12-22 10:44:43 +0300
commitfd9374bb4b4e348f9e58b0f9e7647d9a7179c328 (patch)
tree5741efc6e296deab0c441ffc28badb2d98eb9547 /src
parent57d609c10c5065e079809059c69f536f9dccedaa (diff)
downloadlibatomic_ops-fd9374bb4b4e348f9e58b0f9e7647d9a7179c328.tar.gz
Fix test failures for Clang-3.8 and older (Aarch64)
For older Clang/aarch64 releases, double-wide atomics are no longer supported. * src/atomic_ops/sysdeps/gcc/aarch64.h [__clang__ && !AO_CLANG_PREREQ(3, 9)]: Do not include standard_ao_double_t.h file; add comment. * src/atomic_ops/sysdeps/gcc/aarch64.h [__clang__ && !AO_CLANG_PREREQ(3, 8)] (AO_SKIPATOMIC_double_load, AO_SKIPATOMIC_double_load_acquire): Do not define and do not undefine (since generic.h is included only for GCC and for Clang v3.9+). * src/atomic_ops/sysdeps/gcc/aarch64.h [AO_AARCH64_ASM_LOAD_STORE_CAS] (AO_double_load, AO_double_load_acquire, AO_double_store, AO_double_store_release, AO_double_compare_and_swap, AO_double_compare_and_swap_acquire, AO_double_compare_and_swap_release, AO_double_compare_and_swap_full): Do not define if __clang__ && !AO_CLANG_PREREQ(3, 9). * src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_HAVE_double_SYNC_CAS): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/atomic_ops/sysdeps/gcc/aarch64.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h
index 6f1d5d8..e63a6a1 100644
--- a/src/atomic_ops/sysdeps/gcc/aarch64.h
+++ b/src/atomic_ops/sysdeps/gcc/aarch64.h
@@ -15,8 +15,6 @@
*
*/
-#include "../standard_ao_double_t.h"
-
/* As of clang-5.0 (and gcc-5.4), __atomic_thread_fence is always */
/* translated to DMB (which is inefficient for AO_nop_write). */
/* TODO: Update it for newer Clang and GCC releases. */
@@ -30,13 +28,12 @@
# define AO_HAVE_nop_write
#endif
-/* Atomics for loading double word in Clang were translated to an */
-/* incorrect code lacking STXP (see the note in AO_double_load below). */
-#if defined(AO_PREFER_BUILTIN_ATOMICS) \
- && defined(__clang__) && !AO_CLANG_PREREQ(3, 8)
-# define AO_SKIPATOMIC_double_load
-# define AO_SKIPATOMIC_double_load_acquire
-#endif
+/* There were some bugs in the older clang releases (related to */
+/* optimization of functions dealing with __int128 values, supposedly), */
+/* so even asm-based implementation did not work correctly. */
+#if !defined(__clang__) || AO_CLANG_PREREQ(3, 9)
+
+# include "../standard_ao_double_t.h"
/* As of gcc-5.4, all built-in load/store and CAS atomics for double */
/* word require -latomic (and are not lock-free), so we use the */
@@ -218,6 +215,8 @@
/* macro is still missing (while the double-word CAS is available). */
# define AO_GCC_HAVE_double_SYNC_CAS
+#endif /* !__clang__ || AO_CLANG_PREREQ(3, 9) */
+
#if (defined(__clang__) && !AO_CLANG_PREREQ(3, 8)) || defined(__APPLE_CC__)
/* __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros are missing. */
# define AO_GCC_FORCE_HAVE_CAS
@@ -227,5 +226,3 @@
#undef AO_GCC_FORCE_HAVE_CAS
#undef AO_GCC_HAVE_double_SYNC_CAS
-#undef AO_SKIPATOMIC_double_load
-#undef AO_SKIPATOMIC_double_load_acquire