}
}
+ // icmp pred (urem X, Y), X
+ if (match(LBO, m_URem(m_Specific(RHS), m_Value()))) {
+ if (Pred == ICmpInst::ICMP_ULE)
+ return getTrue(ITy);
+ if (Pred == ICmpInst::ICMP_UGT)
+ return getFalse(ITy);
+ }
+
// x >> y <=u x
// x udiv y <=u x.
if (match(LBO, m_LShr(m_Specific(RHS), m_Value())) ||
define i1 @urem8(i8 %X, i8 %Y) {
; CHECK-LABEL: @urem8(
-; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT: [[B:%.*]] = icmp ule i8 [[A]], [[X]]
-; CHECK-NEXT: ret i1 [[B]]
+; CHECK-NEXT: ret i1 true
;
%A = urem i8 %X, %Y
%B = icmp ule i8 %A, %X
define i1 @urem9(i8 %X, i8 %Y) {
; CHECK-LABEL: @urem9(
-; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT: [[B:%.*]] = icmp ugt i8 [[A]], [[X]]
-; CHECK-NEXT: ret i1 [[B]]
+; CHECK-NEXT: ret i1 false
;
%A = urem i8 %X, %Y
%B = icmp ugt i8 %A, %X
define i1 @urem10(i8 %X, i8 %Y) {
; CHECK-LABEL: @urem10(
-; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT: [[B:%.*]] = icmp uge i8 [[X]], [[A]]
-; CHECK-NEXT: ret i1 [[B]]
+; CHECK-NEXT: ret i1 true
;
%A = urem i8 %X, %Y
%B = icmp uge i8 %X, %A
define i1 @urem11(i8 %X, i8 %Y) {
; CHECK-LABEL: @urem11(
-; CHECK-NEXT: [[A:%.*]] = urem i8 [[X:%.*]], [[Y:%.*]]
-; CHECK-NEXT: [[B:%.*]] = icmp ult i8 [[X]], [[A]]
-; CHECK-NEXT: ret i1 [[B]]
+; CHECK-NEXT: ret i1 false
;
%A = urem i8 %X, %Y
%B = icmp ult i8 %X, %A