]> granicus.if.org Git - libatomic_ops/commitdiff
Fix compare_double_and_swap_double_full for gcc/x32
authorIvan Maidanski <ivmai@mail.ru>
Tue, 18 Sep 2012 16:48:08 +0000 (20:48 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 8 Oct 2012 09:59:05 +0000 (13:59 +0400)
* 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
src/atomic_ops/sysdeps/gcc/x86_64.h

index f52e48b230676ab23d7bcc9feb48f5938c4a2746..9e6ce409ad917d4228f9bdd97a8f152e64567d24 100644 (file)
       /* 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"
 #     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
index 09990687207c7f23ab4911f1e71cd411299b61b5..ccdb3f5d8c340016990ed4572b8585761835ee75 100644 (file)
@@ -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 */