Phil Endecott wrote:
David Daney wrote:The proper symbol to test would be something like: __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 or __GCC_HAVE_SYNC_LOCK_TEST_AND_SET_4 they are automatically set by GCC when the builtin functions are available.$ /home/daney/gccsvn/mips64-trunk/gcc/xgcc -B/home/daney/gccsvn/mips64-trunk/gcc/ -E -dM st.c | grep SYNC#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1Looking at http://gcc.gnu.org/viewcvs/trunk/gcc/c-cppbuiltin.c?revision=128218&view=markup it seems that the __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros are explicitly defined if the machine supports them, but not any of the other __SYNC_something builtins. Unless they come from somewhere else.
They don't exist. I think the reasoning is as follows: If the compare_and_swap builtin exists, then all others can (and will) be synthesized from it if they do not have their own implementations. So __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n indicates that *all* of the primitives exist.
David Daney