1 // expected-no-diagnostics
6 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
7 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
8 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64
9 // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
10 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
11 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-32
13 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix SIMD-ONLY
14 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
15 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix SIMD-ONLY
16 // RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix SIMD-ONLY
17 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
18 // RUN: %clang_cc1 -DCK1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix SIMD-ONLY
19 // SIMD-ONLY-NOT: {{__kmpc|__tgt}}
22 template <typename T, int X, long long Y>
26 // CK1: define {{.*}}i32 @{{.+}}foo{{.+}}(
29 // CK1: call i32 @__tgt_target_teams(
30 // CK1: call void @[[OFFL1:.+]](
31 #pragma omp target teams distribute parallel for
32 for(int i = 0; i < X; i++) {
35 // CK1: call i32 @__tgt_target_teams(
36 // CK1: call void @[[OFFL2:.+]](
37 #pragma omp target teams distribute parallel for dist_schedule(static)
38 for(int i = 0; i < X; i++) {
41 // CK1: call i32 @__tgt_target_teams(
42 // CK1: call void @[[OFFL3:.+]](
43 #pragma omp target teams distribute parallel for dist_schedule(static, X/2)
44 for(int i = 0; i < X; i++) {
47 // CK1: define internal void @[[OFFL1]](
48 // CK1: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 1, {{.+}} @[[OUTL1:.+]] to {{.+}},
51 // CK1: define internal void @[[OUTL1]]({{.+}})
52 // CK1: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
53 // CK1: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL1:.+]] to
54 // CK1: call void @__kmpc_for_static_fini(
57 // CK1: define internal void @[[PAR_OUTL1]]({{.+}})
58 // CK1: call void @__kmpc_for_static_init_4(
59 // CK1: call void @__kmpc_for_static_fini(
62 // CK1: define internal void @[[OFFL2]](
63 // CK1: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 1, {{.+}} @[[OUTL2:.+]] to {{.+}},
66 // CK1: define internal void @[[OUTL2]]({{.+}})
67 // CK1: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
68 // CK1: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL2:.+]] to
69 // CK1: call void @__kmpc_for_static_fini(
72 // CK1: define internal void @[[PAR_OUTL2]]({{.+}})
73 // CK1: call void @__kmpc_for_static_init_4(
74 // CK1: call void @__kmpc_for_static_fini(
78 // CK1: define internal void @[[OFFL3]](
79 // CK1: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 1, {{.+}} @[[OUTL3:.+]] to {{.+}},
82 // CK1: define internal void @[[OUTL3]]({{.+}})
83 // CK1: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 91
84 // CK1: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL3:.+]] to
85 // CK1: call void @__kmpc_for_static_fini(
88 // CK1: define internal void @[[PAR_OUTL3]]({{.+}})
89 // CK1: call void @__kmpc_for_static_init_4(
90 // CK1: call void @__kmpc_for_static_fini(
97 int teams_template_struct(void) {
104 // Test host codegen.
105 // RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
106 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
107 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-64
108 // RUN: %clang_cc1 -DCK2 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
109 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
110 // RUN: %clang_cc1 -DCK2 -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK2 --check-prefix CK2-32
112 // RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix SIMD-ONLY
113 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
114 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix SIMD-ONLY
115 // RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix SIMD-ONLY
116 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
117 // RUN: %clang_cc1 -DCK2 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix SIMD-ONLY
118 // SIMD-ONLY-NOT: {{__kmpc|__tgt}}
121 template <typename T, int n>
125 #pragma omp target teams distribute parallel for
126 for(int i = 0; i < n; i++) {
129 #pragma omp target teams distribute parallel for dist_schedule(static)
130 for(int i = 0; i < n; i++) {
133 #pragma omp target teams distribute parallel for dist_schedule(static, m)
134 for(int i = 0; i < n; i++) {
140 int main (int argc, char **argv) {
144 #pragma omp target teams distribute parallel for
145 for(int i = 0; i < n; i++) {
148 #pragma omp target teams distribute parallel for dist_schedule(static)
149 for(int i = 0; i < n; i++) {
152 #pragma omp target teams distribute parallel for dist_schedule(static, m)
153 for(int i = 0; i < n; i++) {
156 return tmain<int, 10>(argc);
159 // CK2: define {{.*}}i32 @{{[^,]+}}(i{{.+}}{{.+}} %[[ARGC:.+]], {{.+}})
160 // CK2: call i32 @__tgt_target_teams(
161 // CK2: call void @[[OFFL1:.+]]({{.+}})
162 // CK2: call i32 @__tgt_target_teams(
163 // CK2: call void @[[OFFL2:.+]]({{.+}})
164 // CK2: call i32 @__tgt_target_teams(
165 // CK2: call void @[[OFFL3:.+]]({{.+}})
166 // CK2: {{%.+}} = call{{.*}} i32 @[[TMAIN:.+]]({{.+}})
169 // CK2: define {{.*}}void @[[OFFL1]]({{.+}})
170 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 3, {{.+}} @[[OUTL1:.+]] to {{.+}},
173 // CK2: define internal void @[[OUTL1]]({{.+}})
174 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
175 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL1:.+]] to
176 // CK2: call void @__kmpc_for_static_fini(
179 // CK2: define internal void @[[PAR_OUTL1]]({{.+}})
180 // CK2: call void @__kmpc_for_static_init_4(
181 // CK2: call void @__kmpc_for_static_fini(
184 // CK2: define {{.*}}void @[[OFFL2]]({{.+}})
185 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 3, {{.+}} @[[OUTL2:.+]] to {{.+}},
188 // CK2: define internal void @[[OUTL2]]({{.+}})
189 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
190 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL2:.+]] to
191 // CK2: call void @__kmpc_for_static_fini(
194 // CK2: define internal void @[[PAR_OUTL2]]({{.+}})
195 // CK2: call void @__kmpc_for_static_init_4(
196 // CK2: call void @__kmpc_for_static_fini(
199 // CK2: define {{.*}}void @[[OFFL3]]({{.+}})
200 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 4, {{.+}} @[[OUTL3:.+]] to {{.+}},
203 // CK2: define internal void @[[OUTL3]]({{.+}})
204 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 91
205 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTL3:.+]] to
206 // CK2: call void @__kmpc_for_static_fini(
209 // CK2: define internal void @[[PAR_OUTL3]]({{.+}})
210 // CK2: call void @__kmpc_for_static_init_4(
211 // CK2: call void @__kmpc_for_static_fini(
214 // CK2: define {{.*}}i32 @[[TMAIN]]({{.+}})
215 // CK2: call i32 @__tgt_target_teams(
216 // CK2: call void @[[OFFLT1:.+]]({{.+}})
217 // CK2: call i32 @__tgt_target_teams(
218 // CK2: call void @[[OFFLT2:.+]]({{.+}})
219 // CK2: call i32 @__tgt_target_teams(
220 // CK2: call void @[[OFFLT3:.+]]({{.+}})
224 // CK2: define {{.*}}void @[[OFFLT1]]({{.+}})
225 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 1, {{.+}} @[[OUTLT1:.+]] to {{.+}},
228 // CK2: define internal void @[[OUTLT1]]({{.+}})
229 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
230 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTLT1:.+]] to
231 // CK2: call void @__kmpc_for_static_fini(
234 // CK2: define internal void @[[PAR_OUTLT1]]({{.+}})
235 // CK2: call void @__kmpc_for_static_init_4(
236 // CK2: call void @__kmpc_for_static_fini(
239 // CK2: define {{.*}}void @[[OFFLT2]]({{.+}})
240 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 1, {{.+}} @[[OUTLT2:.+]] to {{.+}},
243 // CK2: define internal void @[[OUTLT2]]({{.+}})
244 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 92
245 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTLT2:.+]] to
246 // CK2: call void @__kmpc_for_static_fini(
249 // CK2: define internal void @[[PAR_OUTLT2]]({{.+}})
250 // CK2: call void @__kmpc_for_static_init_4(
251 // CK2: call void @__kmpc_for_static_fini(
254 // CK2: define {{.*}}void @[[OFFLT3]]({{.+}})
255 // CK2: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 {{.+}}, {{.+}} @[[OUTLT3:.+]] to {{.+}},
258 // CK2: define internal void @[[OUTLT3]]({{.+}})
259 // CK2: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, i32 91
260 // CK2: call void {{.*}} @__kmpc_fork_call({{.+}}, {{.+}}, {{.+}} @[[PAR_OUTLT3:.+]] to
261 // CK2: call void @__kmpc_for_static_fini(
264 // CK2: define internal void @[[PAR_OUTLT3]]({{.+}})
265 // CK2: call void @__kmpc_for_static_init_4(
266 // CK2: call void @__kmpc_for_static_fini(
270 #endif // #ifndef HEADER