• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -DCHECK -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix CHECK --check-prefix CHECK-64
2 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
3 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix CHECK --check-prefix CHECK-64
4 // RUN: %clang_cc1 -DCHECK -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix CHECK --check-prefix CHECK-32
5 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
6 // RUN: %clang_cc1 -DCHECK -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix CHECK --check-prefix CHECK-32
7 
8 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY0 %s
9 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
10 // RUN: %clang_cc1 -DCHECK -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 - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY0 %s
11 // RUN: %clang_cc1 -DCHECK -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY0 %s
12 // RUN: %clang_cc1 -DCHECK -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
13 // RUN: %clang_cc1 -DCHECK -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 - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY0 %s
14 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
15 
16 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix LAMBDA --check-prefix LAMBDA-64
17 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
18 // RUN: %clang_cc1 -DLAMBDA -fopenmp -x c++  -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  %s --check-prefix LAMBDA --check-prefix LAMBDA-64
19 
20 // RUN: %clang_cc1 -DLAMBDA -verify -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY1 %s
21 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s -Wno-openmp-mapping
22 // RUN: %clang_cc1 -DLAMBDA -fopenmp-simd -x c++  -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - -Wno-openmp-mapping | FileCheck -allow-deprecated-dag-overlap  --check-prefix SIMD-ONLY1 %s
23 // SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
24 
25 // expected-no-diagnostics
26 #ifndef HEADER
27 #define HEADER
28 
29 struct St {
30   int a, b;
StSt31   St() : a(0), b(0) {}
StSt32   St(const St &st) : a(st.a + st.b), b(0) {}
~StSt33   ~St() {}
34 };
35 
36 volatile int g = 1212;
37 volatile int &g1 = g;
38 
39 template <class T>
40 struct S {
41   T f;
SS42   S(T a) : f(a + g) {}
SS43   S() : f(g) {}
SS44   S(const S &s, St t = St()) : f(s.f + t.a) {}
operator TS45   operator T() { return T(); }
~SS46   ~S() {}
47 };
48 
49 // CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
50 // CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
51 // CHECK-DAG: [[ST_TY:%.+]] = type { i{{[0-9]+}}, i{{[0-9]+}} }
52 
53 template <typename T>
tmain()54 T tmain() {
55   S<T> test;
56   T t_var = T();
57   T vec[] = {1, 2};
58   S<T> s_arr[] = {1, 2};
59   S<T> &var = test;
60 #pragma omp target
61 #pragma omp teams distribute firstprivate(t_var, vec, s_arr, var)
62   for (int i = 0; i < 2; ++i) {
63     vec[i] = t_var;
64     s_arr[i] = var;
65   }
66   return T();
67 }
68 
69 // CHECK-DAG: [[TEST:@.+]] = global [[S_FLOAT_TY]] zeroinitializer,
70 S<float> test;
71 // CHECK-DAG: [[T_VAR:@.+]] = global i{{[0-9]+}} 333,
72 int t_var = 333;
73 // CHECK-DAG: [[VEC:@.+]] = global [2 x i{{[0-9]+}}] [i{{[0-9]+}} 1, i{{[0-9]+}} 2],
74 int vec[] = {1, 2};
75 // CHECK-DAG: [[S_ARR:@.+]] = global [2 x [[S_FLOAT_TY]]] zeroinitializer,
76 S<float> s_arr[] = {1, 2};
77 // CHECK-DAG: [[VAR:@.+]] = global [[S_FLOAT_TY]] zeroinitializer,
78 S<float> var(3);
79 // CHECK-DAG: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
80 
main()81 int main() {
82   static int sivar;
83 #ifdef LAMBDA
84   // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212,
85   // LAMBDA-LABEL: @main
86   // LAMBDA: call void [[OUTER_LAMBDA:@.+]](
87   [&]() {
88     // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]](
89     // LAMBDA: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 0, i32 0)
90     // LAMBDA: call void @[[LOFFL1:.+]](i{{64|32}} %{{.+}})
91     // LAMBDA:  ret
92 #pragma omp target
93 #pragma omp teams distribute firstprivate(g, g1, sivar)
94   for (int i = 0; i < 2; ++i) {
95     // LAMBDA: define{{.*}} internal{{.*}} void @[[LOFFL1]](i{{64|32}} {{%.+}}, i{{64|32}} {{%.+}})
96     // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
97     // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
98     // LAMBDA: {{%.+}} = alloca i{{[0-9]+}},
99     // LAMBDA: [[G_CAST:%.+]] = alloca i{{[0-9]+}},
100     // LAMBDA: [[G1_CAST:%.+]] = alloca i{{[0-9]+}},
101     // LAMBDA: [[SIVAR_CAST:%.+]] = alloca i{{[0-9]+}},
102     // LAMBDA-DAG: [[G_CAST_VAL:%.+]] = load{{.+}} [[G_CAST]],
103     // LAMBDA-DAG: [[G1_CAST_VAL:%.+]] = load{{.+}} [[G1_CAST]],
104     // LAMBDA-DAG: [[SIVAR_CAST_VAL:%.+]] = load{{.+}} [[SIVAR_CAST]],
105     // LAMBDA: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 3, {{.+}} @[[LOUTL1:.+]] to {{.+}}, {{.+}} [[G_CAST_VAL]], {{.+}} [[G1_CAST_VAL]], {{.+}} [[SIVAR_CAST_VAL]])
106     // LAMBDA: ret void
107 
108     // LAMBDA: define internal void @[[LOUTL1]]({{.+}})
109     // Skip global and bound tid vars
110     // LAMBDA: {{.+}} = alloca i32*,
111     // LAMBDA: {{.+}} = alloca i32*,
112     // LAMBDA: [[G_ADDR:%.+]] = alloca i{{[0-9]+}},
113     // LAMBDA: [[G1_ADDR:%.+]] = alloca i{{[0-9]+}},
114     // LAMBDA: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
115     // LAMBDA: [[G1_TMP:%.+]] = alloca i32*,
116     // skip loop vars
117     // LAMBDA-DAG: store {{.+}}, {{.+}} [[G_ADDR]],
118     // LAMBDA-DAG: store {{.+}}, {{.+}} [[G1_ADDR]],
119     // LAMBDA-DAG: store {{.+}}, {{.+}} [[SIVAR_ADDR]],
120     // LAMBDA-DAG: [[G_CONV:%.+]] = bitcast {{.+}} [[G_ADDR]] to
121     // LAMBDA-DAG: [[G1_CONV:%.+]] = bitcast {{.+}} [[G1_ADDR]] to
122     // LAMBDA-DAG: [[SIVAR_CONV:%.+]] = bitcast {{.+}} [[SIVAR_ADDR]] to
123     // LAMBDA-DAG: store{{.+}} [[G1_CONV]], {{.+}} [[G1_TMP]],
124     g = 1;
125     g1 = 1;
126     sivar = 2;
127     // LAMBDA: call void @__kmpc_for_static_init_4(
128     // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G_CONV]],
129     // LAMBDA-DAG: [[G1:%.+]] = load{{.+}}, {{.+}}* [[G1_TMP]]
130     // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1]],
131     // LAMBDA-DAG: store{{.+}} 2, {{.+}} [[SIVAR_CONV]],
132     // LAMBDA-DAG: [[G1_REF:%.+]] = load{{.+}}, {{.+}} [[G1_TMP]],
133     // LAMBDA-DAG: store{{.+}} 1, {{.+}} [[G1_REF]],
134     // LAMBDA: call void [[INNER_LAMBDA:@.+]](
135     // LAMBDA: call void @__kmpc_for_static_fini(
136     [&]() {
137       // LAMBDA: define {{.+}} void [[INNER_LAMBDA]]({{.+}} [[ARG_PTR:%.+]])
138       // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]],
139       g = 2;
140       g1 = 2;
141       sivar = 4;
142       // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]]
143 
144       // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
145       // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]]
146       // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]]
147       // LAMBDA: [[G1_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
148       // LAMBDA: [[G1_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G1_PTR_REF]]
149       // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G1_REF]]
150       // LAMBDA: [[SIVAR_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 2
151       // LAMBDA: [[SIVAR_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[SIVAR_PTR_REF]]
152       // LAMBDA: store i{{[0-9]+}} 4, i{{[0-9]+}}* [[SIVAR_REF]]
153     }();
154   }
155   }();
156   return 0;
157 #else
158 #pragma omp target
159 #pragma omp teams distribute firstprivate(t_var, vec, s_arr, var, sivar)
160   for (int i = 0; i < 2; ++i) {
161     vec[i] = t_var;
162     s_arr[i] = var;
163     sivar += i;
164   }
165   return tmain<int>();
166 #endif
167 }
168 
169 // CHECK: define {{.*}}i{{[0-9]+}} @main()
170 // CHECK: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 0, i32 0)
171 // CHECK: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}})
172 // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]()
173 // CHECK:  ret
174 
175 // CHECK: define{{.*}} void @[[OFFL1]]({{.+}})
176 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
177 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}]*,
178 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]]*,
179 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]]*,
180 // CHECK: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
181 // CHECK: [[T_VAR_CAST:%.+]] = alloca i{{[0-9]+}},
182 // CHECK: [[SIVAR_CAST:%.+]] = alloca i{{[0-9]+}},
183 
184 // CHECK-DAG: [[VEC_TE_PAR:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** [[VEC_PRIV]],
185 // CHECK-DAG: [[T_VAR_TE_PAR:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR_CAST]],
186 // CHECK-DAG: [[S_ARR_TE_PAR:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[S_ARR_PRIV]],
187 // CHECK-DAG: [[VAR_TE_PAR:%.+]] = load [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]** [[VAR_PRIV]],
188 // CHECK-DAG: [[SIVAR_TE_PAR:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR_CAST]],
189 
190 // CHECK: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 5, {{.+}} @[[OUTL1:.+]] to {{.+}}, [2 x i{{[0-9]+}}]* [[VEC_TE_PAR]], i{{[0-9]+}} [[T_VAR_TE_PAR]], [2 x [[S_FLOAT_TY]]]* [[S_ARR_TE_PAR]], [[S_FLOAT_TY]]* [[VAR_TE_PAR]], i{{[0-9]+}} [[SIVAR_TE_PAR]])
191 // CHECK: ret void
192 
193 // CHECK: define internal void @[[OUTL1]]({{.+}})
194 // Skip global and bound tid vars
195 // CHECK: {{.+}} = alloca i32*,
196 // CHECK: {{.+}} = alloca i32*,
197 // CHECK: [[VEC_ADDR:%.+]] = alloca [2 x i{{[0-9]+}}]*,
198 // CHECK: [[T_VAR_ADDR:%.+]] = alloca i{{[0-9]+}},
199 // CHECK: [[S_ARR_ADDR:%.+]] = alloca [2 x [[S_FLOAT_TY]]]*,
200 // CHECK: [[VAR_ADDR:%.+]] = alloca [[S_FLOAT_TY]]*,
201 // CHECK: [[SIVAR_ADDR:%.+]] = alloca i{{[0-9]+}},
202 // Skip temp vars for loop
203 // CHECK: alloca i{{[0-9]+}},
204 // CHECK: alloca i{{[0-9]+}},
205 // CHECK: alloca i{{[0-9]+}},
206 // CHECK: alloca i{{[0-9]+}},
207 // CHECK: alloca i{{[0-9]+}},
208 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
209 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
210 // CHECK: [[AGG_TMP1:%.+]] = alloca [[ST_TY]],
211 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
212 // CHECK: [[AGG_TMP2:%.+]] = alloca [[ST_TY]],
213 
214 // param copy
215 // CHECK: store [2 x i{{[0-9]+}}]* {{.+}}, [2 x i{{[0-9]+}}]** [[VEC_ADDR]],
216 // CHECK: store i{{[0-9]+}} {{.+}}, i{{[0-9]+}}* [[T_VAR_ADDR]],
217 // CHECK: store [2 x [[S_FLOAT_TY]]]* {{.+}}, [2 x [[S_FLOAT_TY]]]** [[S_ARR_ADDR]],
218 // CHECK: store [[S_FLOAT_TY]]* {{.+}}, [[S_FLOAT_TY]]** [[VAR_ADDR]],
219 // CHECK: store i{{[0-9]+}} {{.+}}, i{{[0-9]+}}* [[SIVAR_ADDR]],
220 
221 // T_VAR and SIVAR
222 // CHECK-64-DAG: [[CONV_TVAR:%.+]] = bitcast i64* [[T_VAR_ADDR]] to i32*
223 // CHECK-64-DAG: [[CONV_SIVAR:%.+]] = bitcast i64* [[SIVAR_ADDR]] to i32*
224 
225 // preparation vars
226 // CHECK-DAG: [[VEC_ADDR_VAL:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** [[VEC_ADDR]],
227 // CHECK-DAG: [[S_ARR_ADDR_REF:%.+]] = load [2 x [[S_FLOAT_TY]]]*, [2 x [[S_FLOAT_TY]]]** [[S_ARR_ADDR]],
228 // CHECK-DAG: [[VAR_ADDR_REF:%.+]] = load{{.+}} [[VAR_ADDR]],
229 
230 // firstprivate vec(vec): copy from *_addr into priv1 and then from priv1 into priv2
231 // CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
232 // CHECK-DAG: [[VEC_SRC:%.+]] =  bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8*
233 // CHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[VEC_DEST_PRIV]], i8* align {{[0-9]+}} [[VEC_SRC]], {{.+}})
234 
235 // firstprivate(s_arr)
236 // CHECK-DAG: [[S_ARR_PRIV_BGN:%.+]] = getelementptr{{.*}} [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[S_ARR_PRIV]],
237 // CHECK-DAG: [[S_ARR_ADDR_BGN:%.+]] = bitcast [2 x [[S_FLOAT_TY]]]* [[S_ARR_ADDR_REF]] to
238 // CHECK-DAG: [[S_ARR_FIN:%.+]] = icmp{{.+}} [[S_ARR_PRIV_BGN]],
239 // CHECK-DAG: [[S_ARR_SRC_COPY:%.+]] = phi{{.+}} [ [[S_ARR_ADDR_BGN]], {{.+}} ], [ [[S_ARR_SRC:%.+]], {{.+}} ]
240 // CHECK-DAG: [[S_ARR_DST_COPY:%.+]] = phi{{.+}} [ [[S_ARR_PRIV_BGN]], {{.+}}], [ [[S_ARR_DST:%.+]], {{.+}} ]
241 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP1]])
242 // CHECK-DAG: call void @{{.+}}({{.+}} [[S_ARR_DST_COPY]], {{.+}} [[S_ARR_SRC_COPY]], {{.+}} [[AGG_TMP1]])
243 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP1]])
244 // CHECK-DAG: [[S_ARR_DST]] = getelementptr {{.+}} [[S_ARR_DST_COPY]],
245 // CHECK-DAG: [[S_ARR_SRC]] = getelementptr {{.+}} [[S_ARR_SRC_COPY]],
246 
247 // firstprivate(var)
248 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP2]])
249 // CHECK-DAG: call void @{{.+}}({{.+}} [[VAR_PRIV]], {{.+}} [[VAR_ADDR_REF]], {{.+}} [[AGG_TMP2]])
250 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP2]])
251 
252 // CHECK: call void @__kmpc_for_static_init_4(
253 // CHECK-32-DAG: {{.+}} = {{.+}} [[T_VAR_ADDR]]
254 // CHECK-64-DAG: {{.+}} = {{.+}} [[CONV_TVAR]]
255 // CHECK-DAG: {{.+}} = {{.+}} [[VEC_PRIV]]
256 // CHECK-DAG: {{.+}} = {{.+}} [[S_ARR_PRIV]]
257 // CHECK-DAG: {{.+}} = {{.+}} [[VAR_PRIV]]
258 // CHECK-32-DAG: {{.+}} = {{.+}} [[SIVAR_ADDR]]
259 // CHECK-64-DAG: {{.+}} = {{.+}} [[CONV_SIVAR]]
260 // CHECK: call void @__kmpc_for_static_fini(
261 // CHECK: ret void
262 
263 // CHECK: define{{.*}} i{{[0-9]+}} @[[TMAIN_INT]]()
264 // CHECK: call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i8** null, i8** null, i32 0, i32 0)
265 // CHECK: call void @[[TOFFL1:.+]](i{{64|32}} %{{.+}})
266 // CHECK:  ret
267 
268 // CHECK: define {{.*}}void @[[TOFFL1]]({{.+}})
269 // CHECK: [[TT_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
270 // CHECK: [[TVEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}]*,
271 // CHECK: [[TS_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]]*,
272 // CHECK: [[TVAR_PRIV:%.+]] = alloca [[S_INT_TY]]*,
273 // CHECK: [[TT_VAR_CAST:%.+]] = alloca i{{[0-9]+}},
274 
275 // CHECK-DAG: [[TVEC_TE_PAR:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** [[TVEC_PRIV]],
276 // CHECK-DAG: [[TT_VAR_TE_PAR:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[TT_VAR_CAST]],
277 // CHECK-DAG: [[TS_ARR_TE_PAR:%.+]] = load [2 x [[S_INT_TY]]]*, [2 x [[S_INT_TY]]]** [[TS_ARR_PRIV]],
278 // CHECK-DAG: [[TVAR_TE_PAR:%.+]] = load [[S_INT_TY]]*, [[S_INT_TY]]** [[TVAR_PRIV]],
279 
280 // CHECK: [[TVAR_TE_PAR:%.+]] = load [[S_INT_TY]]*, [[S_INT_TY]]** %
281 // CHECK: call void {{.+}} @__kmpc_fork_teams({{.+}}, i32 4, {{.+}} @[[TOUTL1:.+]] to {{.+}}, [2 x i{{[0-9]+}}]* [[TVEC_TE_PAR]], i{{[0-9]+}} [[TT_VAR_TE_PAR]], [2 x [[S_INT_TY]]]* [[TS_ARR_TE_PAR]], [[S_INT_TY]]* [[TVAR_TE_PAR]])
282 // CHECK: ret void
283 
284 // CHECK: define internal void @[[TOUTL1]]({{.+}})
285 // Skip global and bound tid vars
286 // CHECK: {{.+}} = alloca i32*,
287 // CHECK: {{.+}} = alloca i32*,
288 // CHECK: [[VEC_ADDR:%.+]] = alloca [2 x i{{[0-9]+}}]*,
289 // CHECK: [[T_VAR_ADDR:%.+]] = alloca i{{[0-9]+}},
290 // CHECK: [[S_ARR_ADDR:%.+]] = alloca [2 x [[S_INT_TY]]]*,
291 // CHECK: [[VAR_ADDR:%.+]] = alloca [[S_INT_TY]]*,
292 // CHECK: [[TMP_VAR_ADDR:%.+]] = alloca [[S_INT_TY]]*,
293 // Skip temp vars for loop
294 // CHECK: alloca i{{[0-9]+}},
295 // CHECK: alloca i{{[0-9]+}},
296 // CHECK: alloca i{{[0-9]+}},
297 // CHECK: alloca i{{[0-9]+}},
298 // CHECK: alloca i{{[0-9]+}},
299 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
300 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]],
301 // CHECK: [[AGG_TMP1:%.+]] = alloca [[ST_TY]],
302 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]],
303 // CHECK: [[AGG_TMP2:%.+]] = alloca [[ST_TY]],
304 // CHECK: [[TMP:%.+]] = alloca [[S_INT_TY]]*,
305 
306 // param copy
307 // CHECK: store [2 x i{{[0-9]+}}]* {{.+}}, [2 x i{{[0-9]+}}]** [[VEC_ADDR]],
308 // CHECK: store i{{[0-9]+}} {{.+}}, i{{[0-9]+}}* [[T_VAR_ADDR]],
309 // CHECK: store [2 x [[S_INT_TY]]]* {{.+}}, [2 x [[S_INT_TY]]]** [[S_ARR_ADDR]],
310 // CHECK: store [[S_INT_TY]]* {{.+}}, [[S_INT_TY]]** [[VAR_ADDR]],
311 
312 
313 // T_VAR and preparation variables
314 // CHECK: [[VEC_ADDR_VAL:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** [[VEC_ADDR]],
315 // CHECK-64: [[CONV_TVAR:%.+]] = bitcast i64* [[T_VAR_ADDR]] to i32*
316 // CHECK: [[S_ARR_ADDR_REF:%.+]] = load [2 x [[S_INT_TY]]]*, [2 x [[S_INT_TY]]]** [[S_ARR_ADDR]],
317 
318 // firstprivate vec(vec): copy from *_addr into priv1 and then from priv1 into priv2
319 // CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
320 // CHECK-DAG: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8*
321 // CHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[VEC_DEST_PRIV]], i8* align {{[0-9]+}} [[VEC_SRC]], {{.+}})
322 
323 // firstprivate(s_arr)
324 // CHECK-DAG: [[S_ARR_PRIV_BGN:%.+]] = getelementptr{{.*}} [2 x [[S_INT_TY]]], [2 x [[S_INT_TY]]]* [[S_ARR_PRIV]],
325 // CHECK-DAG: [[S_ARR_ADDR_BGN:%.+]] = bitcast [2 x [[S_INT_TY]]]* [[S_ARR_ADDR_REF]] to
326 // CHECK-DAG: [[S_ARR_FIN:%.+]] = icmp{{.+}} [[S_ARR_PRIV_BGN]],
327 // CHECK-DAG: [[S_ARR_SRC_COPY:%.+]] = phi{{.+}} [ [[S_ARR_ADDR_BGN]], {{.+}} ], [ [[S_ARR_SRC:%.+]], {{.+}} ]
328 // CHECK-DAG: [[S_ARR_DST_COPY:%.+]] = phi{{.+}} [ [[S_ARR_PRIV_BGN]], {{.+}} ], [ [[S_ARR_DST:%.+]], {{.+}} ]
329 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP1]])
330 // CHECK-DAG: call void @{{.+}}({{.+}} [[S_ARR_DST_COPY]], {{.+}} [[S_ARR_SRC_COPY]], {{.+}} [[AGG_TMP1]])
331 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP1]])
332 // CHECK-DAG: [[S_ARR_DST]] = getelementptr {{.+}} [[S_ARR_DST_COPY]],
333 // CHECK-DAG: [[S_ARR_SRC]] = getelementptr {{.+}} [[S_ARR_SRC_COPY]],
334 
335 // firstprivate(var)
336 // CHECK-DAG: [[VAR_ADDR_REF:%.+]] = load{{.+}} [[TMP_VAR_ADDR]],
337 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP2]])
338 // CHECK-DAG: call void @{{.+}}({{.+}} [[VAR_PRIV]], {{.+}} [[VAR_ADDR_REF]], {{.+}} [[AGG_TMP2]])
339 // CHECK-DAG: call void @{{.+}}({{.+}} [[AGG_TMP2]])
340 // CHECK-DAG: store [[S_INT_TY]]* [[VAR_PRIV]], [[S_INT_TY]]** [[TMP]],
341 
342 // CHECK: call void @__kmpc_for_static_init_4(
343 // CHECK-32-DAG: {{.+}} = {{.+}} [[T_VAR_ADDR]]
344 // CHECK-64-DAG: {{.+}} = {{.+}} [[CONV_TVAR]]
345 // CHECK-DAG: {{.+}} = {{.+}} [[VEC_PRIV]]
346 // CHECK-DAG: {{.+}} = {{.+}} [[TMP]]
347 // CHECK-DAG: {{.+}} = {{.+}} [[S_ARR_PRIV]]
348 // CHECK: call void @__kmpc_for_static_fini(
349 // CHECK: ret void
350 
351 #endif
352