llvm.org GIT mirror llvm / 656a511
[InstSimplify] add vector splat tests for or-of-icmps git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282591 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 3 years ago
1 changed file(s) with 92 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
169169 ret <2 x i1> %cmp
170170 }
171171
172 ; FIXME: Vector splats should fold the same way as scalars in the next 6 pairs of tests.
173
172174 define i1 @or_of_icmps0(i32 %b) {
173175 ; CHECK-LABEL: @or_of_icmps0(
174176 ; CHECK-NEXT: ret i1 true
180182 ret i1 %cmp
181183 }
182184
185 define <2 x i1> @or_of_icmps0_vec(<2 x i32> %b) {
186 ; CHECK-LABEL: @or_of_icmps0_vec(
187 ; CHECK-NEXT: [[TMP1:%.*]] = add <2 x i32> %b,
188 ; CHECK-NEXT: [[TMP2:%.*]] = icmp uge <2 x i32> [[TMP1]],
189 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sle <2 x i32> %b,
190 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
191 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
192 ;
193 %1 = add <2 x i32> %b,
194 %2 = icmp uge <2 x i32> %1,
195 %cmp3 = icmp sle <2 x i32> %b,
196 %cmp = or <2 x i1> %2, %cmp3
197 ret <2 x i1> %cmp
198 }
199
183200 define i1 @or_of_icmps1(i32 %b) {
184201 ; CHECK-LABEL: @or_of_icmps1(
185202 ; CHECK-NEXT: ret i1 true
191208 ret i1 %cmp
192209 }
193210
211 define <2 x i1> @or_of_icmps1_vec(<2 x i32> %b) {
212 ; CHECK-LABEL: @or_of_icmps1_vec(
213 ; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> %b,
214 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sge <2 x i32> [[TMP1]],
215 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sle <2 x i32> %b,
216 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
217 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
218 ;
219 %1 = add nsw <2 x i32> %b,
220 %2 = icmp sge <2 x i32> %1,
221 %cmp3 = icmp sle <2 x i32> %b,
222 %cmp = or <2 x i1> %2, %cmp3
223 ret <2 x i1> %cmp
224 }
225
194226 define i1 @or_of_icmps2(i32 %b) {
195227 ; CHECK-LABEL: @or_of_icmps2(
196228 ; CHECK-NEXT: ret i1 true
202234 ret i1 %cmp
203235 }
204236
237 define <2 x i1> @or_of_icmps2_vec(<2 x i32> %b) {
238 ; CHECK-LABEL: @or_of_icmps2_vec(
239 ; CHECK-NEXT: [[TMP1:%.*]] = add <2 x i32> %b,
240 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt <2 x i32> [[TMP1]],
241 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sle <2 x i32> %b,
242 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
243 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
244 ;
245 %1 = add <2 x i32> %b,
246 %2 = icmp ugt <2 x i32> %1,
247 %cmp3 = icmp sle <2 x i32> %b,
248 %cmp = or <2 x i1> %2, %cmp3
249 ret <2 x i1> %cmp
250 }
251
205252 define i1 @or_of_icmps3(i32 %b) {
206253 ; CHECK-LABEL: @or_of_icmps3(
207254 ; CHECK-NEXT: ret i1 true
213260 ret i1 %cmp
214261 }
215262
263 define <2 x i1> @or_of_icmps3_vec(<2 x i32> %b) {
264 ; CHECK-LABEL: @or_of_icmps3_vec(
265 ; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> %b,
266 ; CHECK-NEXT: [[TMP2:%.*]] = icmp sgt <2 x i32> [[TMP1]],
267 ; CHECK-NEXT: [[CMP3:%.*]] = icmp sle <2 x i32> %b,
268 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
269 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
270 ;
271 %1 = add nsw <2 x i32> %b,
272 %2 = icmp sgt <2 x i32> %1,
273 %cmp3 = icmp sle <2 x i32> %b,
274 %cmp = or <2 x i1> %2, %cmp3
275 ret <2 x i1> %cmp
276 }
277
216278 define i1 @or_of_icmps4(i32 %b) {
217279 ; CHECK-LABEL: @or_of_icmps4(
218280 ; CHECK-NEXT: ret i1 true
224286 ret i1 %cmp
225287 }
226288
289 define <2 x i1> @or_of_icmps4_vec(<2 x i32> %b) {
290 ; CHECK-LABEL: @or_of_icmps4_vec(
291 ; CHECK-NEXT: [[TMP1:%.*]] = add nuw <2 x i32> %b,
292 ; CHECK-NEXT: [[TMP2:%.*]] = icmp uge <2 x i32> [[TMP1]],
293 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ule <2 x i32> %b,
294 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
295 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
296 ;
297 %1 = add nuw <2 x i32> %b,
298 %2 = icmp uge <2 x i32> %1,
299 %cmp3 = icmp ule <2 x i32> %b,
300 %cmp = or <2 x i1> %2, %cmp3
301 ret <2 x i1> %cmp
302 }
303
227304 define i1 @or_of_icmps5(i32 %b) {
228305 ; CHECK-LABEL: @or_of_icmps5(
229306 ; CHECK-NEXT: ret i1 true
233310 %cmp3 = icmp ule i32 %b, 2
234311 %cmp = or i1 %2, %cmp3
235312 ret i1 %cmp
313 }
314
315 define <2 x i1> @or_of_icmps5_vec(<2 x i32> %b) {
316 ; CHECK-LABEL: @or_of_icmps5_vec(
317 ; CHECK-NEXT: [[TMP1:%.*]] = add nuw <2 x i32> %b,
318 ; CHECK-NEXT: [[TMP2:%.*]] = icmp ugt <2 x i32> [[TMP1]],
319 ; CHECK-NEXT: [[CMP3:%.*]] = icmp ule <2 x i32> %b,
320 ; CHECK-NEXT: [[CMP:%.*]] = or <2 x i1> [[TMP2]], [[CMP:%.*]]3
321 ; CHECK-NEXT: ret <2 x i1> [[CMP]]
322 ;
323 %1 = add nuw <2 x i32> %b,
324 %2 = icmp ugt <2 x i32> %1,
325 %cmp3 = icmp ule <2 x i32> %b,
326 %cmp = or <2 x i1> %2, %cmp3
327 ret <2 x i1> %cmp
236328 }
237329
238330 define i32 @neg_nuw(i32 %x) {