diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-10-26 21:33:46 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-10-29 08:12:51 +0300 |
commit | 3f2349b8b3606d1083767cd70f01e4eccaed6e81 (patch) | |
tree | ab9911682082387261b4019c53c6f60fd656218d | |
parent | 3f41ecbcaf2d0b79ce0664fd454a5c7cc0a03343 (diff) | |
download | libatomic_ops-3f2349b8b3606d1083767cd70f01e4eccaed6e81.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.
-rw-r--r-- | src/atomic_ops/sysdeps/gcc/aarch64.h | 11 |
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) */ |