OSDN Git Service

* gcc.dg/dfp/func-array.c: Support -DDBG to report individual failures.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / gcc-have-sync-compare-and-swap.c
1 /* { dg-do link } */
2
3 void f1()
4 {
5 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
6   typedef int __attribute__  ((__mode__ (__QI__))) qi_int_type;
7   qi_int_type qi_int;
8   __sync_bool_compare_and_swap (&qi_int, (qi_int_type)0, (qi_int_type)1);
9 #endif
10 }
11
12 void f2()
13 {
14 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
15   typedef int __attribute__ ((__mode__ (__HI__))) hi_int_type;
16   hi_int_type hi_int;
17   __sync_bool_compare_and_swap (&hi_int, (hi_int_type)0, (hi_int_type)1);
18 #endif
19 }
20
21 void f4()
22 {
23 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
24   typedef int __attribute__ ((__mode__ (__SI__))) si_int_type;
25   si_int_type si_int;
26   __sync_bool_compare_and_swap (&si_int, (si_int_type)0, (si_int_type)1);
27 #endif
28 }
29
30 void f8()
31 {
32 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
33   typedef int __attribute__ ((__mode__ (__DI__))) di_int_type;
34   di_int_type di_int;
35   __sync_bool_compare_and_swap (&di_int, (di_int_type)0, (di_int_type)1);
36 #endif
37 }
38
39 void f16()
40 {
41 #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
42   typedef int __attribute__ ((__mode__ (__TI__))) ti_int_type;
43   ti_int_type ti_int;
44   __sync_bool_compare_and_swap (&ti_int, (ti_int_type)0, (ti_int_type)1);
45 #endif
46 }
47
48 int main()
49 {
50   f1();
51   f2();
52   f4();
53   f8();
54   f16();  
55   return 0;
56 }