c-cppbuiltin.c (c_cpp_builtins): Define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1...
2007-05-21 Paolo Bonzini <bonzini@gnu.org> Paolo Carlini <pcarlini@suse.de> Uros Bizjak <ubizjak@gmail.com> * 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 <bonzini@gnu.org> Paolo Carlini <pcarlini@suse.de> Uros Bizjak <ubizjak@gmail.com> * 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. Co-Authored-By: Paolo Carlini <pcarlini@suse.de> Co-Authored-By: Uros Bizjak <ubizjak@gmail.com> From-SVN: r124926
This commit is contained in:
parent
1b35264fab
commit
60c4429c7e
@ -1,3 +1,13 @@
|
||||
2007-05-21 Paolo Bonzini <bonzini@gnu.org>
|
||||
Paolo Carlini <pcarlini@suse.de>
|
||||
Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* 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 Mike Stump <mrs@apple.com>
|
||||
|
||||
* config/darwin.h (LINK_COMMAND_SPEC): Add .cxx for dsymutil
|
||||
|
@ -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__");
|
||||
|
@ -2179,6 +2179,14 @@ If GCC cannot determine the current date, it will emit a warning message
|
||||
(once per compilation) and @code{__TIMESTAMP__} will expand to
|
||||
@code{@w{"??? ??? ?? ??:??:?? ????"}}.
|
||||
|
||||
@item __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
@itemx __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
These macros are defined when the target processor supports atomic compare
|
||||
and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively.
|
||||
|
||||
@end table
|
||||
|
||||
@node System-specific Predefined Macros
|
||||
|
@ -1,3 +1,14 @@
|
||||
2007-05-21 Paolo Bonzini <bonzini@gnu.org>
|
||||
Paolo Carlini <pcarlini@suse.de>
|
||||
Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2005-05-21 Daniel Franke <franke.daniel@gmail.com>
|
||||
|
||||
PR fortran/32002
|
||||
|
56
gcc/testsuite/gcc.dg/gcc-have-sync-compare-and-swap.c
Normal file
56
gcc/testsuite/gcc.dg/gcc-have-sync-compare-and-swap.c
Normal file
@ -0,0 +1,56 @@
|
||||
/* { dg-do link } */
|
||||
|
||||
void f1()
|
||||
{
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
typedef int __attribute__ ((__mode__ (__QI__))) qi_int_type;
|
||||
qi_int_type qi_int;
|
||||
__sync_bool_compare_and_swap (&qi_int, (qi_int_type)0, (qi_int_type)1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void f2()
|
||||
{
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
typedef int __attribute__ ((__mode__ (__HI__))) hi_int_type;
|
||||
hi_int_type hi_int;
|
||||
__sync_bool_compare_and_swap (&hi_int, (hi_int_type)0, (hi_int_type)1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void f4()
|
||||
{
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
typedef int __attribute__ ((__mode__ (__SI__))) si_int_type;
|
||||
si_int_type si_int;
|
||||
__sync_bool_compare_and_swap (&si_int, (si_int_type)0, (si_int_type)1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void f8()
|
||||
{
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
typedef int __attribute__ ((__mode__ (__DI__))) di_int_type;
|
||||
di_int_type di_int;
|
||||
__sync_bool_compare_and_swap (&di_int, (di_int_type)0, (di_int_type)1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void f16()
|
||||
{
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
typedef int __attribute__ ((__mode__ (__TI__))) ti_int_type;
|
||||
ti_int_type ti_int;
|
||||
__sync_bool_compare_and_swap (&ti_int, (ti_int_type)0, (ti_int_type)1);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
f1();
|
||||
f2();
|
||||
f4();
|
||||
f8();
|
||||
f16();
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/* { dg-do preprocess { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
/* { dg-options "-march=i386" } */
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
#error nonono
|
||||
#endif
|
@ -0,0 +1,23 @@
|
||||
/* { dg-do preprocess { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
/* { dg-options "-march=i486" } */
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
#error nonono
|
||||
#endif
|
||||
|
@ -0,0 +1,22 @@
|
||||
/* { dg-do preprocess { target i?86-*-* x86_64-*-* } } */
|
||||
/* { dg-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
#error nonono
|
||||
#endif
|
@ -0,0 +1,22 @@
|
||||
/* { dg-do preprocess { target { { i?86-*-* x86_64-*-* } && lp64 } } } */
|
||||
/* { dg-options "-mcx16" } */
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
|
||||
#error nonono
|
||||
#endif
|
||||
|
||||
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
|
||||
#error nonono
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user