From 893358f78aabd274a5f60b825899945ae3ea15f3 Mon Sep 17 00:00:00 2001 From: paolo Date: Mon, 21 May 2007 22:48:38 +0000 Subject: 2007-05-21 Paolo Bonzini Paolo Carlini Uros Bizjak * c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16, if appropriate. * doc/cpp.texi ([Standard Predefined Macros]): Document. 2007-05-21 Paolo Bonzini Paolo Carlini Uros Bizjak * gcc.dg/gcc-have-sync-compare-and-swap.c, gcc.target/i386/gcc-have-sync-compare-and-swap-1.c, gcc.target/i386/gcc-have-sync-compare-and-swap-2.c, gcc.target/i386/gcc-have-sync-compare-and-swap-3.c, gcc.target/i386/gcc-have-sync-compare-and-swap-4.c, New testcases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124926 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/c-cppbuiltin.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gcc/c-cppbuiltin.c') diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 544050a4878..1b52da02975 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -547,6 +547,33 @@ c_cpp_builtins (cpp_reader *pfile) if (c_dialect_cxx () && TYPE_UNSIGNED (wchar_type_node)) cpp_define (pfile, "__WCHAR_UNSIGNED__"); + /* Tell source code if the compiler makes sync_compare_and_swap + builtins available. */ +#ifdef HAVE_sync_compare_and_swapqi + if (HAVE_sync_compare_and_swapqi) + cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1"); +#endif + +#ifdef HAVE_sync_compare_and_swaphi + if (HAVE_sync_compare_and_swaphi) + cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2"); +#endif + +#ifdef HAVE_sync_compare_and_swapsi + if (HAVE_sync_compare_and_swapsi) + cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4"); +#endif + +#ifdef HAVE_sync_compare_and_swapdi + if (HAVE_sync_compare_and_swapdi) + cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8"); +#endif + +#ifdef HAVE_sync_compare_and_swapti + if (HAVE_sync_compare_and_swapti) + cpp_define (pfile, "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16"); +#endif + /* Make the choice of ObjC runtime visible to source code. */ if (c_dialect_objc () && flag_next_runtime) cpp_define (pfile, "__NEXT_RUNTIME__"); -- cgit v1.2.3