summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2018-10-26 21:33:46 +0300
committerIvan Maidanski <ivmai@mail.ru>2018-10-26 21:33:46 +0300
commit02250e756e494898b4ec58ab3debe35a93811460 (patch)
tree58f2ba80f7595b1d8cd87d83efb3e9f082967ec0 /src
parent3cead752a53a7987e9c36aed73165e752e1a19e2 (diff)
downloadlibatomic_ops-02250e756e494898b4ec58ab3debe35a93811460.tar.gz
Use GCC atomic primitives for aarch64-ilp32 double-wide operations
Issue #38 (libatomic_ops). Both gcc and clang have correct support of 64-bit atomic primitives on AArch64, so need to use inline assembly. * src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__] (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 __ILP32__ (unless AO_AARCH64_ASM_LOAD_STORE_CAS). * src/atomic_ops/sysdeps/gcc/aarch64.h [!__clang__ || AO_CLANG_PREREQ(3,9)] (AO_GCC_HAVE_double_SYNC_CAS): Do not define if __ILP32__; update gcc version in comment.
Diffstat (limited to 'src')
-rw-r--r--src/atomic_ops/sysdeps/gcc/aarch64.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h
index 680e21f..bcd2aeb 100644
--- a/src/atomic_ops/sysdeps/gcc/aarch64.h
+++ b/src/atomic_ops/sysdeps/gcc/aarch64.h
@@ -39,7 +39,8 @@
/* word require -latomic, are not lock-free and cause test_stack */
/* failure, so the asm-based implementation is used for now. */
/* TODO: Update it for newer GCC releases. */
-#if !defined(__clang__) || defined(AO_AARCH64_ASM_LOAD_STORE_CAS)
+#if (!defined(__ILP32__) && !defined(__clang__)) \
+ || defined(AO_AARCH64_ASM_LOAD_STORE_CAS)
# ifndef AO_PREFER_GENERALIZED
AO_INLINE AO_double_t
@@ -260,11 +261,13 @@
}
# define AO_HAVE_double_compare_and_swap_full
-#endif /* !__clang__ || AO_AARCH64_ASM_LOAD_STORE_CAS */
+#endif /* !__ILP32__ && !__clang__ || AO_AARCH64_ASM_LOAD_STORE_CAS */
-/* As of clang-5.0 and gcc-5.4, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 */
+/* As of clang-5.0 and gcc-8.1, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 */
/* macro is still missing (while the double-word CAS is available). */
-# define AO_GCC_HAVE_double_SYNC_CAS
+# ifndef __ILP32__
+# define AO_GCC_HAVE_double_SYNC_CAS
+# endif
#endif /* !__clang__ || AO_CLANG_PREREQ(3, 9) */