summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-12-05 10:51:45 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-12-22 10:43:47 +0300
commit6a8ace57b0631ab96d24323f5dde2350ce6e70b4 (patch)
tree587e61ebc58c3dcf057029d96c11a3445da057b2 /src
parent06cbf7cb7b172c555ec76f90f32c04f346beeff4 (diff)
downloadlibatomic_ops-6a8ace57b0631ab96d24323f5dde2350ce6e70b4.tar.gz
Use GCC built-in atomic to define nop_write in case of TSan (Aarch64)
* src/atomic_ops/sysdeps/gcc/aarch64.h [!AO_PREFER_BUILTIN_ATOMICS && !AO_UNIPROCESSOR] (AO_nop_write): Do not define (using asm DMB) if AO_THREAD_SANITIZER; update comment.
Diffstat (limited to 'src')
-rw-r--r--src/atomic_ops/sysdeps/gcc/aarch64.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/aarch64.h b/src/atomic_ops/sysdeps/gcc/aarch64.h
index 1204816..65ce2a9 100644
--- a/src/atomic_ops/sysdeps/gcc/aarch64.h
+++ b/src/atomic_ops/sysdeps/gcc/aarch64.h
@@ -17,6 +17,19 @@
#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. */
+#if !defined(AO_PREFER_BUILTIN_ATOMICS) && !defined(AO_THREAD_SANITIZER) \
+ && !defined(AO_UNIPROCESSOR)
+ AO_INLINE void
+ AO_nop_write(void)
+ {
+ __asm__ __volatile__("dmb ishst" : : : "memory");
+ }
+# 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). */
@@ -24,17 +37,6 @@
# define AO_SKIPATOMIC_double_load_acquire
#else
- /* As of clang 3.6 (and gcc 4.9), __atomic_thread_fence is always */
- /* translated to DMB (which is inefficient for AO_nop_write). */
-# ifndef AO_UNIPROCESSOR
- AO_INLINE void
- AO_nop_write(void)
- {
- __asm__ __volatile__("dmb ishst" : : : "memory");
- }
-# define AO_HAVE_nop_write
-# endif
-
AO_INLINE AO_double_t
AO_double_load(const volatile AO_double_t *addr)
{