1*49cdfc7eSAndroid Build Coastguard Workerdnl SPDX-License-Identifier: GPL-2.0-or-later 2*49cdfc7eSAndroid Build Coastguard Workerdnl Copyright (c) Linux Test Project, 2016 3*49cdfc7eSAndroid Build Coastguard Worker 4*49cdfc7eSAndroid Build Coastguard WorkerAC_DEFUN([LTP_CHECK_ATOMIC_MEMORY_MODEL],[ 5*49cdfc7eSAndroid Build Coastguard Worker AC_MSG_CHECKING([for __atomic_* compiler builtins]) 6*49cdfc7eSAndroid Build Coastguard Worker AC_LINK_IFELSE([AC_LANG_SOURCE([ 7*49cdfc7eSAndroid Build Coastguard Workerint main(void) { 8*49cdfc7eSAndroid Build Coastguard Worker int i = 0, j = 0; 9*49cdfc7eSAndroid Build Coastguard Worker __atomic_add_fetch(&i, 1, __ATOMIC_ACQ_REL); 10*49cdfc7eSAndroid Build Coastguard Worker __atomic_load_n(&i, __ATOMIC_SEQ_CST); 11*49cdfc7eSAndroid Build Coastguard Worker __atomic_store_n(&i, 0, __ATOMIC_RELAXED); 12*49cdfc7eSAndroid Build Coastguard Worker return i; 13*49cdfc7eSAndroid Build Coastguard Worker}])],[has_atomic_mm="yes"]) 14*49cdfc7eSAndroid Build Coastguard Worker 15*49cdfc7eSAndroid Build Coastguard Workerif test "x$has_atomic_mm" = xyes; then 16*49cdfc7eSAndroid Build Coastguard Worker AC_DEFINE(HAVE_ATOMIC_MEMORY_MODEL,1, 17*49cdfc7eSAndroid Build Coastguard Worker [Define to 1 if you have the __atomic_* compiler builtins]) 18*49cdfc7eSAndroid Build Coastguard Worker AC_MSG_RESULT(yes) 19*49cdfc7eSAndroid Build Coastguard Workerelse 20*49cdfc7eSAndroid Build Coastguard Worker AC_MSG_RESULT(no) 21*49cdfc7eSAndroid Build Coastguard Workerfi 22*49cdfc7eSAndroid Build Coastguard Worker]) 23