diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -4627,3 +4627,80 @@ %r = icmp ne i8 %a, 0 ret i1 %r } + +define i1 @mul_add_constant_sgt(i8 %a, i8 %b) { +; CHECK-LABEL: @mul_add_constant_sgt( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw i8 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[ADD:%.*]] = or i8 [[MUL1]], 24 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[ADD]], 0 +; CHECK-NEXT: ret i1 [[CMP]] +; + %mul1 = mul nsw i8 %a, %b + %add = or i8 %mul1, 24 + %cmp = icmp sgt i8 %add, 0 + ret i1 %cmp +} + +define <2 x i1> @mul_add_constant_vec_sgt(<2 x i8> %a, <2 x i8> %b) { +; CHECK-LABEL: @mul_add_constant_vec_sgt( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw <2 x i8> [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[ADD:%.*]] = or <2 x i8> [[MUL1]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt <2 x i8> [[ADD]], zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + + %mul1 = mul nsw <2 x i8> %a, %b + %add = or <2 x i8> %mul1, + %cmp = icmp sgt <2 x i8> %add, + ret <2 x i1> %cmp +} + +define i1 @mul_add_constant_sge(i8 %a, i8 %b) { +; CHECK-LABEL: @mul_add_constant_sge( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw i8 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i8 [[MUL1]], -1 +; CHECK-NEXT: ret i1 [[CMP]] +; + %mul1 = mul nsw i8 %a, %b + %add = or i8 %mul1, 24 + %cmp = icmp sge i8 %add, 0 + ret i1 %cmp +} +define i1 @mul_add_constant_sle(i8 %a, i8 %b) { +; CHECK-LABEL: @mul_add_constant_sle( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw i8 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[ADD:%.*]] = or i8 [[MUL1]], 24 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[ADD]], 1 +; CHECK-NEXT: ret i1 [[CMP]] +; + %mul1 = mul nsw i8 %a, %b + %add = or i8 %mul1, 24 + %cmp = icmp sle i8 %add, 0 + ret i1 %cmp +} + +define <2 x i1> @mul_add_constant_vec_sle(<2 x i8> %a, <2 x i8> %b) { +; CHECK-LABEL: @mul_add_constant_vec_sle( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw <2 x i8> [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[ADD:%.*]] = or <2 x i8> [[MUL1]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <2 x i8> [[ADD]], +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + + %mul1 = mul nsw <2 x i8> %a, %b + %add = or <2 x i8> %mul1, + %cmp = icmp sle <2 x i8> %add, + ret <2 x i1> %cmp +} + +define i1 @mul_add_constant_slt(i8 %a, i8 %b) { +; CHECK-LABEL: @mul_add_constant_slt( +; CHECK-NEXT: [[MUL1:%.*]] = mul nsw i8 [[A:%.*]], [[B:%.*]] +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i8 [[MUL1]], 0 +; CHECK-NEXT: ret i1 [[CMP]] +; + %mul1 = mul nsw i8 %a, %b + %add = or i8 %mul1, 24 + %cmp = icmp slt i8 %add, 0 + ret i1 %cmp +}