llvm.org GIT mirror llvm / b4824c6
[InstSimplify] add folds for or-of-icmps with same operands All of these (and a few more) are already handled by InstCombine, but we shouldn't have to wait until then to simplify these because they're cheap to deal with here in InstSimplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288833 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 years ago
2 changed file(s) with 93 addition(s) and 200 deletion(s). Raw diff Collapse all Expand all
16991699 RecursionLimit);
17001700 }
17011701
1702 /// Simplify (or (icmp ...) (icmp ...)) to true when we can tell that the union
1703 /// contains all possible values.
1702 /// Commuted variants are assumed to be handled by calling this function again
1703 /// with the parameters swapped.
1704 static Value *simplifyOrOfICmpsWithSameOperands(ICmpInst *Op0, ICmpInst *Op1) {
1705 ICmpInst::Predicate Pred0, Pred1;
1706 Value *A ,*B;
1707 match(Op0, m_ICmp(Pred0, m_Value(A), m_Value(B)));
1708 if (match(Op1, m_ICmp(Pred1, m_Specific(B), m_Specific(A))))
1709 Op1->swapOperands();
1710
1711 if (!match(Op1, m_ICmp(Pred1, m_Specific(A), m_Specific(B))))
1712 return nullptr;
1713
1714 // We have (icmp Pred0, A, B) | (icmp Pred1, A, B).
1715 // If Op1 is always implied true by Op0, then Op0 is a subset of Op1, and we
1716 // can eliminate Op0 from this 'or'.
1717 if (ICmpInst::isImpliedTrueByMatchingCmp(Pred0, Pred1))
1718 return Op1;
1719
1720 // Check for any combination of predicates that cover the entire range of
1721 // possibilities.
1722 if ((Pred0 == ICmpInst::getInversePredicate(Pred1)) ||
1723 (Pred0 == ICmpInst::ICMP_NE && ICmpInst::isTrueWhenEqual(Pred1)) ||
1724 (Pred0 == ICmpInst::ICMP_SLE && Pred1 == ICmpInst::ICMP_SGE) ||
1725 (Pred0 == ICmpInst::ICMP_ULE && Pred1 == ICmpInst::ICMP_UGE))
1726 return getTrue(Op0->getType());
1727
1728 return nullptr;
1729 }
1730
1731 /// Commuted variants are assumed to be handled by calling this function again
1732 /// with the parameters swapped.
17041733 static Value *SimplifyOrOfICmps(ICmpInst *Op0, ICmpInst *Op1) {
17051734 if (Value *X = simplifyUnsignedRangeCheck(Op0, Op1, /*IsAnd=*/false))
1735 return X;
1736
1737 if (Value *X = simplifyOrOfICmpsWithSameOperands(Op0, Op1))
17061738 return X;
17071739
17081740 // (icmp (add V, C0), C1) | (icmp V, C0)
11 ; RUN: opt < %s -instsimplify -S | FileCheck %s
22
33 ; There are 10 * 10 combinations of icmp predicates that can be OR'd together.
4 ; FIXME: The majority of these can be simplified to always true or just one of the icmps.
4 ; The majority of these can be simplified to always true or just one of the icmps.
55
66 define i1 @eq_eq(i8 %a, i8 %b) {
77 ; CHECK-LABEL: @eq_eq(
8 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
98 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
10 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
11 ; CHECK-NEXT: ret i1 [[OR]]
9 ; CHECK-NEXT: ret i1 [[CMP2]]
1210 ;
1311 %cmp1 = icmp eq i8 %a, %b
1412 %cmp2 = icmp eq i8 %a, %b
1816
1917 define i1 @eq_ne(i8 %a, i8 %b) {
2018 ; CHECK-LABEL: @eq_ne(
21 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
22 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
23 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
24 ; CHECK-NEXT: ret i1 [[OR]]
19 ; CHECK-NEXT: ret i1 true
2520 ;
2621 %cmp1 = icmp eq i8 %a, %b
2722 %cmp2 = icmp ne i8 %a, %b
3126
3227 define i1 @eq_sge(i8 %a, i8 %b) {
3328 ; CHECK-LABEL: @eq_sge(
34 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
3529 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
36 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
37 ; CHECK-NEXT: ret i1 [[OR]]
30 ; CHECK-NEXT: ret i1 [[CMP2]]
3831 ;
3932 %cmp1 = icmp eq i8 %a, %b
4033 %cmp2 = icmp sge i8 %a, %b
5750
5851 define i1 @eq_sle(i8 %a, i8 %b) {
5952 ; CHECK-LABEL: @eq_sle(
60 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
6153 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
62 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
63 ; CHECK-NEXT: ret i1 [[OR]]
54 ; CHECK-NEXT: ret i1 [[CMP2]]
6455 ;
6556 %cmp1 = icmp eq i8 %a, %b
6657 %cmp2 = icmp sle i8 %a, %b
8374
8475 define i1 @eq_uge(i8 %a, i8 %b) {
8576 ; CHECK-LABEL: @eq_uge(
86 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
8777 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
88 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
89 ; CHECK-NEXT: ret i1 [[OR]]
78 ; CHECK-NEXT: ret i1 [[CMP2]]
9079 ;
9180 %cmp1 = icmp eq i8 %a, %b
9281 %cmp2 = icmp uge i8 %a, %b
10998
11099 define i1 @eq_ule(i8 %a, i8 %b) {
111100 ; CHECK-LABEL: @eq_ule(
112 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 %a, %b
113101 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
114 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
115 ; CHECK-NEXT: ret i1 [[OR]]
102 ; CHECK-NEXT: ret i1 [[CMP2]]
116103 ;
117104 %cmp1 = icmp eq i8 %a, %b
118105 %cmp2 = icmp ule i8 %a, %b
137124
138125 define i1 @ne_eq(i8 %a, i8 %b) {
139126 ; CHECK-LABEL: @ne_eq(
140 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
141 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
142 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
143 ; CHECK-NEXT: ret i1 [[OR]]
127 ; CHECK-NEXT: ret i1 true
144128 ;
145129 %cmp1 = icmp ne i8 %a, %b
146130 %cmp2 = icmp eq i8 %a, %b
150134
151135 define i1 @ne_ne(i8 %a, i8 %b) {
152136 ; CHECK-LABEL: @ne_ne(
153 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
154137 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
155 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
156 ; CHECK-NEXT: ret i1 [[OR]]
138 ; CHECK-NEXT: ret i1 [[CMP2]]
157139 ;
158140 %cmp1 = icmp ne i8 %a, %b
159141 %cmp2 = icmp ne i8 %a, %b
163145
164146 define i1 @ne_sge(i8 %a, i8 %b) {
165147 ; CHECK-LABEL: @ne_sge(
166 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
167 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
168 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
169 ; CHECK-NEXT: ret i1 [[OR]]
148 ; CHECK-NEXT: ret i1 true
170149 ;
171150 %cmp1 = icmp ne i8 %a, %b
172151 %cmp2 = icmp sge i8 %a, %b
177156 define i1 @ne_sgt(i8 %a, i8 %b) {
178157 ; CHECK-LABEL: @ne_sgt(
179158 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
180 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
181 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
182 ; CHECK-NEXT: ret i1 [[OR]]
159 ; CHECK-NEXT: ret i1 [[CMP1]]
183160 ;
184161 %cmp1 = icmp ne i8 %a, %b
185162 %cmp2 = icmp sgt i8 %a, %b
189166
190167 define i1 @ne_sle(i8 %a, i8 %b) {
191168 ; CHECK-LABEL: @ne_sle(
192 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
193 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
194 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
195 ; CHECK-NEXT: ret i1 [[OR]]
169 ; CHECK-NEXT: ret i1 true
196170 ;
197171 %cmp1 = icmp ne i8 %a, %b
198172 %cmp2 = icmp sle i8 %a, %b
203177 define i1 @ne_slt(i8 %a, i8 %b) {
204178 ; CHECK-LABEL: @ne_slt(
205179 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
206 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
207 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
208 ; CHECK-NEXT: ret i1 [[OR]]
180 ; CHECK-NEXT: ret i1 [[CMP1]]
209181 ;
210182 %cmp1 = icmp ne i8 %a, %b
211183 %cmp2 = icmp slt i8 %a, %b
215187
216188 define i1 @ne_uge(i8 %a, i8 %b) {
217189 ; CHECK-LABEL: @ne_uge(
218 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
219 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
220 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
221 ; CHECK-NEXT: ret i1 [[OR]]
190 ; CHECK-NEXT: ret i1 true
222191 ;
223192 %cmp1 = icmp ne i8 %a, %b
224193 %cmp2 = icmp uge i8 %a, %b
229198 define i1 @ne_ugt(i8 %a, i8 %b) {
230199 ; CHECK-LABEL: @ne_ugt(
231200 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
232 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
233 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
234 ; CHECK-NEXT: ret i1 [[OR]]
201 ; CHECK-NEXT: ret i1 [[CMP1]]
235202 ;
236203 %cmp1 = icmp ne i8 %a, %b
237204 %cmp2 = icmp ugt i8 %a, %b
241208
242209 define i1 @ne_ule(i8 %a, i8 %b) {
243210 ; CHECK-LABEL: @ne_ule(
244 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
245 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
246 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
247 ; CHECK-NEXT: ret i1 [[OR]]
211 ; CHECK-NEXT: ret i1 true
248212 ;
249213 %cmp1 = icmp ne i8 %a, %b
250214 %cmp2 = icmp ule i8 %a, %b
255219 define i1 @ne_ult(i8 %a, i8 %b) {
256220 ; CHECK-LABEL: @ne_ult(
257221 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 %a, %b
258 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
259 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
260 ; CHECK-NEXT: ret i1 [[OR]]
222 ; CHECK-NEXT: ret i1 [[CMP1]]
261223 ;
262224 %cmp1 = icmp ne i8 %a, %b
263225 %cmp2 = icmp ult i8 %a, %b
270232 define i1 @sge_eq(i8 %a, i8 %b) {
271233 ; CHECK-LABEL: @sge_eq(
272234 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
273 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
274 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
275 ; CHECK-NEXT: ret i1 [[OR]]
235 ; CHECK-NEXT: ret i1 [[CMP1]]
276236 ;
277237 %cmp1 = icmp sge i8 %a, %b
278238 %cmp2 = icmp eq i8 %a, %b
282242
283243 define i1 @sge_ne(i8 %a, i8 %b) {
284244 ; CHECK-LABEL: @sge_ne(
285 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
286 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
287 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
288 ; CHECK-NEXT: ret i1 [[OR]]
245 ; CHECK-NEXT: ret i1 true
289246 ;
290247 %cmp1 = icmp sge i8 %a, %b
291248 %cmp2 = icmp ne i8 %a, %b
295252
296253 define i1 @sge_sge(i8 %a, i8 %b) {
297254 ; CHECK-LABEL: @sge_sge(
298 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
299255 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
300 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
301 ; CHECK-NEXT: ret i1 [[OR]]
256 ; CHECK-NEXT: ret i1 [[CMP2]]
302257 ;
303258 %cmp1 = icmp sge i8 %a, %b
304259 %cmp2 = icmp sge i8 %a, %b
309264 define i1 @sge_sgt(i8 %a, i8 %b) {
310265 ; CHECK-LABEL: @sge_sgt(
311266 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
312 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
313 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
314 ; CHECK-NEXT: ret i1 [[OR]]
267 ; CHECK-NEXT: ret i1 [[CMP1]]
315268 ;
316269 %cmp1 = icmp sge i8 %a, %b
317270 %cmp2 = icmp sgt i8 %a, %b
321274
322275 define i1 @sge_sle(i8 %a, i8 %b) {
323276 ; CHECK-LABEL: @sge_sle(
324 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
325 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
326 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
327 ; CHECK-NEXT: ret i1 [[OR]]
277 ; CHECK-NEXT: ret i1 true
328278 ;
329279 %cmp1 = icmp sge i8 %a, %b
330280 %cmp2 = icmp sle i8 %a, %b
334284
335285 define i1 @sge_slt(i8 %a, i8 %b) {
336286 ; CHECK-LABEL: @sge_slt(
337 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sge i8 %a, %b
338 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
339 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
340 ; CHECK-NEXT: ret i1 [[OR]]
287 ; CHECK-NEXT: ret i1 true
341288 ;
342289 %cmp1 = icmp sge i8 %a, %b
343290 %cmp2 = icmp slt i8 %a, %b
414361
415362 define i1 @sgt_ne(i8 %a, i8 %b) {
416363 ; CHECK-LABEL: @sgt_ne(
417 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
418364 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
419 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
420 ; CHECK-NEXT: ret i1 [[OR]]
365 ; CHECK-NEXT: ret i1 [[CMP2]]
421366 ;
422367 %cmp1 = icmp sgt i8 %a, %b
423368 %cmp2 = icmp ne i8 %a, %b
427372
428373 define i1 @sgt_sge(i8 %a, i8 %b) {
429374 ; CHECK-LABEL: @sgt_sge(
430 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
431375 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
432 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
433 ; CHECK-NEXT: ret i1 [[OR]]
376 ; CHECK-NEXT: ret i1 [[CMP2]]
434377 ;
435378 %cmp1 = icmp sgt i8 %a, %b
436379 %cmp2 = icmp sge i8 %a, %b
440383
441384 define i1 @sgt_sgt(i8 %a, i8 %b) {
442385 ; CHECK-LABEL: @sgt_sgt(
443 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
444386 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
445 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
446 ; CHECK-NEXT: ret i1 [[OR]]
387 ; CHECK-NEXT: ret i1 [[CMP2]]
447388 ;
448389 %cmp1 = icmp sgt i8 %a, %b
449390 %cmp2 = icmp sgt i8 %a, %b
453394
454395 define i1 @sgt_sle(i8 %a, i8 %b) {
455396 ; CHECK-LABEL: @sgt_sle(
456 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i8 %a, %b
457 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
458 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
459 ; CHECK-NEXT: ret i1 [[OR]]
397 ; CHECK-NEXT: ret i1 true
460398 ;
461399 %cmp1 = icmp sgt i8 %a, %b
462400 %cmp2 = icmp sle i8 %a, %b
534472 define i1 @sle_eq(i8 %a, i8 %b) {
535473 ; CHECK-LABEL: @sle_eq(
536474 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
537 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
538 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
539 ; CHECK-NEXT: ret i1 [[OR]]
475 ; CHECK-NEXT: ret i1 [[CMP1]]
540476 ;
541477 %cmp1 = icmp sle i8 %a, %b
542478 %cmp2 = icmp eq i8 %a, %b
546482
547483 define i1 @sle_ne(i8 %a, i8 %b) {
548484 ; CHECK-LABEL: @sle_ne(
549 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
550 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
551 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
552 ; CHECK-NEXT: ret i1 [[OR]]
485 ; CHECK-NEXT: ret i1 true
553486 ;
554487 %cmp1 = icmp sle i8 %a, %b
555488 %cmp2 = icmp ne i8 %a, %b
559492
560493 define i1 @sle_sge(i8 %a, i8 %b) {
561494 ; CHECK-LABEL: @sle_sge(
562 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
563 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
564 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
565 ; CHECK-NEXT: ret i1 [[OR]]
495 ; CHECK-NEXT: ret i1 true
566496 ;
567497 %cmp1 = icmp sle i8 %a, %b
568498 %cmp2 = icmp sge i8 %a, %b
572502
573503 define i1 @sle_sgt(i8 %a, i8 %b) {
574504 ; CHECK-LABEL: @sle_sgt(
575 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
576 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i8 %a, %b
577 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
578 ; CHECK-NEXT: ret i1 [[OR]]
505 ; CHECK-NEXT: ret i1 true
579506 ;
580507 %cmp1 = icmp sle i8 %a, %b
581508 %cmp2 = icmp sgt i8 %a, %b
585512
586513 define i1 @sle_sle(i8 %a, i8 %b) {
587514 ; CHECK-LABEL: @sle_sle(
588 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
589515 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
590 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
591 ; CHECK-NEXT: ret i1 [[OR]]
516 ; CHECK-NEXT: ret i1 [[CMP2]]
592517 ;
593518 %cmp1 = icmp sle i8 %a, %b
594519 %cmp2 = icmp sle i8 %a, %b
599524 define i1 @sle_slt(i8 %a, i8 %b) {
600525 ; CHECK-LABEL: @sle_slt(
601526 ; CHECK-NEXT: [[CMP1:%.*]] = icmp sle i8 %a, %b
602 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
603 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
604 ; CHECK-NEXT: ret i1 [[OR]]
527 ; CHECK-NEXT: ret i1 [[CMP1]]
605528 ;
606529 %cmp1 = icmp sle i8 %a, %b
607530 %cmp2 = icmp slt i8 %a, %b
678601
679602 define i1 @slt_ne(i8 %a, i8 %b) {
680603 ; CHECK-LABEL: @slt_ne(
681 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
682604 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
683 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
684 ; CHECK-NEXT: ret i1 [[OR]]
605 ; CHECK-NEXT: ret i1 [[CMP2]]
685606 ;
686607 %cmp1 = icmp slt i8 %a, %b
687608 %cmp2 = icmp ne i8 %a, %b
691612
692613 define i1 @slt_sge(i8 %a, i8 %b) {
693614 ; CHECK-LABEL: @slt_sge(
694 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
695 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i8 %a, %b
696 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
697 ; CHECK-NEXT: ret i1 [[OR]]
615 ; CHECK-NEXT: ret i1 true
698616 ;
699617 %cmp1 = icmp slt i8 %a, %b
700618 %cmp2 = icmp sge i8 %a, %b
717635
718636 define i1 @slt_sle(i8 %a, i8 %b) {
719637 ; CHECK-LABEL: @slt_sle(
720 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
721638 ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i8 %a, %b
722 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
723 ; CHECK-NEXT: ret i1 [[OR]]
639 ; CHECK-NEXT: ret i1 [[CMP2]]
724640 ;
725641 %cmp1 = icmp slt i8 %a, %b
726642 %cmp2 = icmp sle i8 %a, %b
730646
731647 define i1 @slt_slt(i8 %a, i8 %b) {
732648 ; CHECK-LABEL: @slt_slt(
733 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i8 %a, %b
734649 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i8 %a, %b
735 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
736 ; CHECK-NEXT: ret i1 [[OR]]
650 ; CHECK-NEXT: ret i1 [[CMP2]]
737651 ;
738652 %cmp1 = icmp slt i8 %a, %b
739653 %cmp2 = icmp slt i8 %a, %b
798712 define i1 @uge_eq(i8 %a, i8 %b) {
799713 ; CHECK-LABEL: @uge_eq(
800714 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
801 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
802 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
803 ; CHECK-NEXT: ret i1 [[OR]]
715 ; CHECK-NEXT: ret i1 [[CMP1]]
804716 ;
805717 %cmp1 = icmp uge i8 %a, %b
806718 %cmp2 = icmp eq i8 %a, %b
810722
811723 define i1 @uge_ne(i8 %a, i8 %b) {
812724 ; CHECK-LABEL: @uge_ne(
813 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
814 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
815 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
816 ; CHECK-NEXT: ret i1 [[OR]]
725 ; CHECK-NEXT: ret i1 true
817726 ;
818727 %cmp1 = icmp uge i8 %a, %b
819728 %cmp2 = icmp ne i8 %a, %b
875784
876785 define i1 @uge_uge(i8 %a, i8 %b) {
877786 ; CHECK-LABEL: @uge_uge(
878 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
879787 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
880 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
881 ; CHECK-NEXT: ret i1 [[OR]]
788 ; CHECK-NEXT: ret i1 [[CMP2]]
882789 ;
883790 %cmp1 = icmp uge i8 %a, %b
884791 %cmp2 = icmp uge i8 %a, %b
889796 define i1 @uge_ugt(i8 %a, i8 %b) {
890797 ; CHECK-LABEL: @uge_ugt(
891798 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
892 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
893 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
894 ; CHECK-NEXT: ret i1 [[OR]]
799 ; CHECK-NEXT: ret i1 [[CMP1]]
895800 ;
896801 %cmp1 = icmp uge i8 %a, %b
897802 %cmp2 = icmp ugt i8 %a, %b
901806
902807 define i1 @uge_ule(i8 %a, i8 %b) {
903808 ; CHECK-LABEL: @uge_ule(
904 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
905 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
906 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
907 ; CHECK-NEXT: ret i1 [[OR]]
809 ; CHECK-NEXT: ret i1 true
908810 ;
909811 %cmp1 = icmp uge i8 %a, %b
910812 %cmp2 = icmp ule i8 %a, %b
914816
915817 define i1 @uge_ult(i8 %a, i8 %b) {
916818 ; CHECK-LABEL: @uge_ult(
917 ; CHECK-NEXT: [[CMP1:%.*]] = icmp uge i8 %a, %b
918 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
919 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
920 ; CHECK-NEXT: ret i1 [[OR]]
819 ; CHECK-NEXT: ret i1 true
921820 ;
922821 %cmp1 = icmp uge i8 %a, %b
923822 %cmp2 = icmp ult i8 %a, %b
942841
943842 define i1 @ugt_ne(i8 %a, i8 %b) {
944843 ; CHECK-LABEL: @ugt_ne(
945 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
946844 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
947 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
948 ; CHECK-NEXT: ret i1 [[OR]]
845 ; CHECK-NEXT: ret i1 [[CMP2]]
949846 ;
950847 %cmp1 = icmp ugt i8 %a, %b
951848 %cmp2 = icmp ne i8 %a, %b
1007904
1008905 define i1 @ugt_uge(i8 %a, i8 %b) {
1009906 ; CHECK-LABEL: @ugt_uge(
1010 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
1011907 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
1012 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1013 ; CHECK-NEXT: ret i1 [[OR]]
908 ; CHECK-NEXT: ret i1 [[CMP2]]
1014909 ;
1015910 %cmp1 = icmp ugt i8 %a, %b
1016911 %cmp2 = icmp uge i8 %a, %b
1020915
1021916 define i1 @ugt_ugt(i8 %a, i8 %b) {
1022917 ; CHECK-LABEL: @ugt_ugt(
1023 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
1024918 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
1025 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1026 ; CHECK-NEXT: ret i1 [[OR]]
919 ; CHECK-NEXT: ret i1 [[CMP2]]
1027920 ;
1028921 %cmp1 = icmp ugt i8 %a, %b
1029922 %cmp2 = icmp ugt i8 %a, %b
1033926
1034927 define i1 @ugt_ule(i8 %a, i8 %b) {
1035928 ; CHECK-LABEL: @ugt_ule(
1036 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ugt i8 %a, %b
1037 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
1038 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1039 ; CHECK-NEXT: ret i1 [[OR]]
929 ; CHECK-NEXT: ret i1 true
1040930 ;
1041931 %cmp1 = icmp ugt i8 %a, %b
1042932 %cmp2 = icmp ule i8 %a, %b
1062952 define i1 @ule_eq(i8 %a, i8 %b) {
1063953 ; CHECK-LABEL: @ule_eq(
1064954 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
1065 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i8 %a, %b
1066 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1067 ; CHECK-NEXT: ret i1 [[OR]]
955 ; CHECK-NEXT: ret i1 [[CMP1]]
1068956 ;
1069957 %cmp1 = icmp ule i8 %a, %b
1070958 %cmp2 = icmp eq i8 %a, %b
1074962
1075963 define i1 @ule_ne(i8 %a, i8 %b) {
1076964 ; CHECK-LABEL: @ule_ne(
1077 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
1078 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
1079 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1080 ; CHECK-NEXT: ret i1 [[OR]]
965 ; CHECK-NEXT: ret i1 true
1081966 ;
1082967 %cmp1 = icmp ule i8 %a, %b
1083968 %cmp2 = icmp ne i8 %a, %b
11391024
11401025 define i1 @ule_uge(i8 %a, i8 %b) {
11411026 ; CHECK-LABEL: @ule_uge(
1142 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
1143 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
1144 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1145 ; CHECK-NEXT: ret i1 [[OR]]
1027 ; CHECK-NEXT: ret i1 true
11461028 ;
11471029 %cmp1 = icmp ule i8 %a, %b
11481030 %cmp2 = icmp uge i8 %a, %b
11521034
11531035 define i1 @ule_ugt(i8 %a, i8 %b) {
11541036 ; CHECK-LABEL: @ule_ugt(
1155 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
1156 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ugt i8 %a, %b
1157 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1158 ; CHECK-NEXT: ret i1 [[OR]]
1037 ; CHECK-NEXT: ret i1 true
11591038 ;
11601039 %cmp1 = icmp ule i8 %a, %b
11611040 %cmp2 = icmp ugt i8 %a, %b
11651044
11661045 define i1 @ule_ule(i8 %a, i8 %b) {
11671046 ; CHECK-LABEL: @ule_ule(
1168 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
11691047 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
1170 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1171 ; CHECK-NEXT: ret i1 [[OR]]
1048 ; CHECK-NEXT: ret i1 [[CMP2]]
11721049 ;
11731050 %cmp1 = icmp ule i8 %a, %b
11741051 %cmp2 = icmp ule i8 %a, %b
11791056 define i1 @ule_ult(i8 %a, i8 %b) {
11801057 ; CHECK-LABEL: @ule_ult(
11811058 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ule i8 %a, %b
1182 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
1183 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1184 ; CHECK-NEXT: ret i1 [[OR]]
1059 ; CHECK-NEXT: ret i1 [[CMP1]]
11851060 ;
11861061 %cmp1 = icmp ule i8 %a, %b
11871062 %cmp2 = icmp ult i8 %a, %b
12061081
12071082 define i1 @ult_ne(i8 %a, i8 %b) {
12081083 ; CHECK-LABEL: @ult_ne(
1209 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
12101084 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i8 %a, %b
1211 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1212 ; CHECK-NEXT: ret i1 [[OR]]
1085 ; CHECK-NEXT: ret i1 [[CMP2]]
12131086 ;
12141087 %cmp1 = icmp ult i8 %a, %b
12151088 %cmp2 = icmp ne i8 %a, %b
12711144
12721145 define i1 @ult_uge(i8 %a, i8 %b) {
12731146 ; CHECK-LABEL: @ult_uge(
1274 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
1275 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge i8 %a, %b
1276 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1277 ; CHECK-NEXT: ret i1 [[OR]]
1147 ; CHECK-NEXT: ret i1 true
12781148 ;
12791149 %cmp1 = icmp ult i8 %a, %b
12801150 %cmp2 = icmp uge i8 %a, %b
12971167
12981168 define i1 @ult_ule(i8 %a, i8 %b) {
12991169 ; CHECK-LABEL: @ult_ule(
1300 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
13011170 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule i8 %a, %b
1302 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1303 ; CHECK-NEXT: ret i1 [[OR]]
1171 ; CHECK-NEXT: ret i1 [[CMP2]]
13041172 ;
13051173 %cmp1 = icmp ult i8 %a, %b
13061174 %cmp2 = icmp ule i8 %a, %b
13101178
13111179 define i1 @ult_ult(i8 %a, i8 %b) {
13121180 ; CHECK-LABEL: @ult_ult(
1313 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i8 %a, %b
13141181 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i8 %a, %b
1315 ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
1316 ; CHECK-NEXT: ret i1 [[OR]]
1182 ; CHECK-NEXT: ret i1 [[CMP2]]
13171183 ;
13181184 %cmp1 = icmp ult i8 %a, %b
13191185 %cmp2 = icmp ult i8 %a, %b
13251191
13261192 define <2 x i1> @ult_uge_vec(<2 x i8> %a, <2 x i8> %b) {
13271193 ; CHECK-LABEL: @ult_uge_vec(
1328 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult <2 x i8> %a, %b
1329 ; CHECK-NEXT: [[CMP2:%.*]] = icmp uge <2 x i8> %a, %b
1330 ; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[CMP1]], [[CMP2]]
1331 ; CHECK-NEXT: ret <2 x i1> [[OR]]
1194 ; CHECK-NEXT: ret <2 x i1>
13321195 ;
13331196 %cmp1 = icmp ult <2 x i8> %a, %b
13341197 %cmp2 = icmp uge <2 x i8> %a, %b
13381201
13391202 define <2 x i1> @ult_ule_vec(<2 x i8> %a, <2 x i8> %b) {
13401203 ; CHECK-LABEL: @ult_ule_vec(
1341 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult <2 x i8> %a, %b
13421204 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ule <2 x i8> %a, %b
1343 ; CHECK-NEXT: [[OR:%.*]] = or <2 x i1> [[CMP1]], [[CMP2]]
1344 ; CHECK-NEXT: ret <2 x i1> [[OR]]
1205 ; CHECK-NEXT: ret <2 x i1> [[CMP2]]
13451206 ;
13461207 %cmp1 = icmp ult <2 x i8> %a, %b
13471208 %cmp2 = icmp ule <2 x i8> %a, %b