From: Chris Metcalf Date: Wed, 11 May 2016 19:19:57 +0000 (+0300) Subject: Basic support of TILE-Gx and TILEPro CPUs X-Git-Tag: v7.6.0~210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=04a286421802a503b58d804d0d673dd5a28c9e9b;p=libatomic_ops Basic support of TILE-Gx and TILEPro CPUs 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 (nobase_private_HEADERS): Add tile.h. * src/atomic_ops.h [__tile__]: Include tile.h file. * src/atomic_ops/sysdeps/gcc/tile.h: New file. --- 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..ef37b9f 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 #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..0c13180 --- /dev/null +++ b/src/atomic_ops/sysdeps/gcc/tile.h @@ -0,0 +1,50 @@ +/* + * 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(void) + { + __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 AO_t + AO_fetch_compare_and_swap_full(volatile AO_t *addr, AO_t old_val, + AO_t new_val) + { + return __sync_val_compare_and_swap(addr, old_val, new_val + /* empty protection list */); + } +# define AO_HAVE_fetch_compare_and_swap_full + +#endif /* AO_DISABLE_GCC_ATOMICS */