1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4
5 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
12
13 void foo();
14 void bar();
15
16 // CHECK: define void @{{.*}}baz{{.*}}(i32 %n)
baz(int n)17 void baz(int n) {
18 static float a[10];
19 static double b;
20
21 // CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
22 // CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
23
24 // CHECK: call i8* @llvm.stacksave()
25 // CHECK: [[A_BUF_SIZE:%.+]] = mul nuw i64 10, [[NUM_ELEMS:%[^,]+]]
26
27 // float a_buffer[10][n];
28 // CHECK: [[A_BUF:%.+]] = alloca float, i64 [[A_BUF_SIZE]],
29
30 // double b_buffer[10];
31 // CHECK: [[B_BUF:%.+]] = alloca double, i64 10,
32 #pragma omp parallel for simd reduction(inscan, +:a[:n], b)
33 for (int i = 0; i < 10; ++i) {
34 // CHECK: call void @__kmpc_for_static_init_4(
35 // CHECK: call i8* @llvm.stacksave()
36 // CHECK: store float 0.000000e+00, float* %
37 // CHECK: store double 0.000000e+00, double* [[B_PRIV_ADDR:%.+]],
38 // CHECK: br label %[[DISPATCH:[^,]+]]
39 // CHECK: [[INPUT_PHASE:.+]]:
40 // CHECK: call void @{{.+}}foo{{.+}}()
41
42 // a_buffer[i][0..n] = a_priv[[0..n];
43 // CHECK: [[BASE_IDX_I:%.+]] = load i32, i32* [[IV_ADDR:%.+]],
44 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
45 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS]]
46 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
47 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], [10 x float]* [[A_PRIV_ADDR:%.+]], i64 0, i64 0
48 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
49 // CHECK: [[DEST:%.+]] = bitcast float* [[A_BUF_IDX]] to i8*
50 // CHECK: [[SRC:%.+]] = bitcast float* [[A_PRIV]] to i8*
51 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}[[DEST]], i8* {{.*}}[[SRC]], i64 [[BYTES]], i1 false)
52
53 // b_buffer[i] = b_priv;
54 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[BASE_IDX]]
55 // CHECK: [[B_PRIV:%.+]] = load double, double* [[B_PRIV_ADDR]],
56 // CHECK: store double [[B_PRIV]], double* [[B_BUF_IDX]],
57 // CHECK: br label %[[LOOP_CONTINUE:.+]]
58
59 // CHECK: [[DISPATCH]]:
60 // CHECK: br label %[[INPUT_PHASE]]
61 // CHECK: [[LOOP_CONTINUE]]:
62 // CHECK: call void @llvm.stackrestore(i8* %
63 // CHECK: call void @__kmpc_for_static_fini(
64 // CHECK: call void @__kmpc_barrier(
65 foo();
66 #pragma omp scan inclusive(a[:n], b)
67 // CHECK: [[LOG2_10:%.+]] = call double @llvm.log2.f64(double 1.000000e+01)
68 // CHECK: [[CEIL_LOG2_10:%.+]] = call double @llvm.ceil.f64(double [[LOG2_10]])
69 // CHECK: [[CEIL_LOG2_10_INT:%.+]] = fptoui double [[CEIL_LOG2_10]] to i32
70 // CHECK: br label %[[OUTER_BODY:[^,]+]]
71 // CHECK: [[OUTER_BODY]]:
72 // CHECK: [[K:%.+]] = phi i32 [ 0, %{{.+}} ], [ [[K_NEXT:%.+]], %{{.+}} ]
73 // CHECK: [[K2POW:%.+]] = phi i64 [ 1, %{{.+}} ], [ [[K2POW_NEXT:%.+]], %{{.+}} ]
74 // CHECK: [[CMP:%.+]] = icmp uge i64 9, [[K2POW]]
75 // CHECK: br i1 [[CMP]], label %[[INNER_BODY:[^,]+]], label %[[INNER_EXIT:[^,]+]]
76 // CHECK: [[INNER_BODY]]:
77 // CHECK: [[I:%.+]] = phi i64 [ 9, %[[OUTER_BODY]] ], [ [[I_PREV:%.+]], %{{.+}} ]
78
79 // a_buffer[i] += a_buffer[i-pow(2, k)];
80 // CHECK: [[IDX:%.+]] = mul nsw i64 [[I]], [[NUM_ELEMS]]
81 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
82 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
83 // CHECK: [[IDX:%.+]] = mul nsw i64 [[IDX_SUB_K2POW]], [[NUM_ELEMS]]
84 // CHECK: [[A_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
85 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[I]]
86 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
87 // CHECK: [[B_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[IDX_SUB_K2POW]]
88 // CHECK: [[A_BUF_END:%.+]] = getelementptr float, float* [[A_BUF_IDX]], i64 [[NUM_ELEMS]]
89 // CHECK: [[ISEMPTY:%.+]] = icmp eq float* [[A_BUF_IDX]], [[A_BUF_END]]
90 // CHECK: br i1 [[ISEMPTY]], label %[[RED_DONE:[^,]+]], label %[[RED_BODY:[^,]+]]
91 // CHECK: [[RED_BODY]]:
92 // CHECK: [[A_BUF_IDX_SUB_K2POW_ELEM:%.+]] = phi float* [ [[A_BUF_IDX_SUB_K2POW]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_SUB_K2POW_NEXT:%.+]], %[[RED_BODY]] ]
93 // CHECK: [[A_BUF_IDX_ELEM:%.+]] = phi float* [ [[A_BUF_IDX]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_NEXT:%.+]], %[[RED_BODY]] ]
94 // CHECK: [[A_BUF_IDX_VAL:%.+]] = load float, float* [[A_BUF_IDX_ELEM]],
95 // CHECK: [[A_BUF_IDX_SUB_K2POW_VAL:%.+]] = load float, float* [[A_BUF_IDX_SUB_K2POW_ELEM]],
96 // CHECK: [[RED:%.+]] = fadd float [[A_BUF_IDX_VAL]], [[A_BUF_IDX_SUB_K2POW_VAL]]
97 // CHECK: store float [[RED]], float* [[A_BUF_IDX_ELEM]],
98 // CHECK: [[A_BUF_IDX_NEXT]] = getelementptr float, float* [[A_BUF_IDX_ELEM]], i32 1
99 // CHECK: [[A_BUF_IDX_SUB_K2POW_NEXT]] = getelementptr float, float* [[A_BUF_IDX_SUB_K2POW_ELEM]], i32 1
100 // CHECK: [[DONE:%.+]] = icmp eq float* [[A_BUF_IDX_NEXT]], [[A_BUF_END]]
101 // CHECK: br i1 [[DONE]], label %[[RED_DONE]], label %[[RED_BODY]]
102 // CHECK: [[RED_DONE]]:
103
104 // b_buffer[i] += b_buffer[i-pow(2, k)];
105 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, double* [[B_BUF_IDX]],
106 // CHECK: [[B_BUF_IDX_SUB_K2POW_VAL:%.+]] = load double, double* [[B_BUF_IDX_SUB_K2POW]],
107 // CHECK: [[RED:%.+]] = fadd double [[B_BUF_IDX_VAL]], [[B_BUF_IDX_SUB_K2POW_VAL]]
108 // CHECK: store double [[RED]], double* [[B_BUF_IDX]],
109
110 // --i;
111 // CHECK: [[I_PREV:%.+]] = sub nuw i64 [[I]], 1
112 // CHECK: [[CMP:%.+]] = icmp uge i64 [[I_PREV]], [[K2POW]]
113 // CHECK: br i1 [[CMP]], label %[[INNER_BODY]], label %[[INNER_EXIT]]
114 // CHECK: [[INNER_EXIT]]:
115
116 // ++k;
117 // CHECK: [[K_NEXT]] = add nuw i32 [[K]], 1
118 // k2pow <<= 1;
119 // CHECK: [[K2POW_NEXT]] = shl nuw i64 [[K2POW]], 1
120 // CHECK: [[CMP:%.+]] = icmp ne i32 [[K_NEXT]], [[CEIL_LOG2_10_INT]]
121 // CHECK: br i1 [[CMP]], label %[[OUTER_BODY]], label %[[OUTER_EXIT:[^,]+]]
122 // CHECK: [[OUTER_EXIT]]:
123 bar();
124 // CHECK: call void @__kmpc_for_static_init_4(
125 // CHECK: call i8* @llvm.stacksave()
126 // CHECK: store float 0.000000e+00, float* %
127 // CHECK: store double 0.000000e+00, double* [[B_PRIV_ADDR:%.+]],
128 // CHECK: br label %[[DISPATCH:[^,]+]]
129
130 // Skip the before scan body.
131 // CHECK: call void @{{.+}}foo{{.+}}()
132
133 // CHECK: [[EXIT_INSCAN:[^,]+]]:
134 // CHECK: br label %[[LOOP_CONTINUE:[^,]+]]
135
136 // CHECK: [[DISPATCH]]:
137 // a_priv[[0..n] = a_buffer[i][0..n];
138 // CHECK: [[BASE_IDX_I:%.+]] = load i32, i32* [[IV_ADDR:%.+]],
139 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
140 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS]]
141 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
142 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], [10 x float]* [[A_PRIV_ADDR:%.+]], i64 0, i64 0
143 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
144 // CHECK: [[DEST:%.+]] = bitcast float* [[A_PRIV]] to i8*
145 // CHECK: [[SRC:%.+]] = bitcast float* [[A_BUF_IDX]] to i8*
146 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}[[DEST]], i8* {{.*}}[[SRC]], i64 [[BYTES]], i1 false)
147
148 // b_priv = b_buffer[i];
149 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[BASE_IDX]]
150 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, double* [[B_BUF_IDX]],
151 // CHECK: store double [[B_BUF_IDX_VAL]], double* [[B_PRIV_ADDR]],
152 // CHECK: br label %[[SCAN_PHASE:[^,]+]]
153
154 // CHECK: [[SCAN_PHASE]]:
155 // CHECK: call void @{{.+}}bar{{.+}}()
156 // CHECK: br label %[[EXIT_INSCAN]]
157
158 // CHECK: [[LOOP_CONTINUE]]:
159 // CHECK: call void @llvm.stackrestore(i8* %
160 // CHECK: call void @__kmpc_for_static_fini(
161 // CHECK: call void @llvm.stackrestore(i8*
162 }
163
164 // CHECK: call i8* @llvm.stacksave()
165 // CHECK: [[A_BUF_SIZE:%.+]] = mul nuw i64 10, [[NUM_ELEMS:%[^,]+]]
166
167 // float a_buffer[10][n];
168 // CHECK: [[A_BUF:%.+]] = alloca float, i64 [[A_BUF_SIZE]],
169
170 // double b_buffer[10];
171 // CHECK: [[B_BUF:%.+]] = alloca double, i64 10,
172 #pragma omp parallel for simd reduction(inscan, +:a[:n], b)
173 for (int i = 0; i < 10; ++i) {
174 // CHECK: call void @__kmpc_for_static_init_4(
175 // CHECK: call i8* @llvm.stacksave()
176 // CHECK: store float 0.000000e+00, float* %
177 // CHECK: store double 0.000000e+00, double* [[B_PRIV_ADDR:%.+]],
178 // CHECK: br label %[[DISPATCH:[^,]+]]
179
180 // Skip the before scan body.
181 // CHECK: call void @{{.+}}foo{{.+}}()
182
183 // CHECK: [[EXIT_INSCAN:[^,]+]]:
184
185 // a_buffer[i][0..n] = a_priv[[0..n];
186 // CHECK: [[BASE_IDX_I:%.+]] = load i32, i32* [[IV_ADDR:%.+]],
187 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
188 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX]], [[NUM_ELEMS]]
189 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
190 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], [10 x float]* [[A_PRIV_ADDR:%.+]], i64 0, i64 0
191 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
192 // CHECK: [[DEST:%.+]] = bitcast float* [[A_BUF_IDX]] to i8*
193 // CHECK: [[SRC:%.+]] = bitcast float* [[A_PRIV]] to i8*
194 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}[[DEST]], i8* {{.*}}[[SRC]], i64 [[BYTES]], i1 false)
195
196 // b_buffer[i] = b_priv;
197 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[BASE_IDX]]
198 // CHECK: [[B_PRIV:%.+]] = load double, double* [[B_PRIV_ADDR]],
199 // CHECK: store double [[B_PRIV]], double* [[B_BUF_IDX]],
200 // CHECK: br label %[[LOOP_CONTINUE:[^,]+]]
201
202 // CHECK: [[DISPATCH]]:
203 // CHECK: br label %[[INPUT_PHASE:[^,]+]]
204
205 // CHECK: [[INPUT_PHASE]]:
206 // CHECK: call void @{{.+}}bar{{.+}}()
207 // CHECK: br label %[[EXIT_INSCAN]]
208
209 // CHECK: [[LOOP_CONTINUE]]:
210 // CHECK: call void @llvm.stackrestore(i8* %
211 // CHECK: call void @__kmpc_for_static_fini(
212 // CHECK: call void @__kmpc_barrier(
213 foo();
214 #pragma omp scan exclusive(a[:n], b)
215 // CHECK: [[LOG2_10:%.+]] = call double @llvm.log2.f64(double 1.000000e+01)
216 // CHECK: [[CEIL_LOG2_10:%.+]] = call double @llvm.ceil.f64(double [[LOG2_10]])
217 // CHECK: [[CEIL_LOG2_10_INT:%.+]] = fptoui double [[CEIL_LOG2_10]] to i32
218 // CHECK: br label %[[OUTER_BODY:[^,]+]]
219 // CHECK: [[OUTER_BODY]]:
220 // CHECK: [[K:%.+]] = phi i32 [ 0, %{{.+}} ], [ [[K_NEXT:%.+]], %{{.+}} ]
221 // CHECK: [[K2POW:%.+]] = phi i64 [ 1, %{{.+}} ], [ [[K2POW_NEXT:%.+]], %{{.+}} ]
222 // CHECK: [[CMP:%.+]] = icmp uge i64 9, [[K2POW]]
223 // CHECK: br i1 [[CMP]], label %[[INNER_BODY:[^,]+]], label %[[INNER_EXIT:[^,]+]]
224 // CHECK: [[INNER_BODY]]:
225 // CHECK: [[I:%.+]] = phi i64 [ 9, %[[OUTER_BODY]] ], [ [[I_PREV:%.+]], %{{.+}} ]
226
227 // a_buffer[i] += a_buffer[i-pow(2, k)];
228 // CHECK: [[IDX:%.+]] = mul nsw i64 [[I]], [[NUM_ELEMS]]
229 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
230 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
231 // CHECK: [[IDX:%.+]] = mul nsw i64 [[IDX_SUB_K2POW]], [[NUM_ELEMS]]
232 // CHECK: [[A_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
233 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[I]]
234 // CHECK: [[IDX_SUB_K2POW:%.+]] = sub nuw i64 [[I]], [[K2POW]]
235 // CHECK: [[B_BUF_IDX_SUB_K2POW:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[IDX_SUB_K2POW]]
236 // CHECK: [[A_BUF_END:%.+]] = getelementptr float, float* [[A_BUF_IDX]], i64 [[NUM_ELEMS]]
237 // CHECK: [[ISEMPTY:%.+]] = icmp eq float* [[A_BUF_IDX]], [[A_BUF_END]]
238 // CHECK: br i1 [[ISEMPTY]], label %[[RED_DONE:[^,]+]], label %[[RED_BODY:[^,]+]]
239 // CHECK: [[RED_BODY]]:
240 // CHECK: [[A_BUF_IDX_SUB_K2POW_ELEM:%.+]] = phi float* [ [[A_BUF_IDX_SUB_K2POW]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_SUB_K2POW_NEXT:%.+]], %[[RED_BODY]] ]
241 // CHECK: [[A_BUF_IDX_ELEM:%.+]] = phi float* [ [[A_BUF_IDX]], %[[INNER_BODY]] ], [ [[A_BUF_IDX_NEXT:%.+]], %[[RED_BODY]] ]
242 // CHECK: [[A_BUF_IDX_VAL:%.+]] = load float, float* [[A_BUF_IDX_ELEM]],
243 // CHECK: [[A_BUF_IDX_SUB_K2POW_VAL:%.+]] = load float, float* [[A_BUF_IDX_SUB_K2POW_ELEM]],
244 // CHECK: [[RED:%.+]] = fadd float [[A_BUF_IDX_VAL]], [[A_BUF_IDX_SUB_K2POW_VAL]]
245 // CHECK: store float [[RED]], float* [[A_BUF_IDX_ELEM]],
246 // CHECK: [[A_BUF_IDX_NEXT]] = getelementptr float, float* [[A_BUF_IDX_ELEM]], i32 1
247 // CHECK: [[A_BUF_IDX_SUB_K2POW_NEXT]] = getelementptr float, float* [[A_BUF_IDX_SUB_K2POW_ELEM]], i32 1
248 // CHECK: [[DONE:%.+]] = icmp eq float* [[A_BUF_IDX_NEXT]], [[A_BUF_END]]
249 // CHECK: br i1 [[DONE]], label %[[RED_DONE]], label %[[RED_BODY]]
250 // CHECK: [[RED_DONE]]:
251
252 // b_buffer[i] += b_buffer[i-pow(2, k)];
253 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, double* [[B_BUF_IDX]],
254 // CHECK: [[B_BUF_IDX_SUB_K2POW_VAL:%.+]] = load double, double* [[B_BUF_IDX_SUB_K2POW]],
255 // CHECK: [[RED:%.+]] = fadd double [[B_BUF_IDX_VAL]], [[B_BUF_IDX_SUB_K2POW_VAL]]
256 // CHECK: store double [[RED]], double* [[B_BUF_IDX]],
257
258 // --i;
259 // CHECK: [[I_PREV:%.+]] = sub nuw i64 [[I]], 1
260 // CHECK: [[CMP:%.+]] = icmp uge i64 [[I_PREV]], [[K2POW]]
261 // CHECK: br i1 [[CMP]], label %[[INNER_BODY]], label %[[INNER_EXIT]]
262 // CHECK: [[INNER_EXIT]]:
263
264 // ++k;
265 // CHECK: [[K_NEXT]] = add nuw i32 [[K]], 1
266 // k2pow <<= 1;
267 // CHECK: [[K2POW_NEXT]] = shl nuw i64 [[K2POW]], 1
268 // CHECK: [[CMP:%.+]] = icmp ne i32 [[K_NEXT]], [[CEIL_LOG2_10_INT]]
269 // CHECK: br i1 [[CMP]], label %[[OUTER_BODY]], label %[[OUTER_EXIT:[^,]+]]
270 // CHECK: [[OUTER_EXIT]]:
271 bar();
272 // CHECK: call void @__kmpc_for_static_init_4(
273 // CHECK: call i8* @llvm.stacksave()
274 // CHECK: store float 0.000000e+00, float* %
275 // CHECK: store double 0.000000e+00, double* [[B_PRIV_ADDR:%.+]],
276 // CHECK: br label %[[DISPATCH:[^,]+]]
277
278 // CHECK: [[SCAN_PHASE:.+]]:
279 // CHECK: call void @{{.+}}foo{{.+}}()
280 // CHECK: br label %[[LOOP_CONTINUE:.+]]
281
282 // CHECK: [[DISPATCH]]:
283 // if (i >0)
284 // a_priv[[0..n] = a_buffer[i-1][0..n];
285 // CHECK: [[BASE_IDX_I:%.+]] = load i32, i32* [[IV_ADDR:%.+]],
286 // CHECK: [[BASE_IDX:%.+]] = zext i32 [[BASE_IDX_I]] to i64
287 // CHECK: [[CMP:%.+]] = icmp eq i64 [[BASE_IDX]], 0
288 // CHECK: br i1 [[CMP]], label %[[IF_DONE:[^,]+]], label %[[IF_THEN:[^,]+]]
289 // CHECK: [[IF_THEN]]:
290 // CHECK: [[BASE_IDX_SUB_1:%.+]] = sub nuw i64 [[BASE_IDX]], 1
291 // CHECK: [[IDX:%.+]] = mul nsw i64 [[BASE_IDX_SUB_1]], [[NUM_ELEMS]]
292 // CHECK: [[A_BUF_IDX:%.+]] = getelementptr inbounds float, float* [[A_BUF]], i64 [[IDX]]
293 // CHECK: [[A_PRIV:%.+]] = getelementptr inbounds [10 x float], [10 x float]* [[A_PRIV_ADDR:%.+]], i64 0, i64 0
294 // CHECK: [[BYTES:%.+]] = mul nuw i64 [[NUM_ELEMS:%.+]], 4
295 // CHECK: [[DEST:%.+]] = bitcast float* [[A_PRIV]] to i8*
296 // CHECK: [[SRC:%.+]] = bitcast float* [[A_BUF_IDX]] to i8*
297 // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}[[DEST]], i8* {{.*}}[[SRC]], i64 [[BYTES]], i1 false)
298
299 // b_priv = b_buffer[i];
300 // CHECK: [[B_BUF_IDX:%.+]] = getelementptr inbounds double, double* [[B_BUF]], i64 [[BASE_IDX_SUB_1]]
301 // CHECK: [[B_BUF_IDX_VAL:%.+]] = load double, double* [[B_BUF_IDX]],
302 // CHECK: store double [[B_BUF_IDX_VAL]], double* [[B_PRIV_ADDR]],
303 // CHECK: br label %[[SCAN_PHASE]]
304
305 // CHECK: [[LOOP_CONTINUE]]:
306 // CHECK: call void @llvm.stackrestore(i8* %
307 // CHECK: call void @__kmpc_for_static_fini(
308 // CHECK: call void @llvm.stackrestore(i8*
309 }
310 }
311
312 // CHECK: !{!"llvm.loop.vectorize.enable", i1 true}
313
314 #endif
315
316