1 /* Exercise *_parser_oacc_shape_clause by checking various combinations
2 of gang, worker and vector clause arguments. */
3
4 /* { dg-compile } */
5
main()6 int main ()
7 {
8 int i;
9 int v = 32, w = 19;
10 int length = 1, num = 5;
11 int *abc;
12
13 /* Valid uses. */
14
15 #pragma acc kernels
16 #pragma acc loop gang worker vector
17 for (i = 0; i < 10; i++)
18 ;
19
20 #pragma acc kernels
21 #pragma acc loop gang(26)
22 for (i = 0; i < 10; i++)
23 ;
24
25 #pragma acc kernels
26 #pragma acc loop gang(v)
27 for (i = 0; i < 10; i++)
28 ;
29
30 #pragma acc kernels
31 #pragma acc loop vector(length: 16)
32 for (i = 0; i < 10; i++)
33 ;
34
35 #pragma acc kernels
36 #pragma acc loop vector(length: v)
37 for (i = 0; i < 10; i++)
38 ;
39
40 #pragma acc kernels
41 #pragma acc loop vector(16)
42 for (i = 0; i < 10; i++)
43 ;
44
45 #pragma acc kernels
46 #pragma acc loop vector(v)
47 for (i = 0; i < 10; i++)
48 ;
49
50 #pragma acc kernels
51 #pragma acc loop worker(num: 16)
52 for (i = 0; i < 10; i++)
53 ;
54
55 #pragma acc kernels
56 #pragma acc loop worker(num: v)
57 for (i = 0; i < 10; i++)
58 ;
59
60 #pragma acc kernels
61 #pragma acc loop worker(16)
62 for (i = 0; i < 10; i++)
63 ;
64
65 #pragma acc kernels
66 #pragma acc loop worker(v)
67 for (i = 0; i < 10; i++)
68 ;
69
70 #pragma acc kernels
71 #pragma acc loop gang(static: 16, num: 5)
72 for (i = 0; i < 10; i++)
73 ;
74
75 #pragma acc kernels
76 #pragma acc loop gang(static: v, num: w)
77 for (i = 0; i < 10; i++)
78 ;
79
80 #pragma acc kernels
81 #pragma acc loop vector(length)
82 for (i = 0; i < 10; i++)
83 ;
84
85 #pragma acc kernels
86 #pragma acc loop worker(num)
87 for (i = 0; i < 10; i++)
88 ;
89
90 #pragma acc kernels
91 #pragma acc loop gang(num, static: 6)
92 for (i = 0; i < 10; i++)
93 ;
94
95 #pragma acc kernels
96 #pragma acc loop gang(static: 5, num)
97 for (i = 0; i < 10; i++)
98 ;
99
100 #pragma acc kernels
101 #pragma acc loop gang(1, static:*)
102 for (i = 0; i < 10; i++)
103 ;
104
105 #pragma acc kernels
106 #pragma acc loop gang(static:*, 1)
107 for (i = 0; i < 10; i++)
108 ;
109
110 #pragma acc kernels
111 #pragma acc loop gang(1, static:*)
112 for (i = 0; i < 10; i++)
113 ;
114
115 #pragma acc kernels
116 #pragma acc loop gang(num: 5, static: 4)
117 for (i = 0; i < 10; i++)
118 ;
119
120 #pragma acc kernels
121 #pragma acc loop gang(num: v, static: w)
122 for (i = 0; i < 10; i++)
123 ;
124
125 #pragma acc kernels
126 #pragma acc loop gang(num, static:num)
127 for (i = 0; i < 10; i++)
128 ;
129
130 #pragma acc kernels
131 #pragma acc loop vector(length:length)
132 for (i = 0; i < 10; i++)
133 ;
134
135 #pragma acc kernels
136 #pragma acc loop worker(num:length)
137 for (i = 0; i < 10; i++)
138 ;
139
140 #pragma acc kernels
141 #pragma acc loop worker(num:num)
142 for (i = 0; i < 10; i++)
143 ;
144
145 /* Invalid uses. */
146
147 #pragma acc kernels
148 #pragma acc loop gang(16, 24) /* { dg-error "unexpected argument" } */
149 for (i = 0; i < 10; i++)
150 ;
151
152 #pragma acc kernels
153 #pragma acc loop gang(v, w) /* { dg-error "unexpected argument" } */
154 for (i = 0; i < 10; i++)
155 ;
156
157 #pragma acc kernels
158 #pragma acc loop gang(num: 1, num:2, num:3, 4) /* { dg-error "unexpected argument" } */
159 for (i = 0; i < 10; i++)
160 ;
161
162 #pragma acc kernels
163 #pragma acc loop gang(num: 1 num:2, num:3, 4) /* { dg-error "expected '.' before" } */
164 for (i = 0; i < 10; i++)
165 ;
166
167 #pragma acc kernels
168 #pragma acc loop gang(1, num:2, num:3, 4) /* { dg-error "unexpected argument" } */
169 for (i = 0; i < 10; i++)
170 ;
171
172 #pragma acc kernels
173 #pragma acc loop gang(num, num:5) /* { dg-error "unexpected argument" } */
174 for (i = 0; i < 10; i++)
175 ;
176
177 #pragma acc kernels
178 #pragma acc loop gang(length:num) /* { dg-error "" } */
179 for (i = 0; i < 10; i++)
180 ;
181
182 #pragma acc kernels
183 #pragma acc loop vector(5, length:length) /* { dg-error "expected '.' before" } */
184 for (i = 0; i < 10; i++)
185 ;
186
187 #pragma acc kernels
188 #pragma acc loop vector(num:length) /* { dg-error "" } */
189 for (i = 0; i < 10; i++)
190 ;
191
192 #pragma acc kernels
193 #pragma acc loop worker(length:5) /* { dg-error "expected '.' before" } */
194 for (i = 0; i < 10; i++)
195 ;
196
197 #pragma acc kernels
198 #pragma acc loop worker(1, num:2) /* { dg-error "expected '.' before" } */
199 for (i = 0; i < 10; i++)
200 ;
201
202 #pragma acc kernels
203 #pragma acc loop gang(static: * abc)
204 for (i = 0; i < 10; i++)
205 ;
206
207 #pragma acc kernels
208 #pragma acc loop gang(static:*num:1) /* { dg-error "" } */
209 for (i = 0; i < 10; i++)
210 ;
211
212 #pragma acc kernels
213 #pragma acc loop gang(num: 5 static: *) /* { dg-error "expected '.' before" } */
214 for (i = 0; i < 10; i++)
215 ;
216
217 #pragma acc kernels
218 #pragma acc loop gang(,static: *) /* { dg-error "" } */
219 for (i = 0; i < 10; i++)
220 ;
221
222 #pragma acc kernels
223 #pragma acc loop vector(,length:5) /* { dg-error "" } */
224 for (i = 0; i < 10; i++)
225 ;
226
227 #pragma acc kernels
228 #pragma acc loop worker(,num:10) /* { dg-error "" } */
229 for (i = 0; i < 10; i++)
230 ;
231
232 #pragma acc kernels
233 #pragma acc loop worker(,10) /* { dg-error "" } */
234 for (i = 0; i < 10; i++)
235 ;
236
237 #pragma acc kernels
238 #pragma acc loop vector(,10) /* { dg-error "" } */
239 for (i = 0; i < 10; i++)
240 ;
241
242 #pragma acc kernels
243 #pragma acc loop gang(,10) /* { dg-error "" } */
244 for (i = 0; i < 10; i++)
245 ;
246
247 #pragma acc kernels
248 #pragma acc loop gang(-12) /* { dg-warning "" } */
249 for (i = 0; i < 10; i++)
250 ;
251
252 #pragma acc kernels
253 #pragma acc loop gang(-1.0) /* { dg-error "" } */
254 for (i = 0; i < 10; i++)
255 ;
256
257 #pragma acc kernels
258 #pragma acc loop gang(1.0) /* { dg-error "" } */
259 for (i = 0; i < 10; i++)
260 ;
261
262 #pragma acc kernels
263 #pragma acc loop gang(num:-1.0) /* { dg-error "" } */
264 for (i = 0; i < 10; i++)
265 ;
266
267 #pragma acc kernels
268 #pragma acc loop gang(num:1.0) /* { dg-error "" } */
269 for (i = 0; i < 10; i++)
270 ;
271
272 #pragma acc kernels
273 #pragma acc loop gang(static:-1.0) /* { dg-error "" } */
274 for (i = 0; i < 10; i++)
275 ;
276
277 #pragma acc kernels
278 #pragma acc loop gang(static:1.0) /* { dg-error "" } */
279 for (i = 0; i < 10; i++)
280 ;
281
282 #pragma acc kernels
283 #pragma acc loop worker(-1.0) /* { dg-error "" } */
284 for (i = 0; i < 10; i++)
285 ;
286
287 #pragma acc kernels
288 #pragma acc loop worker(1.0) /* { dg-error "" } */
289 for (i = 0; i < 10; i++)
290 ;
291
292 #pragma acc kernels
293 #pragma acc loop worker(num:-1.0) /* { dg-error "" } */
294 for (i = 0; i < 10; i++)
295 ;
296
297 #pragma acc kernels
298 #pragma acc loop worker(num:1.0) /* { dg-error "" } */
299 for (i = 0; i < 10; i++)
300 ;
301
302 #pragma acc kernels
303 #pragma acc loop vector(-1.0) /* { dg-error "" } */
304 for (i = 0; i < 10; i++)
305 ;
306
307 #pragma acc kernels
308 #pragma acc loop vector(1.0) /* { dg-error "" } */
309 for (i = 0; i < 10; i++)
310 ;
311
312 #pragma acc kernels
313 #pragma acc loop vector(length:-1.0) /* { dg-error "" } */
314 for (i = 0; i < 10; i++)
315 ;
316
317 #pragma acc kernels
318 #pragma acc loop vector(length:1.0) /* { dg-error "" } */
319 for (i = 0; i < 10; i++)
320 ;
321
322 return 0;
323 }
324