summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-08-05 22:03:12 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-08-05 22:03:12 +0300
commit8e62b6f6a29af65c31fc4f9f36a573f24862f421 (patch)
treee4d120cc7e62d33e0a87b4517359e4afed4b5c51
parent48f5a147bc4a95d1a577218212e6d0c115efe6c4 (diff)
downloadlibatomic_ops-ppc-gcc-atomics.tar.gz
Use GCC atomic intrinsics for PowerPC 32/64 (GCC 4.8+ and clang 3.8+)ppc-gcc-atomics
* src/atomic_ops/sysdeps/gcc/powerpc.h: Include generic.h and do not include all_aligned_atomic_load_store.h, test_and_set_t_is_ao_t.h if GCC 4.8+ or clang 3.8+ unless AO_DISABLE_GCC_ATOMICS. * src/atomic_ops/sysdeps/gcc/powerpc.h (AO_nop_full, AO_lwsync, AO_nop_write, AO_nop_read, AO_load_acquire, AO_store_release, AO_test_and_set, AO_test_and_set_release, AO_test_and_set_full, AO_compare_and_swap, AO_compare_and_swap_acquire, AO_compare_and_swap_release, AO_compare_and_swap_full, AO_fetch_compare_and_swap, AO_fetch_compare_and_swap_acquire, AO_fetch_compare_and_swap_release, AO_fetch_compare_and_swap_full, AO_fetch_and_add, AO_fetch_and_add_acquire, AO_fetch_and_add_release, AO_fetch_and_add_full, AO_T_IS_INT): Do not define if generic.h is included.
-rw-r--r--src/atomic_ops/sysdeps/gcc/powerpc.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/powerpc.h b/src/atomic_ops/sysdeps/gcc/powerpc.h
index 5bee475..7232117 100644
--- a/src/atomic_ops/sysdeps/gcc/powerpc.h
+++ b/src/atomic_ops/sysdeps/gcc/powerpc.h
@@ -20,6 +20,22 @@
/* http://www-106.ibm.com/developerworks/eserver/articles/powerpc.html. */
/* There appears to be no implicit ordering between any kind of */
/* independent memory references. */
+
+/* TODO: Implement double-wide operations if available. */
+
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) \
+ || __clang_major__ > 3 \
+ || (__clang_major__ == 3 && __clang_minor__ >= 8)) \
+ && !defined(AO_DISABLE_GCC_ATOMICS)
+ /* Probably, it could be enabled even for earlier gcc/clang versions. */
+
+ /* TODO: As of clang-3.8.1, it emits lwsync in AO_load_acquire */
+ /* (i.e., the code is less efficient than the one given below). */
+
+# include "generic.h"
+
+#else /* AO_DISABLE_GCC_ATOMICS */
+
/* Architecture enforces some ordering based on control dependence. */
/* I don't know if that could help. */
/* Data-dependent loads are always ordered. */
@@ -358,4 +374,4 @@ AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr) {
# define AO_T_IS_INT
#endif
-/* TODO: Implement double-wide operations if available. */
+#endif /* AO_DISABLE_GCC_ATOMICS */