]>
Commit | Line | Data |
---|---|---|
60c4429c | 1 | /* { dg-do link } */ |
9a6dfb47 RS |
2 | /* MIPS only supports these built-in functions for non-MIPS16 mode, and |
3 | -mflip-mips16 will change the mode of some functions to be different | |
4 | from the command-line setting. */ | |
5 | /* { dg-skip-if "" { mips*-*-* } { "-mflip-mips16" } { "" } } */ | |
60c4429c PB |
6 | |
7 | void f1() | |
8 | { | |
9 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 | |
10 | typedef int __attribute__ ((__mode__ (__QI__))) qi_int_type; | |
11 | qi_int_type qi_int; | |
12 | __sync_bool_compare_and_swap (&qi_int, (qi_int_type)0, (qi_int_type)1); | |
13 | #endif | |
14 | } | |
15 | ||
16 | void f2() | |
17 | { | |
18 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 | |
19 | typedef int __attribute__ ((__mode__ (__HI__))) hi_int_type; | |
20 | hi_int_type hi_int; | |
21 | __sync_bool_compare_and_swap (&hi_int, (hi_int_type)0, (hi_int_type)1); | |
22 | #endif | |
23 | } | |
24 | ||
25 | void f4() | |
26 | { | |
27 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
28 | typedef int __attribute__ ((__mode__ (__SI__))) si_int_type; | |
29 | si_int_type si_int; | |
30 | __sync_bool_compare_and_swap (&si_int, (si_int_type)0, (si_int_type)1); | |
31 | #endif | |
32 | } | |
33 | ||
34 | void f8() | |
35 | { | |
36 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 | |
37 | typedef int __attribute__ ((__mode__ (__DI__))) di_int_type; | |
38 | di_int_type di_int; | |
39 | __sync_bool_compare_and_swap (&di_int, (di_int_type)0, (di_int_type)1); | |
40 | #endif | |
41 | } | |
42 | ||
f4b83d66 AK |
43 | /* aligned (16): On S/390 16 byte compare and swap operations are only |
44 | available if the memory operand resides on a 16 byte boundary. */ | |
60c4429c PB |
45 | void f16() |
46 | { | |
47 | #ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 | |
f4b83d66 | 48 | typedef int __attribute__ ((__mode__ (__TI__), aligned (16))) ti_int_type; |
60c4429c PB |
49 | ti_int_type ti_int; |
50 | __sync_bool_compare_and_swap (&ti_int, (ti_int_type)0, (ti_int_type)1); | |
51 | #endif | |
52 | } | |
53 | ||
54 | int main() | |
55 | { | |
56 | f1(); | |
57 | f2(); | |
58 | f4(); | |
59 | f8(); | |
60 | f16(); | |
61 | return 0; | |
62 | } |