[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / AST / ast-print-openacc-loop-construct.cpp
blob9ddd5c81ca53e6a99cc5f596154aed6b8b3db2b2
1 // RUN: %clang_cc1 -fopenacc -Wno-openacc-deprecated-clause-alias -ast-print %s -o - | FileCheck %s
3 struct SomeStruct{};
5 constexpr int get_value() { return 1; }
6 void foo() {
7 // CHECK: #pragma acc loop
8 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
9 // CHECK-NEXT: ;
10 #pragma acc loop
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)
15 // CHECK-NEXT: ;
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)
21 // CHECK-NEXT: ;
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)
27 // CHECK-NEXT: ;
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)
33 // CHECK-NEXT: ;
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)
39 // CHECK-NEXT: ;
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)
44 // CHECK-NEXT: ;
45 #pragma acc loop seq
46 for(int i = 0;i<5;++i);
47 // CHECK: #pragma acc loop auto
48 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
49 // CHECK-NEXT: ;
50 #pragma acc loop auto
51 for(int i = 0;i<5;++i);
53 int i;
54 float array[5];
56 // CHECK: #pragma acc loop private(i, array[1], array, array[1:2])
57 // CHECK-NEXT: for (int i = 0; i < 5; ++i)
58 // CHECK-NEXT: ;
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)
64 // CHECK-NEXT: ;
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)
69 // CHECK-NEXT: ;
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)
75 // CHECK-NEXT: ;
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)
82 // CHECK-NEXT: ;
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)
92 // CHECK-NEXT: ;
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)
101 // CHECK-NEXT: ;
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)
107 // CHECK-NEXT: ;
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)
113 // CHECK-NEXT: ;
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)
120 // CHECK-NEXT: ;
121 #pragma acc parallel
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)
128 // CHECK-NEXT: ;
129 #pragma acc parallel
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)
136 // CHECK-NEXT: ;
137 #pragma acc parallel
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)
144 // CHECK-NEXT: ;
145 #pragma acc kernels
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)
152 // CHECK-NEXT: ;
153 #pragma acc kernels
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)
160 // CHECK-NEXT: ;
161 #pragma acc serial
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)
168 // CHECK-NEXT: ;
169 #pragma acc serial
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)
176 // CHECK-NEXT: ;
177 #pragma acc serial
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)
183 // CHECK-NEXT: ;
184 #pragma acc parallel
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)
191 // CHECK-NEXT: ;
192 #pragma acc parallel
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)
199 // CHECK-NEXT: ;
200 #pragma acc serial
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)
207 // CHECK-NEXT: ;
208 #pragma acc kernels
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)
215 // CHECK-NEXT: ;
216 #pragma acc kernels
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)
222 // CHECK-NEXT: ;
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)
228 // CHECK-NEXT: ;
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)
234 // CHECK-NEXT: ;
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)
241 // CHECK-NEXT: ;
242 #pragma acc parallel
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)
249 // CHECK-NEXT: ;
250 #pragma acc parallel
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)
257 // CHECK-NEXT: ;
258 #pragma acc parallel
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)
265 // CHECK-NEXT: ;
266 #pragma acc kernels
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)
273 // CHECK-NEXT: ;
274 #pragma acc kernels
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)
281 // CHECK-NEXT: ;
282 #pragma acc kernels
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)
289 // CHECK-NEXT: ;
290 #pragma acc serial
291 #pragma acc loop vector
292 for(int i = 0;i<5;++i);
294 int *iPtr;
295 bool SomeB;
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);