|
|
34ab29 |
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
|
|
|
34ab29 |
index 767859c..ec92882 100644
|
|
|
34ab29 |
--- a/include/private/gcconfig.h
|
|
|
34ab29 |
+++ b/include/private/gcconfig.h
|
|
|
34ab29 |
@@ -70,6 +70,13 @@
|
|
|
34ab29 |
# define I386
|
|
|
34ab29 |
# define mach_type_known
|
|
|
34ab29 |
# endif
|
|
|
34ab29 |
+# if defined(__aarch64__)
|
|
|
34ab29 |
+# define AARCH64
|
|
|
34ab29 |
+# if !defined(LINUX)
|
|
|
34ab29 |
+# define NOSYS
|
|
|
34ab29 |
+# define mach_type_known
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
# if defined(__arm) || defined(__arm__) || defined(__thumb__)
|
|
|
34ab29 |
# define ARM32
|
|
|
34ab29 |
# if !defined(LINUX) && !defined(NETBSD) && !defined(OPENBSD) \
|
|
|
34ab29 |
@@ -250,6 +257,10 @@
|
|
|
34ab29 |
# define IA64
|
|
|
34ab29 |
# define mach_type_known
|
|
|
34ab29 |
# endif
|
|
|
34ab29 |
+# if defined(LINUX) && defined(__aarch64__)
|
|
|
34ab29 |
+# define AARCH64
|
|
|
34ab29 |
+# define mach_type_known
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
# if defined(LINUX) && (defined(__arm) || defined(__arm__))
|
|
|
34ab29 |
# define ARM32
|
|
|
34ab29 |
# define mach_type_known
|
|
|
34ab29 |
@@ -537,6 +548,7 @@
|
|
|
34ab29 |
/* running Amdahl UTS4 */
|
|
|
34ab29 |
/* S390 ==> 390-like machine */
|
|
|
34ab29 |
/* running LINUX */
|
|
|
34ab29 |
+ /* AARCH64 ==> ARM AArch64 */
|
|
|
34ab29 |
/* ARM32 ==> Intel StrongARM */
|
|
|
34ab29 |
/* IA64 ==> Intel IPF */
|
|
|
34ab29 |
/* (e.g. Itanium) */
|
|
|
34ab29 |
@@ -1899,6 +1911,31 @@
|
|
|
34ab29 |
# endif
|
|
|
34ab29 |
# endif
|
|
|
34ab29 |
|
|
|
34ab29 |
+# ifdef AARCH64
|
|
|
34ab29 |
+# define CPP_WORDSZ 64
|
|
|
34ab29 |
+# define MACH_TYPE "AARCH64"
|
|
|
34ab29 |
+# define ALIGNMENT 8
|
|
|
34ab29 |
+# ifndef HBLKSIZE
|
|
|
34ab29 |
+# define HBLKSIZE 4096
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+# ifdef LINUX
|
|
|
34ab29 |
+# define OS_TYPE "LINUX"
|
|
|
34ab29 |
+# define LINUX_STACKBOTTOM
|
|
|
34ab29 |
+# define DYNAMIC_LOADING
|
|
|
34ab29 |
+ extern int __data_start[];
|
|
|
34ab29 |
+# define DATASTART ((ptr_t)__data_start)
|
|
|
34ab29 |
+ extern char _end[];
|
|
|
34ab29 |
+# define DATAEND ((ptr_t)(&_end))
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+# ifdef NOSYS
|
|
|
34ab29 |
+ /* __data_start is usually defined in the target linker script. */
|
|
|
34ab29 |
+ extern int __data_start[];
|
|
|
34ab29 |
+# define DATASTART ((ptr_t)__data_start)
|
|
|
34ab29 |
+ extern void *__stack_base__;
|
|
|
34ab29 |
+# define STACKBOTTOM ((ptr_t)__stack_base__)
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+
|
|
|
34ab29 |
# ifdef ARM32
|
|
|
34ab29 |
# define CPP_WORDSZ 32
|
|
|
34ab29 |
# define MACH_TYPE "ARM32"
|
|
|
34ab29 |
diff --git a/libatomic_ops/src/atomic_ops.h b/libatomic_ops/src/atomic_ops.h
|
|
|
34ab29 |
index db177d5..d91da53 100644
|
|
|
34ab29 |
--- a/libatomic_ops/src/atomic_ops.h
|
|
|
34ab29 |
+++ b/libatomic_ops/src/atomic_ops.h
|
|
|
34ab29 |
@@ -244,6 +244,10 @@
|
|
|
34ab29 |
|| defined(__powerpc64__) || defined(__ppc64__)
|
|
|
34ab29 |
# include "atomic_ops/sysdeps/gcc/powerpc.h"
|
|
|
34ab29 |
# endif /* __powerpc__ */
|
|
|
34ab29 |
+# if defined(__aarch64__)
|
|
|
34ab29 |
+# include "atomic_ops/sysdeps/gcc/aarch64.h"
|
|
|
34ab29 |
+# define AO_CAN_EMUL_CAS
|
|
|
34ab29 |
+# endif /* __aarch64__ */
|
|
|
34ab29 |
# if defined(__arm__) && !defined(AO_USE_PTHREAD_DEFS)
|
|
|
34ab29 |
# include "atomic_ops/sysdeps/gcc/arm.h"
|
|
|
34ab29 |
# define AO_CAN_EMUL_CAS
|
|
|
34ab29 |
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am b/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am
|
|
|
34ab29 |
index d8b24dc..b73a20c 100644
|
|
|
34ab29 |
--- a/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am
|
|
|
34ab29 |
+++ b/libatomic_ops/src/atomic_ops/sysdeps/Makefile.am
|
|
|
34ab29 |
@@ -30,6 +30,7 @@ nobase_sysdep_HEADERS= generic_pthread.h \
|
|
|
34ab29 |
gcc/hexagon.h gcc/hppa.h gcc/ia64.h gcc/m68k.h \
|
|
|
34ab29 |
gcc/mips.h gcc/powerpc.h gcc/s390.h \
|
|
|
34ab29 |
gcc/sh.h gcc/sparc.h gcc/x86.h gcc/x86_64.h \
|
|
|
34ab29 |
+ gcc/aarch64.h \
|
|
|
34ab29 |
\
|
|
|
34ab29 |
hpc/hppa.h hpc/ia64.h \
|
|
|
34ab29 |
\
|
|
|
34ab29 |
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h b/libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h
|
|
|
34ab29 |
new file mode 100644
|
|
|
34ab29 |
index 0000000..94f1f14
|
|
|
34ab29 |
--- /dev/null
|
|
|
34ab29 |
+++ b/libatomic_ops/src/atomic_ops/sysdeps/gcc/aarch64.h
|
|
|
34ab29 |
@@ -0,0 +1,353 @@
|
|
|
34ab29 |
+/*
|
|
|
34ab29 |
+ * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
|
|
|
34ab29 |
+ * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
|
|
|
34ab29 |
+ * Copyright (c) 1999-2003 by Hewlett-Packard Company. All rights reserved.
|
|
|
34ab29 |
+ *
|
|
|
34ab29 |
+ *
|
|
|
34ab29 |
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
|
|
|
34ab29 |
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
|
|
|
34ab29 |
+ *
|
|
|
34ab29 |
+ * Permission is hereby granted to use or copy this program
|
|
|
34ab29 |
+ * for any purpose, provided the above notices are retained on all copies.
|
|
|
34ab29 |
+ * Permission to modify the code and to distribute modified code is granted,
|
|
|
34ab29 |
+ * provided the above notices are retained, and a notice that the code was
|
|
|
34ab29 |
+ * modified is included with the above copyright notice.
|
|
|
34ab29 |
+ *
|
|
|
34ab29 |
+ */
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#include "../read_ordered.h"
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#include "../test_and_set_t_is_ao_t.h"
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#include "../standard_ao_double_t.h"
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#ifndef AO_UNIPROCESSOR
|
|
|
34ab29 |
+ AO_INLINE void
|
|
|
34ab29 |
+ AO_nop_write(void)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ __asm__ __volatile__("dmb st" : : : "memory");
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_nop_write
|
|
|
34ab29 |
+#endif
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#ifndef AO_EXPECT_FALSE
|
|
|
34ab29 |
+#if __GNUC__ >= 3 && !defined(LINT2)
|
|
|
34ab29 |
+# define AO_EXPECT_FALSE(expr) __builtin_expect(expr, 0)
|
|
|
34ab29 |
+ /* Equivalent to (expr) but predict that usually (expr) == 0. */
|
|
|
34ab29 |
+#else
|
|
|
34ab29 |
+# define AO_EXPECT_FALSE(expr) (expr)
|
|
|
34ab29 |
+#endif /* !__GNUC__ */
|
|
|
34ab29 |
+#endif
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+/* TODO: Adjust version check on fixing double-wide AO support in GCC. */
|
|
|
34ab29 |
+#if __GNUC__ == 4
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE AO_double_t
|
|
|
34ab29 |
+ AO_double_load(const volatile AO_double_t *addr)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t result;
|
|
|
34ab29 |
+ int status;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ /* Note that STXP cannot be discarded because LD[A]XP is not */
|
|
|
34ab29 |
+ /* single-copy atomic (unlike LDREXD for 32-bit ARM). */
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_load\n"
|
|
|
34ab29 |
+ " ldxp %0, %1, %3\n"
|
|
|
34ab29 |
+ " stxp %w2, %0, %1, %3"
|
|
|
34ab29 |
+ : "=&r" (result.AO_val1), "=&r" (result.AO_val2), "=&r" (status)
|
|
|
34ab29 |
+ : "Q" (*addr));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(status));
|
|
|
34ab29 |
+ return result;
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_load
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE AO_double_t
|
|
|
34ab29 |
+ AO_double_load_acquire(const volatile AO_double_t *addr)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t result;
|
|
|
34ab29 |
+ int status;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_load_acquire\n"
|
|
|
34ab29 |
+ " ldaxp %0, %1, %3\n"
|
|
|
34ab29 |
+ " stxp %w2, %0, %1, %3"
|
|
|
34ab29 |
+ : "=&r" (result.AO_val1), "=&r" (result.AO_val2), "=&r" (status)
|
|
|
34ab29 |
+ : "Q" (*addr));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(status));
|
|
|
34ab29 |
+ return result;
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_load_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE void
|
|
|
34ab29 |
+ AO_double_store(volatile AO_double_t *addr, AO_double_t value)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t old_val;
|
|
|
34ab29 |
+ int status;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_store\n"
|
|
|
34ab29 |
+ " ldxp %0, %1, %3\n"
|
|
|
34ab29 |
+ " stxp %w2, %4, %5, %3"
|
|
|
34ab29 |
+ : "=&r" (old_val.AO_val1), "=&r" (old_val.AO_val2), "=&r" (status),
|
|
|
34ab29 |
+ "=Q" (*addr)
|
|
|
34ab29 |
+ : "r" (value.AO_val1), "r" (value.AO_val2));
|
|
|
34ab29 |
+ /* Compared to the arm.h implementation, the 'cc' (flags) are not */
|
|
|
34ab29 |
+ /* clobbered because A64 has no concept of conditional execution. */
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(status));
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_store
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE void
|
|
|
34ab29 |
+ AO_double_store_release(volatile AO_double_t *addr, AO_double_t value)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t old_val;
|
|
|
34ab29 |
+ int status;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_store_release\n"
|
|
|
34ab29 |
+ " ldxp %0, %1, %3\n"
|
|
|
34ab29 |
+ " stlxp %w2, %4, %5, %3"
|
|
|
34ab29 |
+ : "=&r" (old_val.AO_val1), "=&r" (old_val.AO_val2), "=&r" (status),
|
|
|
34ab29 |
+ "=Q" (*addr)
|
|
|
34ab29 |
+ : "r" (value.AO_val1), "r" (value.AO_val2));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(status));
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_store_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE int
|
|
|
34ab29 |
+ AO_double_compare_and_swap(volatile AO_double_t *addr,
|
|
|
34ab29 |
+ AO_double_t old_val, AO_double_t new_val)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t tmp;
|
|
|
34ab29 |
+ int result = 1;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_compare_and_swap\n"
|
|
|
34ab29 |
+ " ldxp %0, %1, %2\n"
|
|
|
34ab29 |
+ : "=&r" (tmp.AO_val1), "=&r" (tmp.AO_val2)
|
|
|
34ab29 |
+ : "Q" (*addr));
|
|
|
34ab29 |
+ if (tmp.AO_val1 != old_val.AO_val1 || tmp.AO_val2 != old_val.AO_val2)
|
|
|
34ab29 |
+ break;
|
|
|
34ab29 |
+ __asm__ __volatile__(
|
|
|
34ab29 |
+ " stxp %w0, %2, %3, %1\n"
|
|
|
34ab29 |
+ : "=&r" (result), "=Q" (*addr)
|
|
|
34ab29 |
+ : "r" (new_val.AO_val1), "r" (new_val.AO_val2));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(result));
|
|
|
34ab29 |
+ return !result;
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_compare_and_swap
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE int
|
|
|
34ab29 |
+ AO_double_compare_and_swap_acquire(volatile AO_double_t *addr,
|
|
|
34ab29 |
+ AO_double_t old_val, AO_double_t new_val)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t tmp;
|
|
|
34ab29 |
+ int result = 1;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_compare_and_swap_acquire\n"
|
|
|
34ab29 |
+ " ldaxp %0, %1, %2\n"
|
|
|
34ab29 |
+ : "=&r" (tmp.AO_val1), "=&r" (tmp.AO_val2)
|
|
|
34ab29 |
+ : "Q" (*addr));
|
|
|
34ab29 |
+ if (tmp.AO_val1 != old_val.AO_val1 || tmp.AO_val2 != old_val.AO_val2)
|
|
|
34ab29 |
+ break;
|
|
|
34ab29 |
+ __asm__ __volatile__(
|
|
|
34ab29 |
+ " stxp %w0, %2, %3, %1\n"
|
|
|
34ab29 |
+ : "=&r" (result), "=Q" (*addr)
|
|
|
34ab29 |
+ : "r" (new_val.AO_val1), "r" (new_val.AO_val2));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(result));
|
|
|
34ab29 |
+ return !result;
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_compare_and_swap_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ AO_INLINE int
|
|
|
34ab29 |
+ AO_double_compare_and_swap_release(volatile AO_double_t *addr,
|
|
|
34ab29 |
+ AO_double_t old_val, AO_double_t new_val)
|
|
|
34ab29 |
+ {
|
|
|
34ab29 |
+ AO_double_t tmp;
|
|
|
34ab29 |
+ int result = 1;
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+ do {
|
|
|
34ab29 |
+ __asm__ __volatile__("//AO_double_compare_and_swap_release\n"
|
|
|
34ab29 |
+ " ldxp %0, %1, %2\n"
|
|
|
34ab29 |
+ : "=&r" (tmp.AO_val1), "=&r" (tmp.AO_val2)
|
|
|
34ab29 |
+ : "Q" (*addr));
|
|
|
34ab29 |
+ if (tmp.AO_val1 != old_val.AO_val1 || tmp.AO_val2 != old_val.AO_val2)
|
|
|
34ab29 |
+ break;
|
|
|
34ab29 |
+ __asm__ __volatile__(
|
|
|
34ab29 |
+ " stlxp %w0, %2, %3, %1\n"
|
|
|
34ab29 |
+ : "=&r" (result), "=Q" (*addr)
|
|
|
34ab29 |
+ : "r" (new_val.AO_val1), "r" (new_val.AO_val2));
|
|
|
34ab29 |
+ } while (AO_EXPECT_FALSE(result));
|
|
|
34ab29 |
+ return !result;
|
|
|
34ab29 |
+ }
|
|
|
34ab29 |
+# define AO_HAVE_double_compare_and_swap_release
|
|
|
34ab29 |
+#endif
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE void
|
|
|
34ab29 |
+AO_nop_full(void)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+# ifndef AO_UNIPROCESSOR
|
|
|
34ab29 |
+__sync_synchronize ();
|
|
|
34ab29 |
+# endif
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_nop_full
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_load(const volatile AO_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_load_n (addr, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_load
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_load_acquire(const volatile AO_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_load_n (addr, __ATOMIC_ACQUIRE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_load_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE void
|
|
|
34ab29 |
+ AO_store(volatile AO_t *addr, AO_t value)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ __atomic_store_n(addr, value, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_store
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE void
|
|
|
34ab29 |
+ AO_store_release(volatile AO_t *addr, AO_t value)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ __atomic_store_n(addr, value, __ATOMIC_RELEASE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_store_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_TS_VAL_t
|
|
|
34ab29 |
+AO_test_and_set(volatile AO_TS_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_test_and_set
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_TS_VAL_t
|
|
|
34ab29 |
+AO_test_and_set_acquire(volatile AO_TS_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_ACQUIRE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_test_and_set_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_TS_VAL_t
|
|
|
34ab29 |
+AO_test_and_set_release(volatile AO_TS_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_RELEASE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_test_and_set_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_TS_VAL_t
|
|
|
34ab29 |
+AO_test_and_set_full(volatile AO_TS_t *addr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_TS_VAL_t)__atomic_test_and_set(addr, __ATOMIC_SEQ_CST);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_test_and_set_full
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add(volatile AO_t *p, AO_t incr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, incr, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add_acquire(volatile AO_t *p, AO_t incr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, incr, __ATOMIC_ACQUIRE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add_release(volatile AO_t *p, AO_t incr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, incr, __ATOMIC_RELEASE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add_full(volatile AO_t *p, AO_t incr)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, incr, __ATOMIC_SEQ_CST);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add_full
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add1(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, 1, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add1
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add1_acquire(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, 1, __ATOMIC_ACQUIRE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add1_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add1_release(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, 1, __ATOMIC_RELEASE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add1_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_add1_full(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_add(p, 1, __ATOMIC_SEQ_CST);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_add1_full
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_sub1(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_sub(p, 1, __ATOMIC_RELAXED);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_sub1
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_sub1_acquire(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_sub(p, 1, __ATOMIC_ACQUIRE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_sub1_acquire
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_sub1_release(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_sub(p, 1, __ATOMIC_RELEASE);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_sub1_release
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_and_sub1_full(volatile AO_t *p)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__atomic_fetch_sub(p, 1, __ATOMIC_SEQ_CST);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+#define AO_HAVE_fetch_and_sub1_full
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+/* Returns nonzero if the comparison succeeded. */
|
|
|
34ab29 |
+AO_INLINE int
|
|
|
34ab29 |
+AO_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (int)__sync_bool_compare_and_swap(addr, old_val, new_val);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_compare_and_swap
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+AO_INLINE AO_t
|
|
|
34ab29 |
+AO_fetch_compare_and_swap(volatile AO_t *addr, AO_t old_val, AO_t new_val)
|
|
|
34ab29 |
+{
|
|
|
34ab29 |
+ return (AO_t)__sync_val_compare_and_swap(addr, old_val, new_val);
|
|
|
34ab29 |
+}
|
|
|
34ab29 |
+# define AO_HAVE_fetch_compare_and_swap
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+
|
|
|
34ab29 |
+#include "../../generalize.h"
|
|
|
34ab29 |
diff --git a/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h b/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h
|
|
|
34ab29 |
index 7089f05..de726fc 100644
|
|
|
34ab29 |
--- a/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h
|
|
|
34ab29 |
+++ b/libatomic_ops/src/atomic_ops/sysdeps/standard_ao_double_t.h
|
|
|
34ab29 |
@@ -11,6 +11,8 @@
|
|
|
34ab29 |
typedef __m128 double_ptr_storage;
|
|
|
34ab29 |
#elif defined(_WIN32) && !defined(__GNUC__)
|
|
|
34ab29 |
typedef unsigned __int64 double_ptr_storage;
|
|
|
34ab29 |
+#elif defined(__aarch64__)
|
|
|
34ab29 |
+ typedef unsigned __int128 double_ptr_storage;
|
|
|
34ab29 |
#else
|
|
|
34ab29 |
typedef unsigned long long double_ptr_storage;
|
|
|
34ab29 |
#endif
|