[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / combined-construct-gang-ast.cpp
blob167f56289c58ddb24c0be5c1d7528ea9003af179
1 // RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s
3 // Test this with PCH.
4 // RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s
5 // RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s
6 #ifndef PCH_HELPER
7 #define PCH_HELPER
8 void NormalUses() {
9 // CHECK: FunctionDecl{{.*}}NormalUses
10 // CHECK-NEXT: CompoundStmt
12 int Val;
14 #pragma acc parallel loop gang(dim:1)
15 for(int i = 0; i < 5; ++i);
16 // CHECK: OpenACCCombinedConstruct{{.*}} parallel loop
17 // CHECK-NEXT: gang clause dim
18 // CHECK-NEXT: ConstantExpr
19 // CHECK-NEXT: value: Int 1
20 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
21 // CHECK-NEXT: ForStmt
22 // CHECK: NullStmt
24 #pragma acc parallel loop gang(static:Val)
25 for(int i = 0; i < 5; ++i);
26 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
27 // CHECK-NEXT: gang clause static
28 // CHECK-NEXT: ImplicitCastExpr
29 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
30 // CHECK-NEXT: ForStmt
31 // CHECK: NullStmt
33 #pragma acc kernels loop gang(num:1) gang(static:Val)
34 for(int i = 0; i < 5; ++i);
35 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop
36 // CHECK-NEXT: gang clause num
37 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
38 // CHECK-NEXT: gang clause static
39 // CHECK-NEXT: ImplicitCastExpr
40 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
41 // CHECK-NEXT: ForStmt
42 // CHECK: NullStmt
44 #pragma acc parallel loop gang(dim:1, static:Val)
45 for(int i = 0; i < 5; ++i);
46 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
47 // CHECK-NEXT: gang clause dim static
48 // CHECK-NEXT: ConstantExpr
49 // CHECK-NEXT: value: Int 1
50 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
51 // CHECK-NEXT: ImplicitCastExpr
52 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
53 // CHECK-NEXT: ForStmt
54 // CHECK: NullStmt
56 #pragma acc serial loop gang(static:Val)
57 for(int i = 0; i < 5; ++i);
58 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop
59 // CHECK-NEXT: gang clause static
60 // CHECK-NEXT: ImplicitCastExpr
61 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
62 // CHECK-NEXT: ForStmt
63 // CHECK: NullStmt
65 #pragma acc serial loop gang(static:*)
66 for(int i = 0; i < 5; ++i);
67 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop
68 // CHECK-NEXT: gang clause static
69 // CHECK-NEXT: OpenACCAsteriskSizeExpr
70 // CHECK-NEXT: ForStmt
71 // CHECK: NullStmt
73 #pragma acc serial loop gang
74 for(int i = 0; i < 5; ++i);
75 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop
76 // CHECK-NEXT: gang clause
77 // CHECK-NEXT: ForStmt
78 // CHECK: NullStmt
80 #pragma acc kernels loop gang(num:1)
81 for(int i = 0; i < 5; ++i);
82 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop
83 // CHECK-NEXT: gang clause num
84 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 1
85 // CHECK-NEXT: ForStmt
86 // CHECK: NullStmt
89 template<typename T, unsigned One>
90 void TemplateUses(T Val) {
91 // CHECK: FunctionTemplateDecl{{.*}}TemplateUses
92 // CHECK-NEXT: TemplateTypeParmDecl {{.*}} referenced typename depth 0 index 0 T
93 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'unsigned int' depth 0 index 1 One
94 // CHECK-NEXT: FunctionDecl{{.*}} TemplateUses 'void (T)'
95 // CHECK-NEXT: ParmVarDecl{{.*}} referenced Val 'T'
96 // CHECK-NEXT: CompoundStmt
98 #pragma acc parallel loop gang(dim:One)
99 for(int i = 0; i < 5; ++i);
100 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
101 // CHECK-NEXT: gang clause dim
102 // CHECK-NEXT: DeclRefExpr{{.*}}'One' 'unsigned int'
103 // CHECK-NEXT: ForStmt
104 // CHECK: NullStmt
106 #pragma acc parallel loop gang(static:Val)
107 for(int i = 0; i < 5; ++i);
108 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
109 // CHECK-NEXT: gang clause static
110 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'T'
111 // CHECK-NEXT: ForStmt
112 // CHECK: NullStmt
115 #pragma acc parallel loop gang(static:*)
116 for(int i = 0; i < 5; ++i);
117 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
118 // CHECK-NEXT: gang clause static
119 // CHECK-NEXT: OpenACCAsteriskSizeExpr
120 // CHECK-NEXT: ForStmt
121 // CHECK: NullStmt
123 #pragma acc parallel loop gang(dim:One) gang(static:Val)
124 for(int i = 0; i < 5; ++i);
125 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
126 // CHECK-NEXT: gang clause dim
127 // CHECK-NEXT: DeclRefExpr{{.*}}'One' 'unsigned int'
128 // CHECK-NEXT: gang clause static
129 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'T'
130 // CHECK-NEXT: ForStmt
131 // CHECK: NullStmt
133 #pragma acc parallel loop gang(dim:One, static:Val)
134 for(int i = 0; i < 5; ++i);
135 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
136 // CHECK-NEXT: gang clause dim static
137 // CHECK-NEXT: DeclRefExpr{{.*}}'One' 'unsigned int'
138 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'T'
139 // CHECK-NEXT: ForStmt
140 // CHECK: NullStmt
142 #pragma acc serial loop gang
143 for(int i = 0; i < 5; ++i);
144 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop
145 // CHECK-NEXT: gang clause
146 // CHECK-NEXT: ForStmt
147 // CHECK: NullStmt
149 // Instantiation:
150 // CHECK-NEXT: FunctionDecl{{.*}} used TemplateUses 'void (int)' implicit_instantiation
151 // CHECK-NEXT: TemplateArgument type 'int'
152 // CHECK-NEXT: BuiltinType{{.*}} 'int'
153 // CHECK-NEXT: TemplateArgument integral '1U'
154 // CHECK-NEXT: ParmVarDecl{{.*}} used Val 'int'
155 // CHECK-NEXT: CompoundStmt
157 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
158 // CHECK-NEXT: gang clause dim
159 // CHECK-NEXT: ConstantExpr
160 // CHECK-NEXT: value: Int 1
161 // CHECK-NEXT: SubstNonTypeTemplateParmExpr
162 // CHECK-NEXT: NonTypeTemplateParmDecl
163 // CHECK-NEXT: IntegerLiteral{{.*}}'unsigned int' 1
164 // CHECK-NEXT: ForStmt
165 // CHECK: NullStmt
167 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
168 // CHECK-NEXT: gang clause static
169 // CHECK-NEXT: ImplicitCastExpr
170 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
171 // CHECK-NEXT: ForStmt
172 // CHECK: NullStmt
174 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
175 // CHECK-NEXT: gang clause static
176 // CHECK-NEXT: OpenACCAsteriskSizeExpr
177 // CHECK-NEXT: ForStmt
178 // CHECK: NullStmt
180 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
181 // CHECK-NEXT: gang clause dim
182 // CHECK-NEXT: ConstantExpr
183 // CHECK-NEXT: value: Int 1
184 // CHECK-NEXT: SubstNonTypeTemplateParmExpr
185 // CHECK-NEXT: NonTypeTemplateParmDecl
186 // CHECK-NEXT: IntegerLiteral{{.*}}'unsigned int' 1
187 // CHECK-NEXT: gang clause static
188 // CHECK-NEXT: ImplicitCastExpr
189 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
190 // CHECK-NEXT: ForStmt
191 // CHECK: NullStmt
193 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
194 // CHECK-NEXT: gang clause dim static
195 // CHECK-NEXT: ConstantExpr
196 // CHECK-NEXT: value: Int 1
197 // CHECK-NEXT: SubstNonTypeTemplateParmExpr
198 // CHECK-NEXT: NonTypeTemplateParmDecl
199 // CHECK-NEXT: IntegerLiteral{{.*}}'unsigned int' 1
200 // CHECK-NEXT: ImplicitCastExpr
201 // CHECK-NEXT: DeclRefExpr{{.*}}'Val' 'int'
202 // CHECK-NEXT: ForStmt
203 // CHECK: NullStmt
205 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} serial loop
206 // CHECK-NEXT: gang clause
207 // CHECK-NEXT: ForStmt
208 // CHECK: NullStmt
211 void inst() {
212 TemplateUses<int, 1>(5);
215 #endif // PCH_HELPER