From: Ivan Maidanski Date: Sat, 17 Aug 2013 11:05:36 +0000 (+0400) Subject: Fix: Do not use LDREXD/STREXD for Clang3.2/arm (and earlier) X-Git-Tag: libatomic_ops-7_2e~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52c7b7b2efd423e5d01abb76cd3ee75c4099d5e3;p=libatomic_ops Fix: Do not use LDREXD/STREXD for Clang3.2/arm (and earlier) (Apply commit 2daf685 from 'master' branch.) * src/atomic_ops/sysdeps/gcc/arm.h (AO_compare_double_and_swap_double): Do not define for pre-Clang3.3 (since the latter does not allocate register pairs for LDREXD/STREXD instructions properly); add comment. Conflicts: src/atomic_ops/sysdeps/gcc/arm.h --- diff --git a/src/atomic_ops/sysdeps/gcc/arm.h b/src/atomic_ops/sysdeps/gcc/arm.h index 0aa5e7c..6d34188 100644 --- a/src/atomic_ops/sysdeps/gcc/arm.h +++ b/src/atomic_ops/sysdeps/gcc/arm.h @@ -269,11 +269,15 @@ AO_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val) #if !defined(__ARM_ARCH_6__) && !defined(__ARM_ARCH_6J__) \ && !defined(__ARM_ARCH_6T2__) && !defined(__ARM_ARCH_6Z__) \ && !defined(__ARM_ARCH_6ZT2__) && (!defined(__thumb__) \ - || (defined(__thumb2__) && !defined(__ARM_ARCH_7__) \ - && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__))) + || (defined(__thumb2__) && !defined(__ARM_ARCH_7__) \ + && !defined(__ARM_ARCH_7M__) && !defined(__ARM_ARCH_7EM__))) \ + && (!defined(__clang__) || (__clang_major__ > 3) \ + || (__clang_major__ == 3 && __clang_minor__ >= 3)) /* LDREXD/STREXD present in ARMv6K/M+ (see gas/config/tc-arm.c) */ /* In the Thumb mode, this works only starting from ARMv7 (except for */ - /* the base and 'M' models). */ + /* the base and 'M' models). Clang3.2 (and earlier) does not */ + /* allocate register pairs for LDREXD/STREXD properly (besides, */ + /* Clang3.1 does not support "%H" operand specification). */ AO_INLINE int AO_compare_double_and_swap_double(volatile AO_double_t *addr, AO_t old_val1, AO_t old_val2,