[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / AST / ast-print-openacc-compute-construct.cpp
blobfe580c86ac8ea862115396e49daf4356c20ddc62
1 // RUN: %clang_cc1 -fopenacc -Wno-openacc-deprecated-clause-alias -ast-print %s -o - | FileCheck %s
3 void foo() {
4 int i;
5 int *iPtr;
6 float array[5];
7 float *arrayPtr[5];
8 // CHECK: #pragma acc parallel default(none)
9 // CHECK-NEXT: while (true)
10 #pragma acc parallel default(none)
11 while(true);
12 // CHECK: #pragma acc serial default(present)
13 // CHECK-NEXT: while (true)
14 #pragma acc serial default(present)
15 while(true);
16 // CHECK: #pragma acc kernels if(i == array[1])
17 // CHECK-NEXT: while (true)
18 #pragma acc kernels if(i == array[1])
19 while(true);
20 // CHECK: #pragma acc parallel self(i == 3)
21 // CHECK-NEXT: while (true)
22 #pragma acc parallel self(i == 3)
23 while(true);
25 // CHECK: #pragma acc parallel num_gangs(i, (int)array[2])
26 // CHECK-NEXT: while (true)
27 #pragma acc parallel num_gangs(i, (int)array[2])
28 while(true);
30 // CHECK: #pragma acc parallel num_workers(i)
31 // CHECK-NEXT: while (true)
32 #pragma acc parallel num_workers(i)
33 while(true);
35 // CHECK: #pragma acc parallel vector_length((int)array[1])
36 // CHECK-NEXT: while (true)
37 #pragma acc parallel vector_length((int)array[1])
38 while(true);
40 // CHECK: #pragma acc parallel private(i, array[1], array, array[1:2])
41 #pragma acc parallel private(i, array[1], array, array[1:2])
42 while(true);
44 // CHECK: #pragma acc parallel firstprivate(i, array[1], array, array[1:2])
45 #pragma acc parallel firstprivate(i, array[1], array, array[1:2])
46 while(true);
48 // CHECK: #pragma acc parallel no_create(i, array[1], array, array[1:2])
49 #pragma acc parallel no_create(i, array[1], array, array[1:2])
50 while(true);
52 // CHECK: #pragma acc parallel present(i, array[1], array, array[1:2])
53 #pragma acc parallel present(i, array[1], array, array[1:2])
54 while(true);
55 // CHECK: #pragma acc parallel no_create(i, array[1], array, array[1:2]) present(i, array[1], array, array[1:2])
56 #pragma acc parallel no_create(i, array[1], array, array[1:2]) present(i, array[1], array, array[1:2])
57 while(true);
59 // CHECK: #pragma acc parallel copyin(i, array[1], array, array[1:2]) pcopyin(readonly: i, array[1], array, array[1:2]) present_or_copyin(i, array[1], array, array[1:2])
60 #pragma acc parallel copyin(i, array[1], array, array[1:2]) pcopyin(readonly:i, array[1], array, array[1:2]) present_or_copyin(i, array[1], array, array[1:2])
61 while(true);
63 // CHECK: #pragma acc parallel copyout(i, array[1], array, array[1:2]) pcopyout(zero: i, array[1], array, array[1:2]) present_or_copyout(i, array[1], array, array[1:2])
64 #pragma acc parallel copyout(i, array[1], array, array[1:2]) pcopyout(zero: i, array[1], array, array[1:2]) present_or_copyout(i, array[1], array, array[1:2])
65 while(true);
67 // CHECK: #pragma acc parallel create(i, array[1], array, array[1:2]) pcreate(zero: i, array[1], array, array[1:2]) present_or_create(i, array[1], array, array[1:2])
68 #pragma acc parallel create(i, array[1], array, array[1:2]) pcreate(zero: i, array[1], array, array[1:2]) present_or_create(i, array[1], array, array[1:2])
69 while(true);
71 // CHECK: #pragma acc serial attach(iPtr, arrayPtr[0])
72 #pragma acc serial attach(iPtr, arrayPtr[0])
73 while(true);
75 // CHECK: #pragma acc kernels deviceptr(iPtr, arrayPtr[0])
76 #pragma acc kernels deviceptr(iPtr, arrayPtr[0])
77 while(true);
79 // CHECK: #pragma acc kernels async(*iPtr)
80 #pragma acc kernels async(*iPtr)
81 while(true);
83 // CHECK: #pragma acc kernels async
84 #pragma acc kernels async
85 while(true);
87 // CHECK: #pragma acc parallel wait
88 #pragma acc parallel wait
89 while(true);
91 // CHECK: #pragma acc parallel wait()
92 #pragma acc parallel wait()
93 while(true);
95 // CHECK: #pragma acc parallel wait(*iPtr, i)
96 #pragma acc parallel wait(*iPtr, i)
97 while(true);
99 // CHECK: #pragma acc parallel wait(queues: *iPtr, i)
100 #pragma acc parallel wait(queues:*iPtr, i)
101 while(true);
103 // CHECK: #pragma acc parallel wait(devnum: i : *iPtr, i)
104 #pragma acc parallel wait(devnum:i:*iPtr, i)
105 while(true);
107 // CHECK: #pragma acc parallel wait(devnum: i : queues: *iPtr, i)
108 #pragma acc parallel wait(devnum:i:queues:*iPtr, i)
109 while(true);
111 bool SomeB;
112 struct SomeStruct{} SomeStructImpl;
114 //CHECK: #pragma acc parallel dtype(SomeB)
115 #pragma acc parallel dtype(SomeB)
116 while(true);
118 //CHECK: #pragma acc parallel device_type(SomeStruct)
119 #pragma acc parallel device_type(SomeStruct)
120 while(true);
122 //CHECK: #pragma acc parallel device_type(int)
123 #pragma acc parallel device_type(int)
124 while(true);
126 //CHECK: #pragma acc parallel dtype(bool)
127 #pragma acc parallel dtype(bool)
128 while(true);
130 //CHECK: #pragma acc parallel device_type(SomeStructImpl)
131 #pragma acc parallel device_type (SomeStructImpl)
132 while(true);
134 //CHECK: #pragma acc parallel reduction(+: iPtr)
135 #pragma acc parallel reduction(+: iPtr)
136 while(true);
137 //CHECK: #pragma acc parallel reduction(*: i)
138 #pragma acc parallel reduction(*: i)
139 while(true);
140 //CHECK: #pragma acc parallel reduction(max: SomeB)
141 #pragma acc parallel reduction(max: SomeB)
142 while(true);
143 //CHECK: #pragma acc parallel reduction(min: iPtr)
144 #pragma acc parallel reduction(min: iPtr)
145 while(true);
146 //CHECK: #pragma acc parallel reduction(&: i)
147 #pragma acc parallel reduction(&: i)
148 while(true);
149 //CHECK: #pragma acc parallel reduction(|: SomeB)
150 #pragma acc parallel reduction(|: SomeB)
151 while(true);
152 //CHECK: #pragma acc parallel reduction(^: iPtr)
153 #pragma acc parallel reduction(^: iPtr)
154 while(true);
155 //CHECK: #pragma acc parallel reduction(&&: i)
156 #pragma acc parallel reduction(&&: i)
157 while(true);
158 //CHECK: #pragma acc parallel reduction(||: SomeB)
159 #pragma acc parallel reduction(||: SomeB)
160 while(true);