diff --git a/llvm/test/Transforms/InstCombine/icmp-ext-ext.ll b/llvm/test/Transforms/InstCombine/icmp-ext-ext.ll --- a/llvm/test/Transforms/InstCombine/icmp-ext-ext.ll +++ b/llvm/test/Transforms/InstCombine/icmp-ext-ext.ll @@ -380,3 +380,43 @@ %c = icmp uge i32 %a, %b ret i1 %c } + + +define i1 @zext_eq_sext(i1 %a, i1 %b) { +; CHECK-LABEL: @zext_eq_sext( +; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[A:%.*]] to i32 +; CHECK-NEXT: [[CONV3_NEG:%.*]] = sext i1 [[B:%.*]] to i32 +; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[CONV]], [[CONV3_NEG]] +; CHECK-NEXT: ret i1 [[TOBOOL4]] +; + %conv = zext i1 %a to i32 + %conv3.neg = sext i1 %b to i32 + %tobool4 = icmp eq i32 %conv, %conv3.neg + ret i1 %tobool4 +} + +define i1 @zext_eq_sext_fail_not_i1(i1 %a, i8 %b) { +; CHECK-LABEL: @zext_eq_sext_fail_not_i1( +; CHECK-NEXT: [[CONV:%.*]] = zext i1 [[A:%.*]] to i32 +; CHECK-NEXT: [[CONV3_NEG:%.*]] = sext i8 [[B:%.*]] to i32 +; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp eq i32 [[CONV]], [[CONV3_NEG]] +; CHECK-NEXT: ret i1 [[TOBOOL4]] +; + %conv = zext i1 %a to i32 + %conv3.neg = sext i8 %b to i32 + %tobool4 = icmp eq i32 %conv, %conv3.neg + ret i1 %tobool4 +} + +define <2 x i1> @zext_ne_sext(<2 x i1> %a, <2 x i1> %b) { +; CHECK-LABEL: @zext_ne_sext( +; CHECK-NEXT: [[CONV:%.*]] = zext <2 x i1> [[A:%.*]] to <2 x i8> +; CHECK-NEXT: [[CONV3_NEG:%.*]] = sext <2 x i1> [[B:%.*]] to <2 x i8> +; CHECK-NEXT: [[TOBOOL4:%.*]] = icmp ne <2 x i8> [[CONV3_NEG]], [[CONV]] +; CHECK-NEXT: ret <2 x i1> [[TOBOOL4]] +; + %conv = zext <2 x i1> %a to <2 x i8> + %conv3.neg = sext <2 x i1> %b to <2 x i8> + %tobool4 = icmp ne <2 x i8> %conv3.neg, %conv + ret <2 x i1> %tobool4 +}