1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=loop-vectorize \
3 ; RUN: -force-tail-folding-style=data-with-evl \
4 ; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \
5 ; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=IF-EVL
7 ; RUN: opt -passes=loop-vectorize \
8 ; RUN: -force-tail-folding-style=none \
9 ; RUN: -prefer-predicate-over-epilogue=predicate-dont-vectorize \
10 ; RUN: -mtriple=riscv64 -mattr=+v -S < %s | FileCheck %s --check-prefix=NO-VP
12 define void @reverse_load_store(i64 %startval, ptr noalias %ptr, ptr noalias %ptr2) {
13 ; IF-EVL-LABEL: @reverse_load_store(
15 ; IF-EVL-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
17 ; IF-EVL-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
18 ; IF-EVL-NEXT: [[TMP1:%.*]] = mul i64 [[TMP0]], 4
19 ; IF-EVL-NEXT: [[TMP4:%.*]] = sub i64 [[TMP1]], 1
20 ; IF-EVL-NEXT: [[N_RND_UP:%.*]] = add i64 1024, [[TMP4]]
21 ; IF-EVL-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N_RND_UP]], [[TMP1]]
22 ; IF-EVL-NEXT: [[N_VEC:%.*]] = sub i64 [[N_RND_UP]], [[N_MOD_VF]]
23 ; IF-EVL-NEXT: [[IND_END:%.*]] = sub i64 [[STARTVAL:%.*]], [[N_VEC]]
24 ; IF-EVL-NEXT: [[IND_END1:%.*]] = trunc i64 [[N_VEC]] to i32
25 ; IF-EVL-NEXT: [[TMP5:%.*]] = call i64 @llvm.vscale.i64()
26 ; IF-EVL-NEXT: [[TMP6:%.*]] = mul i64 [[TMP5]], 4
27 ; IF-EVL-NEXT: br label [[VECTOR_BODY:%.*]]
28 ; IF-EVL: vector.body:
29 ; IF-EVL-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
30 ; IF-EVL-NEXT: [[EVL_BASED_IV:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_EVL_NEXT:%.*]], [[VECTOR_BODY]] ]
31 ; IF-EVL-NEXT: [[TMP7:%.*]] = sub i64 1024, [[EVL_BASED_IV]]
32 ; IF-EVL-NEXT: [[TMP8:%.*]] = call i32 @llvm.experimental.get.vector.length.i64(i64 [[TMP7]], i32 4, i1 true)
33 ; IF-EVL-NEXT: [[OFFSET_IDX:%.*]] = sub i64 [[STARTVAL]], [[EVL_BASED_IV]]
34 ; IF-EVL-NEXT: [[TMP9:%.*]] = add i64 [[OFFSET_IDX]], 0
35 ; IF-EVL-NEXT: [[TMP10:%.*]] = add i64 [[TMP9]], -1
36 ; IF-EVL-NEXT: [[TMP11:%.*]] = getelementptr inbounds i32, ptr [[PTR:%.*]], i64 [[TMP10]]
37 ; IF-EVL-NEXT: [[TMP12:%.*]] = call i64 @llvm.vscale.i64()
38 ; IF-EVL-NEXT: [[TMP13:%.*]] = mul i64 [[TMP12]], 4
39 ; IF-EVL-NEXT: [[TMP14:%.*]] = mul i64 0, [[TMP13]]
40 ; IF-EVL-NEXT: [[TMP15:%.*]] = sub i64 1, [[TMP13]]
41 ; IF-EVL-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, ptr [[TMP11]], i64 [[TMP14]]
42 ; IF-EVL-NEXT: [[TMP17:%.*]] = getelementptr inbounds i32, ptr [[TMP16]], i64 [[TMP15]]
43 ; IF-EVL-NEXT: [[VP_OP_LOAD:%.*]] = call <vscale x 4 x i32> @llvm.vp.load.nxv4i32.p0(ptr align 4 [[TMP17]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
44 ; IF-EVL-NEXT: [[VP_REVERSE:%.*]] = call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[VP_OP_LOAD]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
45 ; IF-EVL-NEXT: [[TMP18:%.*]] = getelementptr inbounds i32, ptr [[PTR2:%.*]], i64 [[TMP10]]
46 ; IF-EVL-NEXT: [[TMP19:%.*]] = call i64 @llvm.vscale.i64()
47 ; IF-EVL-NEXT: [[TMP20:%.*]] = mul i64 [[TMP19]], 4
48 ; IF-EVL-NEXT: [[TMP21:%.*]] = mul i64 0, [[TMP20]]
49 ; IF-EVL-NEXT: [[TMP22:%.*]] = sub i64 1, [[TMP20]]
50 ; IF-EVL-NEXT: [[TMP23:%.*]] = getelementptr inbounds i32, ptr [[TMP18]], i64 [[TMP21]]
51 ; IF-EVL-NEXT: [[TMP24:%.*]] = getelementptr inbounds i32, ptr [[TMP23]], i64 [[TMP22]]
52 ; IF-EVL-NEXT: [[VP_REVERSE3:%.*]] = call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[VP_REVERSE]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
53 ; IF-EVL-NEXT: call void @llvm.vp.store.nxv4i32.p0(<vscale x 4 x i32> [[VP_REVERSE3]], ptr align 4 [[TMP24]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
54 ; IF-EVL-NEXT: [[TMP25:%.*]] = zext i32 [[TMP8]] to i64
55 ; IF-EVL-NEXT: [[INDEX_EVL_NEXT]] = add i64 [[TMP25]], [[EVL_BASED_IV]]
56 ; IF-EVL-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], [[TMP6]]
57 ; IF-EVL-NEXT: [[TMP26:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
58 ; IF-EVL-NEXT: br i1 [[TMP26]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP0:![0-9]+]]
59 ; IF-EVL: middle.block:
60 ; IF-EVL-NEXT: br i1 true, label [[LOOPEND:%.*]], label [[SCALAR_PH]]
62 ; IF-EVL-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[IND_END]], [[MIDDLE_BLOCK]] ], [ [[STARTVAL]], [[ENTRY:%.*]] ]
63 ; IF-EVL-NEXT: [[BC_RESUME_VAL2:%.*]] = phi i32 [ [[IND_END1]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
64 ; IF-EVL-NEXT: br label [[FOR_BODY:%.*]]
66 ; IF-EVL-NEXT: [[ADD_PHI:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD:%.*]], [[FOR_BODY]] ]
67 ; IF-EVL-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL2]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
68 ; IF-EVL-NEXT: [[ADD]] = add i64 [[ADD_PHI]], -1
69 ; IF-EVL-NEXT: [[GEPL:%.*]] = getelementptr inbounds i32, ptr [[PTR]], i64 [[ADD]]
70 ; IF-EVL-NEXT: [[TMP:%.*]] = load i32, ptr [[GEPL]], align 4
71 ; IF-EVL-NEXT: [[GEPS:%.*]] = getelementptr inbounds i32, ptr [[PTR2]], i64 [[ADD]]
72 ; IF-EVL-NEXT: store i32 [[TMP]], ptr [[GEPS]], align 4
73 ; IF-EVL-NEXT: [[INC]] = add i32 [[I]], 1
74 ; IF-EVL-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 1024
75 ; IF-EVL-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[LOOPEND]], !llvm.loop [[LOOP3:![0-9]+]]
77 ; IF-EVL-NEXT: ret void
79 ; NO-VP-LABEL: @reverse_load_store(
81 ; NO-VP-NEXT: br label [[FOR_BODY:%.*]]
83 ; NO-VP-NEXT: [[ADD_PHI:%.*]] = phi i64 [ [[STARTVAL:%.*]], [[ENTRY:%.*]] ], [ [[ADD:%.*]], [[FOR_BODY]] ]
84 ; NO-VP-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_BODY]] ]
85 ; NO-VP-NEXT: [[ADD]] = add i64 [[ADD_PHI]], -1
86 ; NO-VP-NEXT: [[GEPL:%.*]] = getelementptr inbounds i32, ptr [[PTR:%.*]], i64 [[ADD]]
87 ; NO-VP-NEXT: [[TMP:%.*]] = load i32, ptr [[GEPL]], align 4
88 ; NO-VP-NEXT: [[GEPS:%.*]] = getelementptr inbounds i32, ptr [[PTR2:%.*]], i64 [[ADD]]
89 ; NO-VP-NEXT: store i32 [[TMP]], ptr [[GEPS]], align 4
90 ; NO-VP-NEXT: [[INC]] = add i32 [[I]], 1
91 ; NO-VP-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 1024
92 ; NO-VP-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[LOOPEND:%.*]]
94 ; NO-VP-NEXT: ret void
100 %add.phi = phi i64 [ %startval, %entry ], [ %add, %for.body ]
101 %i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
102 %add = add i64 %add.phi, -1
103 %gepl = getelementptr inbounds i32, ptr %ptr, i64 %add
104 %tmp = load i32, ptr %gepl, align 4
105 %geps = getelementptr inbounds i32, ptr %ptr2, i64 %add
106 store i32 %tmp, ptr %geps, align 4
108 %exitcond = icmp ne i32 %inc, 1024
109 br i1 %exitcond, label %for.body, label %loopend
115 define void @reverse_load_store_masked(i64 %startval, ptr noalias %ptr, ptr noalias %ptr1, ptr noalias %ptr2) {
116 ; IF-EVL-LABEL: @reverse_load_store_masked(
117 ; IF-EVL-NEXT: entry:
118 ; IF-EVL-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
120 ; IF-EVL-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
121 ; IF-EVL-NEXT: [[TMP1:%.*]] = mul i64 [[TMP0]], 4
122 ; IF-EVL-NEXT: [[TMP4:%.*]] = sub i64 [[TMP1]], 1
123 ; IF-EVL-NEXT: [[N_RND_UP:%.*]] = add i64 1024, [[TMP4]]
124 ; IF-EVL-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N_RND_UP]], [[TMP1]]
125 ; IF-EVL-NEXT: [[N_VEC:%.*]] = sub i64 [[N_RND_UP]], [[N_MOD_VF]]
126 ; IF-EVL-NEXT: [[IND_END:%.*]] = sub i64 [[STARTVAL:%.*]], [[N_VEC]]
127 ; IF-EVL-NEXT: [[IND_END1:%.*]] = trunc i64 [[N_VEC]] to i32
128 ; IF-EVL-NEXT: [[TMP5:%.*]] = call i64 @llvm.vscale.i64()
129 ; IF-EVL-NEXT: [[TMP6:%.*]] = mul i64 [[TMP5]], 4
130 ; IF-EVL-NEXT: br label [[VECTOR_BODY:%.*]]
131 ; IF-EVL: vector.body:
132 ; IF-EVL-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
133 ; IF-EVL-NEXT: [[EVL_BASED_IV:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_EVL_NEXT:%.*]], [[VECTOR_BODY]] ]
134 ; IF-EVL-NEXT: [[TMP7:%.*]] = sub i64 1024, [[EVL_BASED_IV]]
135 ; IF-EVL-NEXT: [[TMP8:%.*]] = call i32 @llvm.experimental.get.vector.length.i64(i64 [[TMP7]], i32 4, i1 true)
136 ; IF-EVL-NEXT: [[OFFSET_IDX:%.*]] = sub i64 [[STARTVAL]], [[EVL_BASED_IV]]
137 ; IF-EVL-NEXT: [[TMP9:%.*]] = add i64 [[OFFSET_IDX]], 0
138 ; IF-EVL-NEXT: [[OFFSET_IDX3:%.*]] = trunc i64 [[EVL_BASED_IV]] to i32
139 ; IF-EVL-NEXT: [[TMP10:%.*]] = add i32 [[OFFSET_IDX3]], 0
140 ; IF-EVL-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <vscale x 4 x i64> poison, i64 [[EVL_BASED_IV]], i64 0
141 ; IF-EVL-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <vscale x 4 x i64> [[BROADCAST_SPLATINSERT]], <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
142 ; IF-EVL-NEXT: [[TMP11:%.*]] = call <vscale x 4 x i64> @llvm.experimental.stepvector.nxv4i64()
143 ; IF-EVL-NEXT: [[TMP12:%.*]] = add <vscale x 4 x i64> zeroinitializer, [[TMP11]]
144 ; IF-EVL-NEXT: [[VEC_IV:%.*]] = add <vscale x 4 x i64> [[BROADCAST_SPLAT]], [[TMP12]]
145 ; IF-EVL-NEXT: [[TMP13:%.*]] = icmp ule <vscale x 4 x i64> [[VEC_IV]], shufflevector (<vscale x 4 x i64> insertelement (<vscale x 4 x i64> poison, i64 1023, i64 0), <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer)
146 ; IF-EVL-NEXT: [[TMP14:%.*]] = add i64 [[TMP9]], -1
147 ; IF-EVL-NEXT: [[TMP15:%.*]] = getelementptr inbounds i32, ptr [[PTR:%.*]], i32 [[TMP10]]
148 ; IF-EVL-NEXT: [[TMP16:%.*]] = getelementptr inbounds i32, ptr [[TMP15]], i32 0
149 ; IF-EVL-NEXT: [[VP_OP_LOAD:%.*]] = call <vscale x 4 x i32> @llvm.vp.load.nxv4i32.p0(ptr align 4 [[TMP16]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
150 ; IF-EVL-NEXT: [[TMP17:%.*]] = icmp slt <vscale x 4 x i32> [[VP_OP_LOAD]], shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 100, i64 0), <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)
151 ; IF-EVL-NEXT: [[TMP18:%.*]] = select <vscale x 4 x i1> [[TMP13]], <vscale x 4 x i1> [[TMP17]], <vscale x 4 x i1> zeroinitializer
152 ; IF-EVL-NEXT: [[TMP19:%.*]] = getelementptr i32, ptr [[PTR1:%.*]], i64 [[TMP14]]
153 ; IF-EVL-NEXT: [[TMP20:%.*]] = call i64 @llvm.vscale.i64()
154 ; IF-EVL-NEXT: [[TMP21:%.*]] = mul i64 [[TMP20]], 4
155 ; IF-EVL-NEXT: [[TMP22:%.*]] = mul i64 0, [[TMP21]]
156 ; IF-EVL-NEXT: [[TMP23:%.*]] = sub i64 1, [[TMP21]]
157 ; IF-EVL-NEXT: [[TMP24:%.*]] = getelementptr i32, ptr [[TMP19]], i64 [[TMP22]]
158 ; IF-EVL-NEXT: [[TMP25:%.*]] = getelementptr i32, ptr [[TMP24]], i64 [[TMP23]]
159 ; IF-EVL-NEXT: [[VP_REVERSE_MASK:%.*]] = call <vscale x 4 x i1> @llvm.experimental.vp.reverse.nxv4i1(<vscale x 4 x i1> [[TMP18]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
160 ; IF-EVL-NEXT: [[VP_OP_LOAD4:%.*]] = call <vscale x 4 x i32> @llvm.vp.load.nxv4i32.p0(ptr align 4 [[TMP25]], <vscale x 4 x i1> [[VP_REVERSE_MASK]], i32 [[TMP8]])
161 ; IF-EVL-NEXT: [[VP_REVERSE:%.*]] = call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[VP_OP_LOAD4]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
162 ; IF-EVL-NEXT: [[TMP26:%.*]] = getelementptr i32, ptr [[PTR2:%.*]], i64 [[TMP14]]
163 ; IF-EVL-NEXT: [[TMP27:%.*]] = call i64 @llvm.vscale.i64()
164 ; IF-EVL-NEXT: [[TMP28:%.*]] = mul i64 [[TMP27]], 4
165 ; IF-EVL-NEXT: [[TMP29:%.*]] = mul i64 0, [[TMP28]]
166 ; IF-EVL-NEXT: [[TMP30:%.*]] = sub i64 1, [[TMP28]]
167 ; IF-EVL-NEXT: [[TMP31:%.*]] = getelementptr i32, ptr [[TMP26]], i64 [[TMP29]]
168 ; IF-EVL-NEXT: [[TMP32:%.*]] = getelementptr i32, ptr [[TMP31]], i64 [[TMP30]]
169 ; IF-EVL-NEXT: [[VP_REVERSE5:%.*]] = call <vscale x 4 x i32> @llvm.experimental.vp.reverse.nxv4i32(<vscale x 4 x i32> [[VP_REVERSE]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
170 ; IF-EVL-NEXT: [[VP_REVERSE_MASK6:%.*]] = call <vscale x 4 x i1> @llvm.experimental.vp.reverse.nxv4i1(<vscale x 4 x i1> [[TMP18]], <vscale x 4 x i1> shufflevector (<vscale x 4 x i1> insertelement (<vscale x 4 x i1> poison, i1 true, i64 0), <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer), i32 [[TMP8]])
171 ; IF-EVL-NEXT: call void @llvm.vp.store.nxv4i32.p0(<vscale x 4 x i32> [[VP_REVERSE5]], ptr align 4 [[TMP32]], <vscale x 4 x i1> [[VP_REVERSE_MASK6]], i32 [[TMP8]])
172 ; IF-EVL-NEXT: [[TMP33:%.*]] = zext i32 [[TMP8]] to i64
173 ; IF-EVL-NEXT: [[INDEX_EVL_NEXT]] = add i64 [[TMP33]], [[EVL_BASED_IV]]
174 ; IF-EVL-NEXT: [[INDEX_NEXT]] = add i64 [[INDEX]], [[TMP6]]
175 ; IF-EVL-NEXT: [[TMP34:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]]
176 ; IF-EVL-NEXT: br i1 [[TMP34]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP4:![0-9]+]]
177 ; IF-EVL: middle.block:
178 ; IF-EVL-NEXT: br i1 true, label [[LOOPEND:%.*]], label [[SCALAR_PH]]
180 ; IF-EVL-NEXT: [[BC_RESUME_VAL:%.*]] = phi i64 [ [[IND_END]], [[MIDDLE_BLOCK]] ], [ [[STARTVAL]], [[ENTRY:%.*]] ]
181 ; IF-EVL-NEXT: [[BC_RESUME_VAL2:%.*]] = phi i32 [ [[IND_END1]], [[MIDDLE_BLOCK]] ], [ 0, [[ENTRY]] ]
182 ; IF-EVL-NEXT: br label [[FOR_BODY:%.*]]
184 ; IF-EVL-NEXT: [[ADD_PHI:%.*]] = phi i64 [ [[BC_RESUME_VAL]], [[SCALAR_PH]] ], [ [[ADD:%.*]], [[FOR_INC:%.*]] ]
185 ; IF-EVL-NEXT: [[I:%.*]] = phi i32 [ [[BC_RESUME_VAL2]], [[SCALAR_PH]] ], [ [[INC:%.*]], [[FOR_INC]] ]
186 ; IF-EVL-NEXT: [[ADD]] = add i64 [[ADD_PHI]], -1
187 ; IF-EVL-NEXT: [[GEPL:%.*]] = getelementptr inbounds i32, ptr [[PTR]], i32 [[I]]
188 ; IF-EVL-NEXT: [[TMP:%.*]] = load i32, ptr [[GEPL]], align 4
189 ; IF-EVL-NEXT: [[CMP1:%.*]] = icmp slt i32 [[TMP]], 100
190 ; IF-EVL-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
192 ; IF-EVL-NEXT: [[GEPL1:%.*]] = getelementptr inbounds i32, ptr [[PTR1]], i64 [[ADD]]
193 ; IF-EVL-NEXT: [[V:%.*]] = load i32, ptr [[GEPL1]], align 4
194 ; IF-EVL-NEXT: [[GEPS:%.*]] = getelementptr inbounds i32, ptr [[PTR2]], i64 [[ADD]]
195 ; IF-EVL-NEXT: store i32 [[V]], ptr [[GEPS]], align 4
196 ; IF-EVL-NEXT: br label [[FOR_INC]]
198 ; IF-EVL-NEXT: [[INC]] = add i32 [[I]], 1
199 ; IF-EVL-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 1024
200 ; IF-EVL-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[LOOPEND]], !llvm.loop [[LOOP5:![0-9]+]]
202 ; IF-EVL-NEXT: ret void
204 ; NO-VP-LABEL: @reverse_load_store_masked(
206 ; NO-VP-NEXT: br label [[FOR_BODY:%.*]]
208 ; NO-VP-NEXT: [[ADD_PHI:%.*]] = phi i64 [ [[STARTVAL:%.*]], [[ENTRY:%.*]] ], [ [[ADD:%.*]], [[FOR_INC:%.*]] ]
209 ; NO-VP-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY]] ], [ [[INC:%.*]], [[FOR_INC]] ]
210 ; NO-VP-NEXT: [[ADD]] = add i64 [[ADD_PHI]], -1
211 ; NO-VP-NEXT: [[GEPL:%.*]] = getelementptr inbounds i32, ptr [[PTR:%.*]], i32 [[I]]
212 ; NO-VP-NEXT: [[TMP:%.*]] = load i32, ptr [[GEPL]], align 4
213 ; NO-VP-NEXT: [[CMP1:%.*]] = icmp slt i32 [[TMP]], 100
214 ; NO-VP-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_INC]]
216 ; NO-VP-NEXT: [[GEPL1:%.*]] = getelementptr inbounds i32, ptr [[PTR1:%.*]], i64 [[ADD]]
217 ; NO-VP-NEXT: [[V:%.*]] = load i32, ptr [[GEPL1]], align 4
218 ; NO-VP-NEXT: [[GEPS:%.*]] = getelementptr inbounds i32, ptr [[PTR2:%.*]], i64 [[ADD]]
219 ; NO-VP-NEXT: store i32 [[V]], ptr [[GEPS]], align 4
220 ; NO-VP-NEXT: br label [[FOR_INC]]
222 ; NO-VP-NEXT: [[INC]] = add i32 [[I]], 1
223 ; NO-VP-NEXT: [[EXITCOND:%.*]] = icmp ne i32 [[INC]], 1024
224 ; NO-VP-NEXT: br i1 [[EXITCOND]], label [[FOR_BODY]], label [[LOOPEND:%.*]]
226 ; NO-VP-NEXT: ret void
232 %add.phi = phi i64 [ %startval, %entry ], [ %add, %for.inc ]
233 %i = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
234 %add = add i64 %add.phi, -1
235 %gepl = getelementptr inbounds i32, ptr %ptr, i32 %i
236 %tmp = load i32, ptr %gepl, align 4
237 %cmp1 = icmp slt i32 %tmp, 100
238 br i1 %cmp1, label %if.then, label %for.inc
241 %gepl1 = getelementptr inbounds i32, ptr %ptr1, i64 %add
242 %v = load i32, ptr %gepl1, align 4
243 %geps = getelementptr inbounds i32, ptr %ptr2, i64 %add
244 store i32 %v, ptr %geps, align 4
249 %exitcond = icmp ne i32 %inc, 1024
250 br i1 %exitcond, label %for.body, label %loopend