OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [sync-1.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
/* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
2
/* { dg-message "note: '__sync_nand_and_fetch' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
3
/* { dg-options "-ffat-lto-objects" } */
4
 
5
/* Validate that each of the __sync builtins compiles.  This won't
6
   necessarily link, since the target might not support the builtin,
7
   so this may result in external library calls.  */
8
 
9
signed char sc;
10
unsigned char uc;
11
signed short ss;
12
unsigned short us;
13
signed int si;
14
unsigned int ui;
15
signed long sl;
16
unsigned long ul;
17
signed long long sll;
18
unsigned long long ull;
19
void *vp;
20
int *ip;
21
struct S { struct S *next; int x; } *sp;
22
 
23
void test_op_ignore (void)
24
{
25
  (void) __sync_fetch_and_add (&sc, 1);
26
  (void) __sync_fetch_and_add (&uc, 1);
27
  (void) __sync_fetch_and_add (&ss, 1);
28
  (void) __sync_fetch_and_add (&us, 1);
29
  (void) __sync_fetch_and_add (&si, 1);
30
  (void) __sync_fetch_and_add (&ui, 1);
31
  (void) __sync_fetch_and_add (&sl, 1);
32
  (void) __sync_fetch_and_add (&ul, 1);
33
  (void) __sync_fetch_and_add (&sll, 1);
34
  (void) __sync_fetch_and_add (&ull, 1);
35
 
36
  (void) __sync_fetch_and_sub (&sc, 1);
37
  (void) __sync_fetch_and_sub (&uc, 1);
38
  (void) __sync_fetch_and_sub (&ss, 1);
39
  (void) __sync_fetch_and_sub (&us, 1);
40
  (void) __sync_fetch_and_sub (&si, 1);
41
  (void) __sync_fetch_and_sub (&ui, 1);
42
  (void) __sync_fetch_and_sub (&sl, 1);
43
  (void) __sync_fetch_and_sub (&ul, 1);
44
  (void) __sync_fetch_and_sub (&sll, 1);
45
  (void) __sync_fetch_and_sub (&ull, 1);
46
 
47
  (void) __sync_fetch_and_or (&sc, 1);
48
  (void) __sync_fetch_and_or (&uc, 1);
49
  (void) __sync_fetch_and_or (&ss, 1);
50
  (void) __sync_fetch_and_or (&us, 1);
51
  (void) __sync_fetch_and_or (&si, 1);
52
  (void) __sync_fetch_and_or (&ui, 1);
53
  (void) __sync_fetch_and_or (&sl, 1);
54
  (void) __sync_fetch_and_or (&ul, 1);
55
  (void) __sync_fetch_and_or (&sll, 1);
56
  (void) __sync_fetch_and_or (&ull, 1);
57
 
58
  (void) __sync_fetch_and_xor (&sc, 1);
59
  (void) __sync_fetch_and_xor (&uc, 1);
60
  (void) __sync_fetch_and_xor (&ss, 1);
61
  (void) __sync_fetch_and_xor (&us, 1);
62
  (void) __sync_fetch_and_xor (&si, 1);
63
  (void) __sync_fetch_and_xor (&ui, 1);
64
  (void) __sync_fetch_and_xor (&sl, 1);
65
  (void) __sync_fetch_and_xor (&ul, 1);
66
  (void) __sync_fetch_and_xor (&sll, 1);
67
  (void) __sync_fetch_and_xor (&ull, 1);
68
 
69
  (void) __sync_fetch_and_and (&sc, 1);
70
  (void) __sync_fetch_and_and (&uc, 1);
71
  (void) __sync_fetch_and_and (&ss, 1);
72
  (void) __sync_fetch_and_and (&us, 1);
73
  (void) __sync_fetch_and_and (&si, 1);
74
  (void) __sync_fetch_and_and (&ui, 1);
75
  (void) __sync_fetch_and_and (&sl, 1);
76
  (void) __sync_fetch_and_and (&ul, 1);
77
  (void) __sync_fetch_and_and (&sll, 1);
78
  (void) __sync_fetch_and_and (&ull, 1);
79
 
80
  (void) __sync_fetch_and_nand (&sc, 1);
81
  (void) __sync_fetch_and_nand (&uc, 1);
82
  (void) __sync_fetch_and_nand (&ss, 1);
83
  (void) __sync_fetch_and_nand (&us, 1);
84
  (void) __sync_fetch_and_nand (&si, 1);
85
  (void) __sync_fetch_and_nand (&ui, 1);
86
  (void) __sync_fetch_and_nand (&sl, 1);
87
  (void) __sync_fetch_and_nand (&ul, 1);
88
  (void) __sync_fetch_and_nand (&sll, 1);
89
  (void) __sync_fetch_and_nand (&ull, 1);
90
}
91
 
92
void test_fetch_and_op (void)
93
{
94
  sc = __sync_fetch_and_add (&sc, 11);
95
  uc = __sync_fetch_and_add (&uc, 11);
96
  ss = __sync_fetch_and_add (&ss, 11);
97
  us = __sync_fetch_and_add (&us, 11);
98
  si = __sync_fetch_and_add (&si, 11);
99
  ui = __sync_fetch_and_add (&ui, 11);
100
  sl = __sync_fetch_and_add (&sl, 11);
101
  ul = __sync_fetch_and_add (&ul, 11);
102
  sll = __sync_fetch_and_add (&sll, 11);
103
  ull = __sync_fetch_and_add (&ull, 11);
104
 
105
  sc = __sync_fetch_and_sub (&sc, 11);
106
  uc = __sync_fetch_and_sub (&uc, 11);
107
  ss = __sync_fetch_and_sub (&ss, 11);
108
  us = __sync_fetch_and_sub (&us, 11);
109
  si = __sync_fetch_and_sub (&si, 11);
110
  ui = __sync_fetch_and_sub (&ui, 11);
111
  sl = __sync_fetch_and_sub (&sl, 11);
112
  ul = __sync_fetch_and_sub (&ul, 11);
113
  sll = __sync_fetch_and_sub (&sll, 11);
114
  ull = __sync_fetch_and_sub (&ull, 11);
115
 
116
  sc = __sync_fetch_and_or (&sc, 11);
117
  uc = __sync_fetch_and_or (&uc, 11);
118
  ss = __sync_fetch_and_or (&ss, 11);
119
  us = __sync_fetch_and_or (&us, 11);
120
  si = __sync_fetch_and_or (&si, 11);
121
  ui = __sync_fetch_and_or (&ui, 11);
122
  sl = __sync_fetch_and_or (&sl, 11);
123
  ul = __sync_fetch_and_or (&ul, 11);
124
  sll = __sync_fetch_and_or (&sll, 11);
125
  ull = __sync_fetch_and_or (&ull, 11);
126
 
127
  sc = __sync_fetch_and_xor (&sc, 11);
128
  uc = __sync_fetch_and_xor (&uc, 11);
129
  ss = __sync_fetch_and_xor (&ss, 11);
130
  us = __sync_fetch_and_xor (&us, 11);
131
  si = __sync_fetch_and_xor (&si, 11);
132
  ui = __sync_fetch_and_xor (&ui, 11);
133
  sl = __sync_fetch_and_xor (&sl, 11);
134
  ul = __sync_fetch_and_xor (&ul, 11);
135
  sll = __sync_fetch_and_xor (&sll, 11);
136
  ull = __sync_fetch_and_xor (&ull, 11);
137
 
138
  sc = __sync_fetch_and_and (&sc, 11);
139
  uc = __sync_fetch_and_and (&uc, 11);
140
  ss = __sync_fetch_and_and (&ss, 11);
141
  us = __sync_fetch_and_and (&us, 11);
142
  si = __sync_fetch_and_and (&si, 11);
143
  ui = __sync_fetch_and_and (&ui, 11);
144
  sl = __sync_fetch_and_and (&sl, 11);
145
  ul = __sync_fetch_and_and (&ul, 11);
146
  sll = __sync_fetch_and_and (&sll, 11);
147
  ull = __sync_fetch_and_and (&ull, 11);
148
 
149
  sc = __sync_fetch_and_nand (&sc, 11);
150
  uc = __sync_fetch_and_nand (&uc, 11);
151
  ss = __sync_fetch_and_nand (&ss, 11);
152
  us = __sync_fetch_and_nand (&us, 11);
153
  si = __sync_fetch_and_nand (&si, 11);
154
  ui = __sync_fetch_and_nand (&ui, 11);
155
  sl = __sync_fetch_and_nand (&sl, 11);
156
  ul = __sync_fetch_and_nand (&ul, 11);
157
  sll = __sync_fetch_and_nand (&sll, 11);
158
  ull = __sync_fetch_and_nand (&ull, 11);
159
}
160
 
161
void test_op_and_fetch (void)
162
{
163
  sc = __sync_add_and_fetch (&sc, uc);
164
  uc = __sync_add_and_fetch (&uc, uc);
165
  ss = __sync_add_and_fetch (&ss, uc);
166
  us = __sync_add_and_fetch (&us, uc);
167
  si = __sync_add_and_fetch (&si, uc);
168
  ui = __sync_add_and_fetch (&ui, uc);
169
  sl = __sync_add_and_fetch (&sl, uc);
170
  ul = __sync_add_and_fetch (&ul, uc);
171
  sll = __sync_add_and_fetch (&sll, uc);
172
  ull = __sync_add_and_fetch (&ull, uc);
173
 
174
  sc = __sync_sub_and_fetch (&sc, uc);
175
  uc = __sync_sub_and_fetch (&uc, uc);
176
  ss = __sync_sub_and_fetch (&ss, uc);
177
  us = __sync_sub_and_fetch (&us, uc);
178
  si = __sync_sub_and_fetch (&si, uc);
179
  ui = __sync_sub_and_fetch (&ui, uc);
180
  sl = __sync_sub_and_fetch (&sl, uc);
181
  ul = __sync_sub_and_fetch (&ul, uc);
182
  sll = __sync_sub_and_fetch (&sll, uc);
183
  ull = __sync_sub_and_fetch (&ull, uc);
184
 
185
  sc = __sync_or_and_fetch (&sc, uc);
186
  uc = __sync_or_and_fetch (&uc, uc);
187
  ss = __sync_or_and_fetch (&ss, uc);
188
  us = __sync_or_and_fetch (&us, uc);
189
  si = __sync_or_and_fetch (&si, uc);
190
  ui = __sync_or_and_fetch (&ui, uc);
191
  sl = __sync_or_and_fetch (&sl, uc);
192
  ul = __sync_or_and_fetch (&ul, uc);
193
  sll = __sync_or_and_fetch (&sll, uc);
194
  ull = __sync_or_and_fetch (&ull, uc);
195
 
196
  sc = __sync_xor_and_fetch (&sc, uc);
197
  uc = __sync_xor_and_fetch (&uc, uc);
198
  ss = __sync_xor_and_fetch (&ss, uc);
199
  us = __sync_xor_and_fetch (&us, uc);
200
  si = __sync_xor_and_fetch (&si, uc);
201
  ui = __sync_xor_and_fetch (&ui, uc);
202
  sl = __sync_xor_and_fetch (&sl, uc);
203
  ul = __sync_xor_and_fetch (&ul, uc);
204
  sll = __sync_xor_and_fetch (&sll, uc);
205
  ull = __sync_xor_and_fetch (&ull, uc);
206
 
207
  sc = __sync_and_and_fetch (&sc, uc);
208
  uc = __sync_and_and_fetch (&uc, uc);
209
  ss = __sync_and_and_fetch (&ss, uc);
210
  us = __sync_and_and_fetch (&us, uc);
211
  si = __sync_and_and_fetch (&si, uc);
212
  ui = __sync_and_and_fetch (&ui, uc);
213
  sl = __sync_and_and_fetch (&sl, uc);
214
  ul = __sync_and_and_fetch (&ul, uc);
215
  sll = __sync_and_and_fetch (&sll, uc);
216
  ull = __sync_and_and_fetch (&ull, uc);
217
 
218
  sc = __sync_nand_and_fetch (&sc, uc);
219
  uc = __sync_nand_and_fetch (&uc, uc);
220
  ss = __sync_nand_and_fetch (&ss, uc);
221
  us = __sync_nand_and_fetch (&us, uc);
222
  si = __sync_nand_and_fetch (&si, uc);
223
  ui = __sync_nand_and_fetch (&ui, uc);
224
  sl = __sync_nand_and_fetch (&sl, uc);
225
  ul = __sync_nand_and_fetch (&ul, uc);
226
  sll = __sync_nand_and_fetch (&sll, uc);
227
  ull = __sync_nand_and_fetch (&ull, uc);
228
}
229
 
230
void test_compare_and_swap (void)
231
{
232
  sc = __sync_val_compare_and_swap (&sc, uc, sc);
233
  uc = __sync_val_compare_and_swap (&uc, uc, sc);
234
  ss = __sync_val_compare_and_swap (&ss, uc, sc);
235
  us = __sync_val_compare_and_swap (&us, uc, sc);
236
  si = __sync_val_compare_and_swap (&si, uc, sc);
237
  ui = __sync_val_compare_and_swap (&ui, uc, sc);
238
  sl = __sync_val_compare_and_swap (&sl, uc, sc);
239
  ul = __sync_val_compare_and_swap (&ul, uc, sc);
240
  sll = __sync_val_compare_and_swap (&sll, uc, sc);
241
  ull = __sync_val_compare_and_swap (&ull, uc, sc);
242
 
243
  ui = __sync_bool_compare_and_swap (&sc, uc, sc);
244
  ui = __sync_bool_compare_and_swap (&uc, uc, sc);
245
  ui = __sync_bool_compare_and_swap (&ss, uc, sc);
246
  ui = __sync_bool_compare_and_swap (&us, uc, sc);
247
  ui = __sync_bool_compare_and_swap (&si, uc, sc);
248
  ui = __sync_bool_compare_and_swap (&ui, uc, sc);
249
  ui = __sync_bool_compare_and_swap (&sl, uc, sc);
250
  ui = __sync_bool_compare_and_swap (&ul, uc, sc);
251
  ui = __sync_bool_compare_and_swap (&sll, uc, sc);
252
  ui = __sync_bool_compare_and_swap (&ull, uc, sc);
253
}
254
 
255
void test_lock (void)
256
{
257
  sc = __sync_lock_test_and_set (&sc, 1);
258
  uc = __sync_lock_test_and_set (&uc, 1);
259
  ss = __sync_lock_test_and_set (&ss, 1);
260
  us = __sync_lock_test_and_set (&us, 1);
261
  si = __sync_lock_test_and_set (&si, 1);
262
  ui = __sync_lock_test_and_set (&ui, 1);
263
  sl = __sync_lock_test_and_set (&sl, 1);
264
  ul = __sync_lock_test_and_set (&ul, 1);
265
  sll = __sync_lock_test_and_set (&sll, 1);
266
  ull = __sync_lock_test_and_set (&ull, 1);
267
 
268
  __sync_synchronize ();
269
 
270
  __sync_lock_release (&sc);
271
  __sync_lock_release (&uc);
272
  __sync_lock_release (&ss);
273
  __sync_lock_release (&us);
274
  __sync_lock_release (&si);
275
  __sync_lock_release (&ui);
276
  __sync_lock_release (&sl);
277
  __sync_lock_release (&ul);
278
  __sync_lock_release (&sll);
279
  __sync_lock_release (&ull);
280
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.