Skip to content

Commit 358eca8

Browse files
committed
Squashme: result of George+Jeff discussion. This may actually fix the
IBM CI (and I may have unfairly been maligning IBM's CI if it was showing an actual problem... oops!). Signed-off-by: Jeff Squyres <[email protected]>
1 parent 7a98e70 commit 358eca8

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

config/opal_config_asm.m4

+15-22
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ dnl Check with:
131131
dnl 1. No compiler/linker flags.
132132
dnl 2. CFLAGS += -mcx16
133133
dnl 3. LIBS += -latomic
134+
dnl 4. Finally, if it links ok with any of #1, #2, or #3, actually try
135+
dnl to run the test code (if we're not cross-compiling) and verify
136+
dnl that it actually gives us the correct result.
134137
dnl
135138
dnl Note that we unfortunately can't use AC SEARCH_LIBS because its
136139
dnl check incorrectly fails (because these functions are special compiler
@@ -186,6 +189,18 @@ AC_DEFUN([OPAL_ASM_CHECK_ATOMIC_FUNC],[
186189
AC_MSG_RESULT([no])])
187190
])
188191
192+
dnl If we have it, try it and make sure it gives a correct result.
193+
dnl As of Aug 2018, we know that it links but does *not* work on clang
194+
dnl 6 on ARM64.
195+
AS_IF([test $opal_asm_check_func_happy -eq 1],
196+
[AC_MSG_CHECKING([if $1 gives correct results])
197+
AC_RUN_IFELSE([$2],
198+
[AC_MSG_RESULT([yes])],
199+
[opal_asm_check_func_happy=0
200+
AC_MSG_RESULT([no])],
201+
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
202+
])
203+
189204
AS_IF([test $opal_asm_check_func_happy -eq 1], [$3], [$4])
190205
191206
OPAL_VAR_SCOPE_POP
@@ -204,17 +219,6 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
204219
[sync_bool_compare_and_swap_128_result=1],
205220
[sync_bool_compare_and_swap_128_result=0])
206221
207-
# If we have it, try it, and make sure it works. As of Aug 2018, we
208-
# know that it links but does *not* work on clang 6 on ARM64.
209-
AS_IF([test $sync_bool_compare_and_swap_128_result -eq 1],
210-
[AC_MSG_CHECKING([if __sync_bool_compare_and_swap works])
211-
AC_RUN_IFELSE([AC_LANG_SOURCE(OPAL_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE)],
212-
[AC_MSG_RESULT([yes])],
213-
[sync_bool_compare_and_swap_128_result=0
214-
AC_MSG_RESULT([no])],
215-
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
216-
])
217-
218222
AC_DEFINE_UNQUOTED([OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128],
219223
[$sync_bool_compare_and_swap_128_result],
220224
[Whether the __sync builtin atomic compare and swap supports 128-bit values])
@@ -267,17 +271,6 @@ AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [
267271
[atomic_compare_exchange_n_128_result=1],
268272
[atomic_compare_exchange_n_128_result=0])
269273
270-
# If we have it, try it, and make sure it works. As of Aug 2018, we
271-
# know that it does *not* work on clang 6 on ARM64.
272-
AS_IF([test $atomic_compare_exchange_n_128_result -eq 1],
273-
[AC_MSG_CHECKING([if __atomic_compare_exchange_n works])
274-
AC_RUN_IFELSE([AC_LANG_SOURCE(OPAL_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE)],
275-
[AC_MSG_RESULT([yes])],
276-
[atomic_compare_exchange_n_128_result=0
277-
AC_MSG_RESULT([no])],
278-
[AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])])
279-
])
280-
281274
# If we have it and it works, check to make sure it is always lock
282275
# free.
283276
AS_IF([test $atomic_compare_exchange_n_128_result -eq 1],

0 commit comments

Comments
 (0)