From fde9541bfc8ec8bc14b0dc7a6981375a00a55d59 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 5 Dec 2017 11:27:47 +0300 Subject: [PATCH] Do not disallow to define double_load using built-in atomics (Aarch64) (fix commit 03a0465) Clang 3.8 (and later) and GCC have the correct implementation of double-word atomic load (containing STXP instruction) for Aarch64. * src/atomic_ops/sysdeps/gcc/aarch64.h [AO_PREFER_BUILTIN_ATOMICS] (AO_SKIPATOMIC_double_load, AO_SKIPATOMIC_double_load_acquire): Do not define for GCC and if AO_CLANG_PREREQ(3, 8). --- src/atomic_ops/sysdeps/gcc/aarch64.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h index 65ce2a9..f430007 100644 --- a/src/atomic_ops/sysdeps/gcc/aarch64.h +++ b/src/atomic_ops/sysdeps/gcc/aarch64.h @@ -30,12 +30,15 @@ # define AO_HAVE_nop_write #endif -#ifdef AO_PREFER_BUILTIN_ATOMICS - /* As of clang 3.6 (and gcc 5.0), load atomics for double word are */ - /* translated to incorrect code lacking STXP (see the note below). */ +/* 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 -#else +#endif + +#if !defined(AO_PREFER_BUILTIN_ATOMICS) AO_INLINE AO_double_t AO_double_load(const volatile AO_double_t *addr) -- 2.50.1