Chris Metcalf
2016-05-02 15:41:40 UTC
* src/Makefile.am (nobase_private_HEADERS): Add tile.h.
* src/atomic_ops.h: Include tile.h file.
* src/atomic_ops/sysdeps/gcc/tile.h: New file.
---
For libatomic_ops:
This patch is an updated version of the CentOS 6 patch that we have
been carrying as part of our own CentOS-like distribution since 2012.
src/Makefile.am | 1 +
src/atomic_ops.h | 3 ++
src/atomic_ops/sysdeps/gcc/tile.h | 52 +++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 src/atomic_ops/sysdeps/gcc/tile.h
diff --git a/src/Makefile.am b/src/Makefile.am
index d463427..8971370 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,6 +84,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
atomic_ops/sysdeps/gcc/sparc.h \
+ atomic_ops/sysdeps/gcc/tile.h \
atomic_ops/sysdeps/gcc/x86.h \
\
atomic_ops/sysdeps/hpc/hppa.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index ec02ba4..59f04ef 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -294,6 +294,9 @@
# if defined(__hexagon__)
# include "atomic_ops/sysdeps/gcc/hexagon.h"
# endif
+# if defined(__tile__)
+# include "atomic_ops/sysdeps/gcc/tile.h"
+# endif /* __tile__ */
#endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
#if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__) \
diff --git a/src/atomic_ops/sysdeps/gcc/tile.h b/src/atomic_ops/sysdeps/gcc/tile.h
new file mode 100644
index 0000000..28dc083
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/tile.h
@@ -0,0 +1,52 @@
+/*
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* Minimal support for tile. */
+
+#if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \
+ || __clang_major__ > 3 \
+ || (__clang_major__ == 3 && __clang_minor__ >= 4)) \
+ && !defined(AO_DISABLE_GCC_ATOMICS))
+
+# include "generic.h"
+
+#else /* AO_DISABLE_GCC_ATOMICS */
+
+#include "../all_atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+
+
+AO_INLINE void
+AO_nop_full()
+{
+ __sync_synchronize();
+}
+#define AO_HAVE_nop_full
+
+
+AO_INLINE AO_t
+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
+{
+ return __sync_fetch_and_add(p, incr);
+}
+#define AO_HAVE_fetch_and_add_full
+
+
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+ AO_t old, AO_t new_val)
+{
+ return __sync_val_compare_and_swap(addr, old, new_val) == old;
+}
+#define AO_HAVE_compare_and_swap_full
+
+#endif
--
1.7.1
* src/atomic_ops.h: Include tile.h file.
* src/atomic_ops/sysdeps/gcc/tile.h: New file.
---
For libatomic_ops:
This patch is an updated version of the CentOS 6 patch that we have
been carrying as part of our own CentOS-like distribution since 2012.
src/Makefile.am | 1 +
src/atomic_ops.h | 3 ++
src/atomic_ops/sysdeps/gcc/tile.h | 52 +++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 src/atomic_ops/sysdeps/gcc/tile.h
diff --git a/src/Makefile.am b/src/Makefile.am
index d463427..8971370 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,6 +84,7 @@ nobase_private_HEADERS = atomic_ops/ao_version.h \
atomic_ops/sysdeps/gcc/s390.h \
atomic_ops/sysdeps/gcc/sh.h \
atomic_ops/sysdeps/gcc/sparc.h \
+ atomic_ops/sysdeps/gcc/tile.h \
atomic_ops/sysdeps/gcc/x86.h \
\
atomic_ops/sysdeps/hpc/hppa.h \
diff --git a/src/atomic_ops.h b/src/atomic_ops.h
index ec02ba4..59f04ef 100644
--- a/src/atomic_ops.h
+++ b/src/atomic_ops.h
@@ -294,6 +294,9 @@
# if defined(__hexagon__)
# include "atomic_ops/sysdeps/gcc/hexagon.h"
# endif
+# if defined(__tile__)
+# include "atomic_ops/sysdeps/gcc/tile.h"
+# endif /* __tile__ */
#endif /* __GNUC__ && !AO_USE_PTHREAD_DEFS */
#if (defined(__IBMC__) || defined(__IBMCPP__)) && !defined(__GNUC__) \
diff --git a/src/atomic_ops/sysdeps/gcc/tile.h b/src/atomic_ops/sysdeps/gcc/tile.h
new file mode 100644
index 0000000..28dc083
--- /dev/null
+++ b/src/atomic_ops/sysdeps/gcc/tile.h
@@ -0,0 +1,52 @@
+/*
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* Minimal support for tile. */
+
+#if (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)) \
+ || __clang_major__ > 3 \
+ || (__clang_major__ == 3 && __clang_minor__ >= 4)) \
+ && !defined(AO_DISABLE_GCC_ATOMICS))
+
+# include "generic.h"
+
+#else /* AO_DISABLE_GCC_ATOMICS */
+
+#include "../all_atomic_load_store.h"
+
+#include "../test_and_set_t_is_ao_t.h"
+
+
+AO_INLINE void
+AO_nop_full()
+{
+ __sync_synchronize();
+}
+#define AO_HAVE_nop_full
+
+
+AO_INLINE AO_t
+AO_fetch_and_add_full (volatile AO_t *p, AO_t incr)
+{
+ return __sync_fetch_and_add(p, incr);
+}
+#define AO_HAVE_fetch_and_add_full
+
+
+AO_INLINE int
+AO_compare_and_swap_full(volatile AO_t *addr,
+ AO_t old, AO_t new_val)
+{
+ return __sync_val_compare_and_swap(addr, old, new_val) == old;
+}
+#define AO_HAVE_compare_and_swap_full
+
+#endif
--
1.7.1