1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4*0a6a1f1dSLionel Sambuc //
5*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
6*0a6a1f1dSLionel Sambuc #ifndef HEADER
7*0a6a1f1dSLionel Sambuc #define HEADER
8*0a6a1f1dSLionel Sambuc
9*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*void}} @{{.*}}simple{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
simple(float * a,float * b,float * c,float * d)10*0a6a1f1dSLionel Sambuc void simple(float *a, float *b, float *c, float *d) {
11*0a6a1f1dSLionel Sambuc #pragma omp simd
12*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV:%[^,]+]]
13*0a6a1f1dSLionel Sambuc
14*0a6a1f1dSLionel Sambuc // CHECK: [[IV:%.+]] = load i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID:[0-9]+]]
15*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP:%.+]] = icmp slt i32 [[IV]], 6
16*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]]
17*0a6a1f1dSLionel Sambuc for (int i = 3; i < 32; i += 5) {
18*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP1_BODY]]
19*0a6a1f1dSLionel Sambuc // Start of body: calculate i from IV:
20*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_1:%.+]] = load i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
21*0a6a1f1dSLionel Sambuc // CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5
22*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_I_2:%.+]] = add nsw i32 3, [[CALC_I_1]]
23*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
24*0a6a1f1dSLionel Sambuc // ... loop body ...
25*0a6a1f1dSLionel Sambuc // End of body: store into a[i]:
26*0a6a1f1dSLionel Sambuc // CHECK: store float [[RESULT:%.+]], float* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
27*0a6a1f1dSLionel Sambuc a[i] = b[i] * c[i] * d[i];
28*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_2:%.+]] = load i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
29*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
30*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
31*0a6a1f1dSLionel Sambuc // br label %{{.+}}, !llvm.loop !{{.+}}
32*0a6a1f1dSLionel Sambuc }
33*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP1_END]]
34*0a6a1f1dSLionel Sambuc
35*0a6a1f1dSLionel Sambuc #pragma omp simd
36*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV2:%[^,]+]]
37*0a6a1f1dSLionel Sambuc
38*0a6a1f1dSLionel Sambuc // CHECK: [[IV2:%.+]] = load i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]]
39*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP2:%.+]] = icmp slt i32 [[IV2]], 9
40*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]]
41*0a6a1f1dSLionel Sambuc for (int i = 10; i > 1; i--) {
42*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP2_BODY]]
43*0a6a1f1dSLionel Sambuc // Start of body: calculate i from IV:
44*0a6a1f1dSLionel Sambuc // CHECK: [[IV2_0:%.+]] = load i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
45*0a6a1f1dSLionel Sambuc // FIXME: It is interesting, why the following "mul 1" was not constant folded?
46*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[IV2_1:%.+]] = mul nsw i32 [[IV2_0]], 1
47*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_I_1:%.+]] = sub nsw i32 10, [[IV2_1]]
48*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[LC_I_1]], i32* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
49*0a6a1f1dSLionel Sambuc a[i]++;
50*0a6a1f1dSLionel Sambuc // CHECK: [[IV2_2:%.+]] = load i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
51*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD2_2:%.+]] = add nsw i32 [[IV2_2]], 1
52*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
53*0a6a1f1dSLionel Sambuc // br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]]
54*0a6a1f1dSLionel Sambuc }
55*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP2_END]]
56*0a6a1f1dSLionel Sambuc
57*0a6a1f1dSLionel Sambuc #pragma omp simd
58*0a6a1f1dSLionel Sambuc // CHECK: store i64 0, i64* [[OMP_IV3:%[^,]+]]
59*0a6a1f1dSLionel Sambuc
60*0a6a1f1dSLionel Sambuc // CHECK: [[IV3:%.+]] = load i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID:[0-9]+]]
61*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP3:%.+]] = icmp ult i64 [[IV3]], 4
62*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]]
63*0a6a1f1dSLionel Sambuc for (unsigned long long it = 2000; it >= 600; it-=400) {
64*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP3_BODY]]
65*0a6a1f1dSLionel Sambuc // Start of body: calculate it from IV:
66*0a6a1f1dSLionel Sambuc // CHECK: [[IV3_0:%.+]] = load i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
67*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400
68*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_2:%.+]] = sub i64 2000, [[LC_IT_1]]
69*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
70*0a6a1f1dSLionel Sambuc a[it]++;
71*0a6a1f1dSLionel Sambuc // CHECK: [[IV3_2:%.+]] = load i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
72*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1
73*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[ADD3_2]], i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
74*0a6a1f1dSLionel Sambuc }
75*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP3_END]]
76*0a6a1f1dSLionel Sambuc
77*0a6a1f1dSLionel Sambuc #pragma omp simd
78*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV4:%[^,]+]]
79*0a6a1f1dSLionel Sambuc
80*0a6a1f1dSLionel Sambuc // CHECK: [[IV4:%.+]] = load i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID:[0-9]+]]
81*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP4:%.+]] = icmp slt i32 [[IV4]], 4
82*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP4]], label %[[SIMPLE_LOOP4_BODY:.+]], label %[[SIMPLE_LOOP4_END:[^,]+]]
83*0a6a1f1dSLionel Sambuc for (short it = 6; it <= 20; it-=-4) {
84*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP4_BODY]]
85*0a6a1f1dSLionel Sambuc // Start of body: calculate it from IV:
86*0a6a1f1dSLionel Sambuc // CHECK: [[IV4_0:%.+]] = load i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
87*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i32 [[IV4_0]], 4
88*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i32 6, [[LC_IT_1]]
89*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_3:%.+]] = trunc i32 [[LC_IT_2]] to i16
90*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i16 [[LC_IT_3]], i16* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
91*0a6a1f1dSLionel Sambuc
92*0a6a1f1dSLionel Sambuc // CHECK: [[IV4_2:%.+]] = load i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
93*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD4_2:%.+]] = add nsw i32 [[IV4_2]], 1
94*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD4_2]], i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
95*0a6a1f1dSLionel Sambuc }
96*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP4_END]]
97*0a6a1f1dSLionel Sambuc
98*0a6a1f1dSLionel Sambuc #pragma omp simd
99*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV5:%[^,]+]]
100*0a6a1f1dSLionel Sambuc
101*0a6a1f1dSLionel Sambuc // CHECK: [[IV5:%.+]] = load i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID:[0-9]+]]
102*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP5:%.+]] = icmp slt i32 [[IV5]], 26
103*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP5]], label %[[SIMPLE_LOOP5_BODY:.+]], label %[[SIMPLE_LOOP5_END:[^,]+]]
104*0a6a1f1dSLionel Sambuc for (unsigned char it = 'z'; it >= 'a'; it+=-1) {
105*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP5_BODY]]
106*0a6a1f1dSLionel Sambuc // Start of body: calculate it from IV:
107*0a6a1f1dSLionel Sambuc // CHECK: [[IV5_0:%.+]] = load i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
108*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[IV5_1:%.+]] = mul nsw i32 [[IV5_0]], 1
109*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_1:%.+]] = sub nsw i32 122, [[IV5_1]]
110*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_2:%.+]] = trunc i32 [[LC_IT_1]] to i8
111*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i8 [[LC_IT_2]], i8* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
112*0a6a1f1dSLionel Sambuc
113*0a6a1f1dSLionel Sambuc // CHECK: [[IV5_2:%.+]] = load i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
114*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD5_2:%.+]] = add nsw i32 [[IV5_2]], 1
115*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD5_2]], i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
116*0a6a1f1dSLionel Sambuc }
117*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP5_END]]
118*0a6a1f1dSLionel Sambuc
119*0a6a1f1dSLionel Sambuc #pragma omp simd
120*0a6a1f1dSLionel Sambuc // FIXME: I think we would get wrong result using 'unsigned' in the loop below.
121*0a6a1f1dSLionel Sambuc // So we'll need to add zero trip test for 'unsigned' counters.
122*0a6a1f1dSLionel Sambuc //
123*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV6:%[^,]+]]
124*0a6a1f1dSLionel Sambuc
125*0a6a1f1dSLionel Sambuc // CHECK: [[IV6:%.+]] = load i32* [[OMP_IV6]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP6_ID:[0-9]+]]
126*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP6:%.+]] = icmp slt i32 [[IV6]], -8
127*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP6]], label %[[SIMPLE_LOOP6_BODY:.+]], label %[[SIMPLE_LOOP6_END:[^,]+]]
128*0a6a1f1dSLionel Sambuc for (int i=100; i<10; i+=10) {
129*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP6_BODY]]
130*0a6a1f1dSLionel Sambuc // Start of body: calculate i from IV:
131*0a6a1f1dSLionel Sambuc // CHECK: [[IV6_0:%.+]] = load i32* [[OMP_IV6]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP6_ID]]
132*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i32 [[IV6_0]], 10
133*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i32 100, [[LC_IT_1]]
134*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[LC_IT_2]], i32* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP6_ID]]
135*0a6a1f1dSLionel Sambuc
136*0a6a1f1dSLionel Sambuc // CHECK: [[IV6_2:%.+]] = load i32* [[OMP_IV6]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP6_ID]]
137*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD6_2:%.+]] = add nsw i32 [[IV6_2]], 1
138*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD6_2]], i32* [[OMP_IV6]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP6_ID]]
139*0a6a1f1dSLionel Sambuc }
140*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP6_END]]
141*0a6a1f1dSLionel Sambuc
142*0a6a1f1dSLionel Sambuc int A;
143*0a6a1f1dSLionel Sambuc #pragma omp simd lastprivate(A)
144*0a6a1f1dSLionel Sambuc // Clause 'lastprivate' implementation is not completed yet.
145*0a6a1f1dSLionel Sambuc // Test checks that one iteration is separated in presence of lastprivate.
146*0a6a1f1dSLionel Sambuc //
147*0a6a1f1dSLionel Sambuc // CHECK: store i64 0, i64* [[OMP_IV7:%[^,]+]]
148*0a6a1f1dSLionel Sambuc // CHECK: br i1 true, label %[[SIMPLE_IF7_THEN:.+]], label %[[SIMPLE_IF7_END:[^,]+]]
149*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_IF7_THEN]]
150*0a6a1f1dSLionel Sambuc // CHECK: br label %[[SIMD_LOOP7_COND:[^,]+]]
151*0a6a1f1dSLionel Sambuc // CHECK: [[SIMD_LOOP7_COND]]
152*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[IV7:%.+]] = load i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID:[0-9]+]]
153*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP7:%.+]] = icmp slt i64 [[IV7]], 6
154*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP7]], label %[[SIMPLE_LOOP7_BODY:.+]], label %[[SIMPLE_LOOP7_END:[^,]+]]
155*0a6a1f1dSLionel Sambuc for (long long i = -10; i < 10; i += 3) {
156*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP7_BODY]]
157*0a6a1f1dSLionel Sambuc // Start of body: calculate i from IV:
158*0a6a1f1dSLionel Sambuc // CHECK: [[IV7_0:%.+]] = load i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
159*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV7_0]], 3
160*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]]
161*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
162*0a6a1f1dSLionel Sambuc A = i;
163*0a6a1f1dSLionel Sambuc // CHECK: [[IV7_2:%.+]] = load i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
164*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD7_2:%.+]] = add nsw i64 [[IV7_2]], 1
165*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[ADD7_2]], i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
166*0a6a1f1dSLionel Sambuc }
167*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_LOOP7_END]]
168*0a6a1f1dSLionel Sambuc // Separated last iteration.
169*0a6a1f1dSLionel Sambuc // CHECK: [[IV7_4:%.+]] = load i64* [[OMP_IV7]]
170*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_FIN_1:%.+]] = mul nsw i64 [[IV7_4]], 3
171*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LC_FIN_2:%.+]] = add nsw i64 -10, [[LC_FIN_1]]
172*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[LC_FIN_2]], i64* [[ADDR_I:%[^,]+]]
173*0a6a1f1dSLionel Sambuc // CHECK: [[LOAD_I:%.+]] = load i64* [[ADDR_I]]
174*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CONV_I:%.+]] = trunc i64 [[LOAD_I]] to i32
175*0a6a1f1dSLionel Sambuc //
176*0a6a1f1dSLionel Sambuc // CHECK: br label %[[SIMPLE_IF7_END]]
177*0a6a1f1dSLionel Sambuc // CHECK: [[SIMPLE_IF7_END]]
178*0a6a1f1dSLionel Sambuc //
179*0a6a1f1dSLionel Sambuc
180*0a6a1f1dSLionel Sambuc // CHECK: ret void
181*0a6a1f1dSLionel Sambuc }
182*0a6a1f1dSLionel Sambuc
tfoo(T a)183*0a6a1f1dSLionel Sambuc template <class T, unsigned K> T tfoo(T a) { return a + K; }
184*0a6a1f1dSLionel Sambuc
185*0a6a1f1dSLionel Sambuc template <typename T, unsigned N>
templ1(T a,T * z)186*0a6a1f1dSLionel Sambuc int templ1(T a, T *z) {
187*0a6a1f1dSLionel Sambuc #pragma omp simd collapse(N)
188*0a6a1f1dSLionel Sambuc for (int i = 0; i < N * 2; i++) {
189*0a6a1f1dSLionel Sambuc for (long long j = 0; j < (N + N + N + N); j += 2) {
190*0a6a1f1dSLionel Sambuc z[i + j] = a + tfoo<T, N>(i + j);
191*0a6a1f1dSLionel Sambuc }
192*0a6a1f1dSLionel Sambuc }
193*0a6a1f1dSLionel Sambuc return 0;
194*0a6a1f1dSLionel Sambuc }
195*0a6a1f1dSLionel Sambuc
196*0a6a1f1dSLionel Sambuc // Instatiation templ1<float,2>
197*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*i32}} @{{.*}}templ1{{.*}}(float {{.+}}, float* {{.+}})
198*0a6a1f1dSLionel Sambuc // CHECK: store i64 0, i64* [[T1_OMP_IV:[^,]+]]
199*0a6a1f1dSLionel Sambuc // ...
200*0a6a1f1dSLionel Sambuc // CHECK: [[IV:%.+]] = load i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID:[0-9]+]]
201*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP1:%.+]] = icmp slt i64 [[IV]], 16
202*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP1]], label %[[T1_BODY:.+]], label %[[T1_END:[^,]+]]
203*0a6a1f1dSLionel Sambuc // CHECK: [[T1_BODY]]
204*0a6a1f1dSLionel Sambuc // Loop counters i and j updates:
205*0a6a1f1dSLionel Sambuc // CHECK: [[IV1:%.+]] = load i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
206*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[I_1:%.+]] = sdiv i64 [[IV1]], 4
207*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[I_1_MUL1:%.+]] = mul nsw i64 [[I_1]], 1
208*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[I_1_ADD0:%.+]] = add nsw i64 0, [[I_1_MUL1]]
209*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[I_2:%.+]] = trunc i64 [[I_1_ADD0]] to i32
210*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[I_2]], i32* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
211*0a6a1f1dSLionel Sambuc // CHECK: [[IV2:%.+]] = load i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
212*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[J_1:%.+]] = srem i64 [[IV2]], 4
213*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[J_2:%.+]] = mul nsw i64 [[J_1]], 2
214*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[J_2_ADD0:%.+]] = add nsw i64 0, [[J_2]]
215*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[J_2_ADD0]], i64* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
216*0a6a1f1dSLionel Sambuc // simd.for.inc:
217*0a6a1f1dSLionel Sambuc // CHECK: [[IV3:%.+]] = load i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
218*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[INC:%.+]] = add nsw i64 [[IV3]], 1
219*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[INC]], i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
220*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br label {{%.+}}
221*0a6a1f1dSLionel Sambuc // CHECK: [[T1_END]]
222*0a6a1f1dSLionel Sambuc // CHECK: ret i32 0
223*0a6a1f1dSLionel Sambuc //
inst_templ1()224*0a6a1f1dSLionel Sambuc void inst_templ1() {
225*0a6a1f1dSLionel Sambuc float a;
226*0a6a1f1dSLionel Sambuc float z[100];
227*0a6a1f1dSLionel Sambuc templ1<float,2> (a, z);
228*0a6a1f1dSLionel Sambuc }
229*0a6a1f1dSLionel Sambuc
230*0a6a1f1dSLionel Sambuc
231*0a6a1f1dSLionel Sambuc typedef int MyIdx;
232*0a6a1f1dSLionel Sambuc
233*0a6a1f1dSLionel Sambuc class IterDouble {
234*0a6a1f1dSLionel Sambuc double *Ptr;
235*0a6a1f1dSLionel Sambuc public:
operator ++() const236*0a6a1f1dSLionel Sambuc IterDouble operator++ () const {
237*0a6a1f1dSLionel Sambuc IterDouble n;
238*0a6a1f1dSLionel Sambuc n.Ptr = Ptr + 1;
239*0a6a1f1dSLionel Sambuc return n;
240*0a6a1f1dSLionel Sambuc }
operator <(const IterDouble & that) const241*0a6a1f1dSLionel Sambuc bool operator < (const IterDouble &that) const {
242*0a6a1f1dSLionel Sambuc return Ptr < that.Ptr;
243*0a6a1f1dSLionel Sambuc }
operator *() const244*0a6a1f1dSLionel Sambuc double & operator *() const {
245*0a6a1f1dSLionel Sambuc return *Ptr;
246*0a6a1f1dSLionel Sambuc }
operator -(const IterDouble & that) const247*0a6a1f1dSLionel Sambuc MyIdx operator - (const IterDouble &that) const {
248*0a6a1f1dSLionel Sambuc return (MyIdx) (Ptr - that.Ptr);
249*0a6a1f1dSLionel Sambuc }
operator +(int Delta)250*0a6a1f1dSLionel Sambuc IterDouble operator + (int Delta) {
251*0a6a1f1dSLionel Sambuc IterDouble re;
252*0a6a1f1dSLionel Sambuc re.Ptr = Ptr + Delta;
253*0a6a1f1dSLionel Sambuc return re;
254*0a6a1f1dSLionel Sambuc }
255*0a6a1f1dSLionel Sambuc
256*0a6a1f1dSLionel Sambuc ///~IterDouble() {}
257*0a6a1f1dSLionel Sambuc };
258*0a6a1f1dSLionel Sambuc
259*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*void}} @{{.*}}iter_simple{{.*}}
iter_simple(IterDouble ia,IterDouble ib,IterDouble ic)260*0a6a1f1dSLionel Sambuc void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) {
261*0a6a1f1dSLionel Sambuc //
262*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[IT_OMP_IV:%[^,]+]]
263*0a6a1f1dSLionel Sambuc // Calculate number of iterations before the loop body.
264*0a6a1f1dSLionel Sambuc // CHECK: [[DIFF1:%.+]] = call {{.*}}i32 @{{.*}}IterDouble{{.*}}
265*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1
266*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[DIFF3:%.+]] = add nsw i32 [[DIFF2]], 1
267*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[DIFF4:%.+]] = sdiv i32 [[DIFF3]], 1
268*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[DIFF5:%.+]] = sub nsw i32 [[DIFF4]], 1
269*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[DIFF5]], i32* [[OMP_LAST_IT:%[^,]+]]{{.+}}
270*0a6a1f1dSLionel Sambuc #pragma omp simd
271*0a6a1f1dSLionel Sambuc
272*0a6a1f1dSLionel Sambuc // CHECK: [[IV:%.+]] = load i32* [[IT_OMP_IV]]{{.+}} !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID:[0-9]+]]
273*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LAST_IT:%.+]] = load i32* [[OMP_LAST_IT]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
274*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[NUM_IT:%.+]] = add nsw i32 [[LAST_IT]], 1
275*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP:%.+]] = icmp slt i32 [[IV]], [[NUM_IT]]
276*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP]], label %[[IT_BODY:[^,]+]], label %[[IT_END:[^,]+]]
277*0a6a1f1dSLionel Sambuc for (IterDouble i = ia; i < ib; ++i) {
278*0a6a1f1dSLionel Sambuc // CHECK: [[IT_BODY]]
279*0a6a1f1dSLionel Sambuc // Start of body: calculate i from index:
280*0a6a1f1dSLionel Sambuc // CHECK: [[IV1:%.+]] = load i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
281*0a6a1f1dSLionel Sambuc // Call of operator+ (i, IV).
282*0a6a1f1dSLionel Sambuc // CHECK: {{%.+}} = call {{.+}} @{{.*}}IterDouble{{.*}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
283*0a6a1f1dSLionel Sambuc // ... loop body ...
284*0a6a1f1dSLionel Sambuc *i = *ic * 0.5;
285*0a6a1f1dSLionel Sambuc // Float multiply and save result.
286*0a6a1f1dSLionel Sambuc // CHECK: [[MULR:%.+]] = fmul double {{%.+}}, 5.000000e-01
287*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.+}} @{{.*}}IterDouble{{.*}}
288*0a6a1f1dSLionel Sambuc // CHECK: store double [[MULR:%.+]], double* [[RESULT_ADDR:%.+]], !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
289*0a6a1f1dSLionel Sambuc ++ic;
290*0a6a1f1dSLionel Sambuc //
291*0a6a1f1dSLionel Sambuc // CHECK: [[IV2:%.+]] = load i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
292*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD2:%.+]] = add nsw i32 [[IV2]], 1
293*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD2]], i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
294*0a6a1f1dSLionel Sambuc // br label %{{.*}}, !llvm.loop ![[ITER_LOOP_ID]]
295*0a6a1f1dSLionel Sambuc }
296*0a6a1f1dSLionel Sambuc // CHECK: [[IT_END]]
297*0a6a1f1dSLionel Sambuc // CHECK: ret void
298*0a6a1f1dSLionel Sambuc }
299*0a6a1f1dSLionel Sambuc
300*0a6a1f1dSLionel Sambuc
301*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*void}} @{{.*}}collapsed{{.*}}
collapsed(float * a,float * b,float * c,float * d)302*0a6a1f1dSLionel Sambuc void collapsed(float *a, float *b, float *c, float *d) {
303*0a6a1f1dSLionel Sambuc int i; // outer loop counter
304*0a6a1f1dSLionel Sambuc unsigned j; // middle loop couter, leads to unsigned icmp in loop header.
305*0a6a1f1dSLionel Sambuc // k declared in the loop init below
306*0a6a1f1dSLionel Sambuc short l; // inner loop counter
307*0a6a1f1dSLionel Sambuc // CHECK: store i32 0, i32* [[OMP_IV:[^,]+]]
308*0a6a1f1dSLionel Sambuc //
309*0a6a1f1dSLionel Sambuc #pragma omp simd collapse(4)
310*0a6a1f1dSLionel Sambuc
311*0a6a1f1dSLionel Sambuc // CHECK: [[IV:%.+]] = load i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID:[0-9]+]]
312*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP:%.+]] = icmp ult i32 [[IV]], 120
313*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP]], label %[[COLL1_BODY:[^,]+]], label %[[COLL1_END:[^,]+]]
314*0a6a1f1dSLionel Sambuc for (i = 1; i < 3; i++) // 2 iterations
315*0a6a1f1dSLionel Sambuc for (j = 2u; j < 5u; j++) //3 iterations
316*0a6a1f1dSLionel Sambuc for (int k = 3; k <= 6; k++) // 4 iterations
317*0a6a1f1dSLionel Sambuc for (l = 4; l < 9; ++l) // 5 iterations
318*0a6a1f1dSLionel Sambuc {
319*0a6a1f1dSLionel Sambuc // CHECK: [[COLL1_BODY]]
320*0a6a1f1dSLionel Sambuc // Start of body: calculate i from index:
321*0a6a1f1dSLionel Sambuc // CHECK: [[IV1:%.+]] = load i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
322*0a6a1f1dSLionel Sambuc // Calculation of the loop counters values.
323*0a6a1f1dSLionel Sambuc // CHECK: [[CALC_I_1:%.+]] = udiv i32 [[IV1]], 60
324*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_I_1_MUL1:%.+]] = mul i32 [[CALC_I_1]], 1
325*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_I_2:%.+]] = add i32 1, [[CALC_I_1_MUL1]]
326*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]
327*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_2:%.+]] = load i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
328*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_J_1:%.+]] = udiv i32 [[IV1_2]], 20
329*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_J_2:%.+]] = urem i32 [[CALC_J_1]], 3
330*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_J_2_MUL1:%.+]] = mul i32 [[CALC_J_2]], 1
331*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_J_3:%.+]] = add i32 2, [[CALC_J_2_MUL1]]
332*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[CALC_J_3]], i32* [[LC_J:.+]]
333*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_3:%.+]] = load i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
334*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_K_1:%.+]] = udiv i32 [[IV1_3]], 5
335*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_K_2:%.+]] = urem i32 [[CALC_K_1]], 4
336*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_K_2_MUL1:%.+]] = mul i32 [[CALC_K_2]], 1
337*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_K_3:%.+]] = add i32 3, [[CALC_K_2_MUL1]]
338*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[CALC_K_3]], i32* [[LC_K:.+]]
339*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_4:%.+]] = load i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
340*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_L_1:%.+]] = urem i32 [[IV1_4]], 5
341*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_L_1_MUL1:%.+]] = mul i32 [[CALC_L_1]], 1
342*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_L_2:%.+]] = add i32 4, [[CALC_L_1_MUL1]]
343*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CALC_L_3:%.+]] = trunc i32 [[CALC_L_2]] to i16
344*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i16 [[CALC_L_3]], i16* [[LC_L:.+]]
345*0a6a1f1dSLionel Sambuc // ... loop body ...
346*0a6a1f1dSLionel Sambuc // End of body: store into a[i]:
347*0a6a1f1dSLionel Sambuc // CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
348*0a6a1f1dSLionel Sambuc float res = b[j] * c[k];
349*0a6a1f1dSLionel Sambuc a[i] = res * d[l];
350*0a6a1f1dSLionel Sambuc // CHECK: [[IV2:%.+]] = load i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
351*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD2:%.+]] = add i32 [[IV2]], 1
352*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 [[ADD2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
353*0a6a1f1dSLionel Sambuc // br label %{{[^,]+}}, !llvm.loop ![[COLL1_LOOP_ID]]
354*0a6a1f1dSLionel Sambuc // CHECK: [[COLL1_END]]
355*0a6a1f1dSLionel Sambuc }
356*0a6a1f1dSLionel Sambuc // i,j,l are updated; k is not updated.
357*0a6a1f1dSLionel Sambuc // CHECK: store i32 3, i32* [[I:%[^,]+]]
358*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i32 5, i32* [[I:%[^,]+]]
359*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i16 9, i16* [[I:%[^,]+]]
360*0a6a1f1dSLionel Sambuc // CHECK: ret void
361*0a6a1f1dSLionel Sambuc }
362*0a6a1f1dSLionel Sambuc
363*0a6a1f1dSLionel Sambuc extern char foo();
364*0a6a1f1dSLionel Sambuc
365*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define {{.*void}} @{{.*}}widened{{.*}}
widened(float * a,float * b,float * c,float * d)366*0a6a1f1dSLionel Sambuc void widened(float *a, float *b, float *c, float *d) {
367*0a6a1f1dSLionel Sambuc int i; // outer loop counter
368*0a6a1f1dSLionel Sambuc short j; // inner loop counter
369*0a6a1f1dSLionel Sambuc // Counter is widened to 64 bits.
370*0a6a1f1dSLionel Sambuc // CHECK: store i64 0, i64* [[OMP_IV:[^,]+]]
371*0a6a1f1dSLionel Sambuc //
372*0a6a1f1dSLionel Sambuc #pragma omp simd collapse(2)
373*0a6a1f1dSLionel Sambuc
374*0a6a1f1dSLionel Sambuc // CHECK: [[IV:%.+]] = load i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID:[0-9]+]]
375*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[LI:%.+]] = load i64* [[OMP_LI:%[^,]+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
376*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[NUMIT:%.+]] = add nsw i64 [[LI]], 1
377*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[CMP:%.+]] = icmp slt i64 [[IV]], [[NUMIT]]
378*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[CMP]], label %[[WIDE1_BODY:[^,]+]], label %[[WIDE1_END:[^,]+]]
379*0a6a1f1dSLionel Sambuc for (i = 1; i < 3; i++) // 2 iterations
380*0a6a1f1dSLionel Sambuc for (j = 0; j < foo(); j++) // foo() iterations
381*0a6a1f1dSLionel Sambuc {
382*0a6a1f1dSLionel Sambuc // CHECK: [[WIDE1_BODY]]
383*0a6a1f1dSLionel Sambuc // Start of body: calculate i from index:
384*0a6a1f1dSLionel Sambuc // CHECK: [[IV1:%.+]] = load i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
385*0a6a1f1dSLionel Sambuc // Calculation of the loop counters values...
386*0a6a1f1dSLionel Sambuc // CHECK: store i32 {{[^,]+}}, i32* [[LC_I:.+]]
387*0a6a1f1dSLionel Sambuc // CHECK: [[IV1_2:%.+]] = load i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
388*0a6a1f1dSLionel Sambuc // CHECK: store i16 {{[^,]+}}, i16* [[LC_J:.+]]
389*0a6a1f1dSLionel Sambuc // ... loop body ...
390*0a6a1f1dSLionel Sambuc // End of body: store into a[i]:
391*0a6a1f1dSLionel Sambuc // CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
392*0a6a1f1dSLionel Sambuc float res = b[j] * c[j];
393*0a6a1f1dSLionel Sambuc a[i] = res * d[i];
394*0a6a1f1dSLionel Sambuc // CHECK: [[IV2:%.+]] = load i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
395*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD2:%.+]] = add nsw i64 [[IV2]], 1
396*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store i64 [[ADD2]], i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
397*0a6a1f1dSLionel Sambuc // br label %{{[^,]+}}, !llvm.loop ![[WIDE1_LOOP_ID]]
398*0a6a1f1dSLionel Sambuc // CHECK: [[WIDE1_END]]
399*0a6a1f1dSLionel Sambuc }
400*0a6a1f1dSLionel Sambuc // i,j are updated.
401*0a6a1f1dSLionel Sambuc // CHECK: store i32 3, i32* [[I:%[^,]+]]
402*0a6a1f1dSLionel Sambuc // CHECK: store i16
403*0a6a1f1dSLionel Sambuc // CHECK: ret void
404*0a6a1f1dSLionel Sambuc }
405*0a6a1f1dSLionel Sambuc
406*0a6a1f1dSLionel Sambuc #endif // HEADER
407*0a6a1f1dSLionel Sambuc
408