1 // RUN: %clang_cc1 -fopenacc -Wno-openacc-deprecated-clause-alias -ast-print %s -o - | FileCheck %s
5 constexpr int get_value() { return 1; }
7 // CHECK: #pragma acc loop
8 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
11 for(int i
= 0;i
<5;++i
);
13 // CHECK: #pragma acc loop device_type(SomeStruct)
14 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
16 #pragma acc loop device_type(SomeStruct)
17 for(int i
= 0;i
<5;++i
);
19 // CHECK: #pragma acc loop device_type(int)
20 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
22 #pragma acc loop device_type(int)
23 for(int i
= 0;i
<5;++i
);
25 // CHECK: #pragma acc loop dtype(bool)
26 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
28 #pragma acc loop dtype(bool)
29 for(int i
= 0;i
<5;++i
);
31 // CHECK: #pragma acc loop dtype(AnotherIdent)
32 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
34 #pragma acc loop dtype(AnotherIdent)
35 for(int i
= 0;i
<5;++i
);
37 // CHECK: #pragma acc loop independent
38 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
40 #pragma acc loop independent
41 for(int i
= 0;i
<5;++i
);
42 // CHECK: #pragma acc loop seq
43 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
46 for(int i
= 0;i
<5;++i
);
47 // CHECK: #pragma acc loop auto
48 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
51 for(int i
= 0;i
<5;++i
);
56 // CHECK: #pragma acc loop private(i, array[1], array, array[1:2])
57 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
59 #pragma acc loop private(i, array[1], array, array[1:2])
60 for(int i
= 0;i
<5;++i
);
62 // CHECK: #pragma acc loop collapse(1)
63 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
65 #pragma acc loop collapse(1)
66 for(int i
= 0;i
<5;++i
);
67 // CHECK: #pragma acc loop collapse(force:1)
68 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
70 #pragma acc loop collapse(force:1)
71 for(int i
= 0;i
<5;++i
);
72 // CHECK: #pragma acc loop collapse(2)
73 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
74 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
76 #pragma acc loop collapse(2)
77 for(int i
= 0;i
<5;++i
)
78 for(int i
= 0;i
<5;++i
);
79 // CHECK: #pragma acc loop collapse(force:2)
80 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
81 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
83 #pragma acc loop collapse(force:2)
84 for(int i
= 0;i
<5;++i
)
85 for(int i
= 0;i
<5;++i
);
87 // CHECK: #pragma acc loop tile(1, 3, *, get_value())
88 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
89 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
90 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
91 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
93 #pragma acc loop tile(1, 3, *, get_value())
94 for(int i
= 0;i
<5;++i
)
95 for(int i
= 0;i
<5;++i
)
96 for(int i
= 0;i
<5;++i
)
97 for(int i
= 0;i
<5;++i
);
99 // CHECK: #pragma acc loop gang(dim: 2)
100 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
102 #pragma acc loop gang(dim:2)
103 for(int i
= 0;i
<5;++i
);
105 // CHECK: #pragma acc loop gang(static: i)
106 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
108 #pragma acc loop gang(static:i)
109 for(int i
= 0;i
<5;++i
);
111 // CHECK: #pragma acc loop gang(static: i) gang(dim: 2)
112 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
114 #pragma acc loop gang(static:i) gang(dim:2)
115 for(int i
= 0;i
<5;++i
);
117 // CHECK: #pragma acc parallel
118 // CHECK-NEXT: #pragma acc loop gang(dim: 2)
119 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
122 #pragma acc loop gang(dim:2)
123 for(int i
= 0;i
<5;++i
);
125 // CHECK: #pragma acc parallel
126 // CHECK-NEXT: #pragma acc loop gang(static: i)
127 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
130 #pragma acc loop gang(static:i)
131 for(int i
= 0;i
<5;++i
);
133 // CHECK: #pragma acc parallel
134 // CHECK-NEXT: #pragma acc loop gang(static: i) gang(dim: 2)
135 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
138 #pragma acc loop gang(static:i) gang(dim:2)
139 for(int i
= 0;i
<5;++i
);
141 // CHECK: #pragma acc kernels
142 // CHECK-NEXT: #pragma acc loop gang(num: i) gang(static: i)
143 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
146 #pragma acc loop gang(i) gang(static:i)
147 for(int i
= 0;i
<5;++i
);
149 // CHECK: #pragma acc kernels
150 // CHECK-NEXT: #pragma acc loop gang(num: i) gang(static: i)
151 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
154 #pragma acc loop gang(num:i) gang(static:i)
155 for(int i
= 0;i
<5;++i
);
157 // CHECK: #pragma acc serial
158 // CHECK-NEXT: #pragma acc loop gang(static: i)
159 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
162 #pragma acc loop gang(static:i)
163 for(int i
= 0;i
<5;++i
);
165 // CHECK: #pragma acc serial
166 // CHECK-NEXT: #pragma acc loop gang(static: *)
167 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
170 #pragma acc loop gang(static:*)
171 for(int i
= 0;i
<5;++i
);
173 // CHECK: #pragma acc serial
174 // CHECK-NEXT: #pragma acc loop
175 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
178 #pragma acc loop gang
179 for(int i
= 0;i
<5;++i
);
181 // CHECK: #pragma acc loop worker
182 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
185 #pragma acc loop worker
186 for(int i
= 0;i
<5;++i
);
188 // CHECK: #pragma acc parallel
189 // CHECK-NEXT: #pragma acc loop worker
190 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
193 #pragma acc loop worker
194 for(int i
= 0;i
<5;++i
);
196 // CHECK: #pragma acc serial
197 // CHECK-NEXT: #pragma acc loop worker
198 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
201 #pragma acc loop worker
202 for(int i
= 0;i
<5;++i
);
204 // CHECK: #pragma acc kernels
205 // CHECK-NEXT: #pragma acc loop worker(num: 5)
206 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
209 #pragma acc loop worker(5)
210 for(int i
= 0;i
<5;++i
);
212 // CHECK: #pragma acc kernels
213 // CHECK-NEXT: #pragma acc loop worker(num: 5)
214 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
217 #pragma acc loop worker(num:5)
218 for(int i
= 0;i
<5;++i
);
220 // CHECK: #pragma acc loop vector
221 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
223 #pragma acc loop vector
224 for(int i
= 0;i
<5;++i
);
226 // CHECK: #pragma acc loop vector(length: 5)
227 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
229 #pragma acc loop vector(5)
230 for(int i
= 0;i
<5;++i
);
232 // CHECK: #pragma acc loop vector(length: 5)
233 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
235 #pragma acc loop vector(length:5)
236 for(int i
= 0;i
<5;++i
);
238 // CHECK: #pragma acc parallel
239 // CHECK-NEXT: #pragma acc loop vector
240 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
243 #pragma acc loop vector
244 for(int i
= 0;i
<5;++i
);
246 // CHECK: #pragma acc parallel
247 // CHECK-NEXT: #pragma acc loop vector(length: 5)
248 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
251 #pragma acc loop vector(5)
252 for(int i
= 0;i
<5;++i
);
254 // CHECK: #pragma acc parallel
255 // CHECK-NEXT: #pragma acc loop vector(length: 5)
256 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
259 #pragma acc loop vector(length:5)
260 for(int i
= 0;i
<5;++i
);
262 // CHECK: #pragma acc kernels
263 // CHECK-NEXT: #pragma acc loop vector
264 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
267 #pragma acc loop vector
268 for(int i
= 0;i
<5;++i
);
270 // CHECK: #pragma acc kernels
271 // CHECK-NEXT: #pragma acc loop vector(length: 5)
272 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
275 #pragma acc loop vector(5)
276 for(int i
= 0;i
<5;++i
);
278 // CHECK: #pragma acc kernels
279 // CHECK-NEXT: #pragma acc loop vector(length: 5)
280 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
283 #pragma acc loop vector(length:5)
284 for(int i
= 0;i
<5;++i
);
286 // CHECK: #pragma acc serial
287 // CHECK-NEXT: #pragma acc loop vector
288 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
291 #pragma acc loop vector
292 for(int i
= 0;i
<5;++i
);
297 //CHECK: #pragma acc loop reduction(+: iPtr)
298 #pragma acc loop reduction(+: iPtr)
299 for(int i
= 0;i
<5;++i
);
300 //CHECK: #pragma acc loop reduction(*: i)
301 #pragma acc loop reduction(*: i)
302 for(int i
= 0;i
<5;++i
);
303 //CHECK: #pragma acc loop reduction(max: SomeB)
304 #pragma acc loop reduction(max: SomeB)
305 for(int i
= 0;i
<5;++i
);
306 //CHECK: #pragma acc loop reduction(min: iPtr)
307 #pragma acc loop reduction(min: iPtr)
308 for(int i
= 0;i
<5;++i
);
309 //CHECK: #pragma acc loop reduction(&: i)
310 #pragma acc loop reduction(&: i)
311 for(int i
= 0;i
<5;++i
);
312 //CHECK: #pragma acc loop reduction(|: SomeB)
313 #pragma acc loop reduction(|: SomeB)
314 for(int i
= 0;i
<5;++i
);
315 //CHECK: #pragma acc loop reduction(^: iPtr)
316 #pragma acc loop reduction(^: iPtr)
317 for(int i
= 0;i
<5;++i
);
318 //CHECK: #pragma acc loop reduction(&&: i)
319 #pragma acc loop reduction(&&: i)
320 for(int i
= 0;i
<5;++i
);
321 //CHECK: #pragma acc loop reduction(||: SomeB)
322 #pragma acc loop reduction(||: SomeB)
323 for(int i
= 0;i
<5;++i
);