From 73cdda90dfea998be728d0c9db99df91aad8725a Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 18 Sep 2012 20:48:08 +0400 Subject: [PATCH] Fix compare_double_and_swap_double_full for gcc/x32 * src/atomic_ops.h: Include gcc/x86.h instead of gcc/x86_64.h if gcc/x32 (i.e., GCC (or Intel compiler), __x86_64__ is defined, and __ILP32__ is defined) to have AO_compare_double_and_swap_double_full defined properly (based on cmpxchg8b); explicitly define AO_USE_PENTIUM4_INSTRS for gcc/x32. * src/atomic_ops/sysdeps/gcc/x86_64.h: Remove ILP32-specific code (AO_T_IS_INT definition). --- src/atomic_ops.h | 18 ++++++++++++++++-- src/atomic_ops/sysdeps/gcc/x86_64.h | 6 +----- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/atomic_ops.h b/src/atomic_ops.h index f52e48b..9e6ce40 100644 --- a/src/atomic_ops.h +++ b/src/atomic_ops.h @@ -238,7 +238,14 @@ /* It is safe to use __sync CAS built-in on this architecture. */ # define AO_USE_SYNC_CAS_BUILTIN # endif -# include "atomic_ops/sysdeps/gcc/x86_64.h" +# ifdef __ILP32__ +# ifndef AO_USE_PENTIUM4_INSTRS +# define AO_USE_PENTIUM4_INSTRS +# endif +# include "atomic_ops/sysdeps/gcc/x86.h" +# else +# include "atomic_ops/sysdeps/gcc/x86_64.h" +# endif # endif /* __x86_64__ */ # if defined(__ia64__) # include "atomic_ops/sysdeps/gcc/ia64.h" @@ -313,7 +320,14 @@ # if (__INTEL_COMPILER > 1110) && !defined(AO_USE_SYNC_CAS_BUILTIN) # define AO_USE_SYNC_CAS_BUILTIN # endif -# include "atomic_ops/sysdeps/gcc/x86_64.h" +# ifdef __ILP32__ +# ifndef AO_USE_PENTIUM4_INSTRS +# define AO_USE_PENTIUM4_INSTRS +# endif +# include "atomic_ops/sysdeps/gcc/x86.h" +# else +# include "atomic_ops/sysdeps/gcc/x86_64.h" +# endif # endif /* __x86_64__ */ # endif #endif diff --git a/src/atomic_ops/sysdeps/gcc/x86_64.h b/src/atomic_ops/sysdeps/gcc/x86_64.h index 0999068..ccdb3f5 100644 --- a/src/atomic_ops/sysdeps/gcc/x86_64.h +++ b/src/atomic_ops/sysdeps/gcc/x86_64.h @@ -216,8 +216,4 @@ AO_compare_double_and_swap_double_full(volatile AO_double_t *addr, #define AO_HAVE_compare_double_and_swap_double_full #endif /* AO_WEAK_DOUBLE_CAS_EMULATION */ -#endif /* AO_CMPXCHG16B_AVAILABLE */ - -#ifdef __ILP32__ -# define AO_T_IS_INT -#endif +#endif /* !AO_CMPXCHG16B_AVAILABLE */ -- 2.7.4