@@ -131,6 +131,9 @@ dnl Check with:
131
131
dnl 1. No compiler/linker flags.
132
132
dnl 2. CFLAGS += -mcx16
133
133
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.
134
137
dnl
135
138
dnl Note that we unfortunately can't use AC SEARCH_LIBS because its
136
139
dnl check incorrectly fails (because these functions are special compiler
@@ -186,6 +189,18 @@ AC_DEFUN([OPAL_ASM_CHECK_ATOMIC_FUNC],[
186
189
AC_MSG_RESULT ( [ no] ) ] )
187
190
] )
188
191
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
+
189
204
AS_IF ( [ test $opal_asm_check_func_happy -eq 1] , [ $3 ] , [ $4 ] )
190
205
191
206
OPAL_VAR_SCOPE_POP
@@ -204,17 +219,6 @@ AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [
204
219
[ sync_bool_compare_and_swap_128_result=1] ,
205
220
[ sync_bool_compare_and_swap_128_result=0] )
206
221
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
-
218
222
AC_DEFINE_UNQUOTED ( [ OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128] ,
219
223
[ $sync_bool_compare_and_swap_128_result] ,
220
224
[ Whether the __sync builtin atomic compare and swap supports 128-bit values] )
@@ -267,17 +271,6 @@ AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [
267
271
[ atomic_compare_exchange_n_128_result=1] ,
268
272
[ atomic_compare_exchange_n_128_result=0] )
269
273
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
-
281
274
# If we have it and it works, check to make sure it is always lock
282
275
# free.
283
276
AS_IF ( [ test $atomic_compare_exchange_n_128_result -eq 1] ,
0 commit comments