[Gc] [libatomic_ops] Intel Compiler with gcc compatible mode
Patrick MARLIER
patrick.marlier at unine.ch
Fri Feb 19 00:06:19 PST 2010
It seems that Intel 11.1+ has support for __sync_ primitive.
So maybe we can also do this in my previous patch:
- /* Intel Compiler in gcc compatible mode (but not support __sync_
primitive) */
+ /* Intel Compiler in gcc compatible mode */
+ # if __INTEL_COMPILER > 1110
+ # define HAVE_GCC_ATOMIC_BUILTINS 1
+ # endif /* __INTEL_COMPILER */
Patrick Marlier
Patrick MARLIER wrote:
> Since Intel Compiler (icc) is gcc compatible mode by default under
> linux, libatomic_ops can use the gcc definition to support more
> architecture.
>
> Here a proposed patch.
>
> Patrick Marlier.
>
>
>
>
>
-------------- next part --------------
Index: src/atomic_ops.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/libatomic_ops/src/atomic_ops.h,v
retrieving revision 1.3
diff -u -r1.3 atomic_ops.h
--- src/atomic_ops.h 17 Dec 2009 07:16:46 -0000 1.3
+++ src/atomic_ops.h 19 Feb 2010 07:58:38 -0000
@@ -199,6 +199,9 @@
#if defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS) \
&& !defined(__INTEL_COMPILER)
+# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# define HAVE_GCC_ATOMIC_BUILTINS 1
+# endif
# if defined(__i386__)
# include "atomic_ops/sysdeps/gcc/x86.h"
# endif /* __i386__ */
@@ -252,6 +255,18 @@
# include "atomic_ops/sysdeps/icc/ia64.h"
# define AO_GENERALIZE_TWICE
# endif
+# if defined(__GNUC__)
+ /* Intel Compiler in gcc compatible mode */
+# if __INTEL_COMPILER > 1110
+# define HAVE_GCC_ATOMIC_BUILTINS 1
+# endif /* __INTEL_COMPILER */
+# if defined(__i386__)
+# include "atomic_ops/sysdeps/gcc/x86.h"
+# endif /* __i386__ */
+# if defined (__x86_64__)
+# include "atomic_ops/sysdeps/gcc/x86_64.h"
+# endif
+# endif
#endif
#if defined(_HPUX_SOURCE) && !defined(__GNUC__) && !defined(AO_USE_PTHREAD_DEFS)
Index: src/atomic_ops/sysdeps/gcc/x86_64.h
===================================================================
RCS file: /cvsroot/bdwgc/bdwgc/libatomic_ops/src/atomic_ops/sysdeps/gcc/x86_64.h,v
retrieving revision 1.3
diff -u -r1.3 x86_64.h
--- src/atomic_ops/sysdeps/gcc/x86_64.h 18 Feb 2010 10:12:08 -0000 1.3
+++ src/atomic_ops/sysdeps/gcc/x86_64.h 19 Feb 2010 07:58:38 -0000
@@ -121,7 +121,7 @@
AO_INLINE int
AO_compare_and_swap_full(volatile AO_t *addr, AO_t old, AO_t new_val)
{
-# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# ifdef HAVE_GCC_ATOMIC_BUILTINS
return (int)__sync_bool_compare_and_swap(addr, old, new_val);
# else
char result;
More information about the Gc
mailing list