Skip to content

Commit b2f33bc

Browse files
committed
opal/asm: fall back on inline asm atomics in some cases
This commit changes the asm configure logic to fall back on inline asm atomics on systems that 1) have __sync atomics, 2) do not have 64-bit __sync atomics, and 3) support 64-bit asm. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent d99a978 commit b2f33bc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

config/opal_config_asm.m4

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ __sync_add_and_fetch(&tmp, 1);],
110110
111111
AC_DEFINE_UNQUOTED([OPAL_ASM_SYNC_HAVE_64BIT],[$opal_asm_sync_have_64bit],
112112
[Whether 64-bit is supported by the __sync builtin atomics])
113+
114+
# Check for 128-bit support
115+
OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
113116
])
114117

115118

@@ -893,7 +896,6 @@ AC_DEFUN([OPAL_CONFIG_ASM],[
893896
opal_cv_asm_builtin="BUILTIN_NO"
894897
if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes" ; then
895898
OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"], [])
896-
OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128
897899
fi
898900
if test "$opal_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_osx_builtin_atomics" = "yes" ; then
899901
AC_CHECK_HEADER([libkern/OSAtomic.h],
@@ -1024,6 +1026,12 @@ AC_MSG_ERROR([Can not continue.])
10241026
;;
10251027
esac
10261028
1029+
if test "x$OPAL_ASM_SUPPORT_64BIT" = "x1" && test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" &&
1030+
test "$opal_asm_sync_have_64bit" = "0" ; then
1031+
# __sync builtins exist but do not implement 64-bit support. Fall back on inline asm.
1032+
opal_cv_asm_builtin="BUILTIN_NO"
1033+
fi
1034+
10271035
if test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" ; then
10281036
AC_DEFINE([OPAL_C_GCC_INLINE_ASSEMBLY], [1],
10291037
[Whether C compiler supports GCC style inline assembly])

0 commit comments

Comments
 (0)