1 /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
3 /* Validate that each of the __sync builtins compiles. This won't
4 necessarily link, since the target might not support the builtin,
5 so this may result in external library calls. */
7 void test_op_ignore (void)
17 signed long long sll[2];
18 unsigned long long ull[2];
19 (void) __sync_fetch_and_add (&sc[1], -1);
20 (void) __sync_fetch_and_add (&uc[1], -1);
21 (void) __sync_fetch_and_add (&ss[1], -1);
22 (void) __sync_fetch_and_add (&us[1], -1);
23 (void) __sync_fetch_and_add (&si[1], -1);
24 (void) __sync_fetch_and_add (&ui[1], -1);
25 (void) __sync_fetch_and_add (&sl[1], -1);
26 (void) __sync_fetch_and_add (&ul[1], -1);
27 (void) __sync_fetch_and_add (&sll[1], -1);
28 (void) __sync_fetch_and_add (&ull[1], -1);
30 (void) __sync_fetch_and_sub (&sc[1], -1);
31 (void) __sync_fetch_and_sub (&uc[1], -1);
32 (void) __sync_fetch_and_sub (&ss[1], -1);
33 (void) __sync_fetch_and_sub (&us[1], -1);
34 (void) __sync_fetch_and_sub (&si[1], -1);
35 (void) __sync_fetch_and_sub (&ui[1], -1);
36 (void) __sync_fetch_and_sub (&sl[1], -1);
37 (void) __sync_fetch_and_sub (&ul[1], -1);
38 (void) __sync_fetch_and_sub (&sll[1], -1);
39 (void) __sync_fetch_and_sub (&ull[1], -1);
41 (void) __sync_fetch_and_or (&sc[1], -1);
42 (void) __sync_fetch_and_or (&uc[1], -1);
43 (void) __sync_fetch_and_or (&ss[1], -1);
44 (void) __sync_fetch_and_or (&us[1], -1);
45 (void) __sync_fetch_and_or (&si[1], -1);
46 (void) __sync_fetch_and_or (&ui[1], -1);
47 (void) __sync_fetch_and_or (&sl[1], -1);
48 (void) __sync_fetch_and_or (&ul[1], -1);
49 (void) __sync_fetch_and_or (&sll[1], -1);
50 (void) __sync_fetch_and_or (&ull[1], -1);
52 (void) __sync_fetch_and_xor (&sc[1], -1);
53 (void) __sync_fetch_and_xor (&uc[1], -1);
54 (void) __sync_fetch_and_xor (&ss[1], -1);
55 (void) __sync_fetch_and_xor (&us[1], -1);
56 (void) __sync_fetch_and_xor (&si[1], -1);
57 (void) __sync_fetch_and_xor (&ui[1], -1);
58 (void) __sync_fetch_and_xor (&sl[1], -1);
59 (void) __sync_fetch_and_xor (&ul[1], -1);
60 (void) __sync_fetch_and_xor (&sll[1], -1);
61 (void) __sync_fetch_and_xor (&ull[1], -1);
63 (void) __sync_fetch_and_and (&sc[1], -1);
64 (void) __sync_fetch_and_and (&uc[1], -1);
65 (void) __sync_fetch_and_and (&ss[1], -1);
66 (void) __sync_fetch_and_and (&us[1], -1);
67 (void) __sync_fetch_and_and (&si[1], -1);
68 (void) __sync_fetch_and_and (&ui[1], -1);
69 (void) __sync_fetch_and_and (&sl[1], -1);
70 (void) __sync_fetch_and_and (&ul[1], -1);
71 (void) __sync_fetch_and_and (&sll[1], -1);
72 (void) __sync_fetch_and_and (&ull[1], -1);
74 (void) __sync_fetch_and_nand (&sc[1], -1);
75 (void) __sync_fetch_and_nand (&uc[1], -1);
76 (void) __sync_fetch_and_nand (&ss[1], -1);
77 (void) __sync_fetch_and_nand (&us[1], -1);
78 (void) __sync_fetch_and_nand (&si[1], -1);
79 (void) __sync_fetch_and_nand (&ui[1], -1);
80 (void) __sync_fetch_and_nand (&sl[1], -1);
81 (void) __sync_fetch_and_nand (&ul[1], -1);
82 (void) __sync_fetch_and_nand (&sll[1], -1);
83 (void) __sync_fetch_and_nand (&ull[1], -1);
86 void test_fetch_and_op (void)
96 signed long long sll[2];
97 unsigned long long ull[2];
98 sc[1] = __sync_fetch_and_add (&sc[1], -11);
99 uc[1] = __sync_fetch_and_add (&uc[1], -11);
100 ss[1] = __sync_fetch_and_add (&ss[1], -11);
101 us[1] = __sync_fetch_and_add (&us[1], -11);
102 si[1] = __sync_fetch_and_add (&si[1], -11);
103 ui[1] = __sync_fetch_and_add (&ui[1], -11);
104 sl[1] = __sync_fetch_and_add (&sl[1], -11);
105 ul[1] = __sync_fetch_and_add (&ul[1], -11);
106 sll[1] = __sync_fetch_and_add (&sll[1], -11);
107 ull[1] = __sync_fetch_and_add (&ull[1], -11);
109 sc[1] = __sync_fetch_and_sub (&sc[1], -11);
110 uc[1] = __sync_fetch_and_sub (&uc[1], -11);
111 ss[1] = __sync_fetch_and_sub (&ss[1], -11);
112 us[1] = __sync_fetch_and_sub (&us[1], -11);
113 si[1] = __sync_fetch_and_sub (&si[1], -11);
114 ui[1] = __sync_fetch_and_sub (&ui[1], -11);
115 sl[1] = __sync_fetch_and_sub (&sl[1], -11);
116 ul[1] = __sync_fetch_and_sub (&ul[1], -11);
117 sll[1] = __sync_fetch_and_sub (&sll[1], -11);
118 ull[1] = __sync_fetch_and_sub (&ull[1], -11);
120 sc[1] = __sync_fetch_and_or (&sc[1], -11);
121 uc[1] = __sync_fetch_and_or (&uc[1], -11);
122 ss[1] = __sync_fetch_and_or (&ss[1], -11);
123 us[1] = __sync_fetch_and_or (&us[1], -11);
124 si[1] = __sync_fetch_and_or (&si[1], -11);
125 ui[1] = __sync_fetch_and_or (&ui[1], -11);
126 sl[1] = __sync_fetch_and_or (&sl[1], -11);
127 ul[1] = __sync_fetch_and_or (&ul[1], -11);
128 sll[1] = __sync_fetch_and_or (&sll[1], -11);
129 ull[1] = __sync_fetch_and_or (&ull[1], -11);
131 sc[1] = __sync_fetch_and_xor (&sc[1], -11);
132 uc[1] = __sync_fetch_and_xor (&uc[1], -11);
133 ss[1] = __sync_fetch_and_xor (&ss[1], -11);
134 us[1] = __sync_fetch_and_xor (&us[1], -11);
135 si[1] = __sync_fetch_and_xor (&si[1], -11);
136 ui[1] = __sync_fetch_and_xor (&ui[1], -11);
137 sl[1] = __sync_fetch_and_xor (&sl[1], -11);
138 ul[1] = __sync_fetch_and_xor (&ul[1], -11);
139 sll[1] = __sync_fetch_and_xor (&sll[1], -11);
140 ull[1] = __sync_fetch_and_xor (&ull[1], -11);
142 sc[1] = __sync_fetch_and_and (&sc[1], -11);
143 uc[1] = __sync_fetch_and_and (&uc[1], -11);
144 ss[1] = __sync_fetch_and_and (&ss[1], -11);
145 us[1] = __sync_fetch_and_and (&us[1], -11);
146 si[1] = __sync_fetch_and_and (&si[1], -11);
147 ui[1] = __sync_fetch_and_and (&ui[1], -11);
148 sl[1] = __sync_fetch_and_and (&sl[1], -11);
149 ul[1] = __sync_fetch_and_and (&ul[1], -11);
150 sll[1] = __sync_fetch_and_and (&sll[1], -11);
151 ull[1] = __sync_fetch_and_and (&ull[1], -11);
153 sc[1] = __sync_fetch_and_nand (&sc[1], -11);
154 uc[1] = __sync_fetch_and_nand (&uc[1], -11);
155 ss[1] = __sync_fetch_and_nand (&ss[1], -11);
156 us[1] = __sync_fetch_and_nand (&us[1], -11);
157 si[1] = __sync_fetch_and_nand (&si[1], -11);
158 ui[1] = __sync_fetch_and_nand (&ui[1], -11);
159 sl[1] = __sync_fetch_and_nand (&sl[1], -11);
160 ul[1] = __sync_fetch_and_nand (&ul[1], -11);
161 sll[1] = __sync_fetch_and_nand (&sll[1], -11);
162 ull[1] = __sync_fetch_and_nand (&ull[1], -11);
165 void test_lock (void)
170 unsigned short us[2];
175 signed long long sll[2];
176 unsigned long long ull[2];
177 sc[1] = __sync_lock_test_and_set (&sc[1], -1);
178 uc[1] = __sync_lock_test_and_set (&uc[1], -1);
179 ss[1] = __sync_lock_test_and_set (&ss[1], -1);
180 us[1] = __sync_lock_test_and_set (&us[1], -1);
181 si[1] = __sync_lock_test_and_set (&si[1], -1);
182 ui[1] = __sync_lock_test_and_set (&ui[1], -1);
183 sl[1] = __sync_lock_test_and_set (&sl[1], -1);
184 ul[1] = __sync_lock_test_and_set (&ul[1], -1);
185 sll[1] = __sync_lock_test_and_set (&sll[1], -1);
186 ull[1] = __sync_lock_test_and_set (&ull[1], -1);