diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index 56245e0143cd08..8da2ed3415b629 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -1579,6 +1579,45 @@ define i1 @icmp_add20_sge_add57(i32 %x, i32 %y) { ret i1 %cmp } +define <2 x i1> @icmp_add20_sge_add57_splat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_add20_sge_add57_splat( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + +define <2 x i1> @icmp_add20_sge_add57_undef(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_add20_sge_add57_undef( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + +define <2 x i1> @icmp_add20_sge_add57_vec_nonsplat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_add20_sge_add57_vec_nonsplat( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + define i1 @icmp_sub57_sge_sub20(i32 %x, i32 %y) { ; CHECK-LABEL: @icmp_sub57_sge_sub20( ; CHECK-NEXT: [[TMP1:%.*]] = add nsw i32 [[X:%.*]], -37 @@ -1591,6 +1630,45 @@ define i1 @icmp_sub57_sge_sub20(i32 %x, i32 %y) { ret i1 %cmp } +define <2 x i1> @icmp_sub57_sge_sub20_splat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_sub57_sge_sub20_splat( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + +define <2 x i1> @icmp_sub57_sge_sub20_vec_undef(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_sub57_sge_sub20_vec_undef( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + +define <2 x i1> @icmp_sub57_sge_sub20_vec_nonsplat(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @icmp_sub57_sge_sub20_vec_nonsplat( +; CHECK-NEXT: [[TMP1:%.*]] = add nsw <2 x i32> [[X:%.*]], +; CHECK-NEXT: [[TMP2:%.*]] = add nsw <2 x i32> [[Y:%.*]], +; CHECK-NEXT: [[CMP:%.*]] = icmp sge <2 x i32> [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %1 = add nsw <2 x i32> %x, + %2 = add nsw <2 x i32> %y, + %cmp = icmp sge <2 x i32> %1, %2 + ret <2 x i1> %cmp +} + define i1 @icmp_and_shl_neg_ne_0(i32 %A, i32 %B) { ; CHECK-LABEL: @icmp_and_shl_neg_ne_0( ; CHECK-NEXT: [[SHL:%.*]] = shl i32 1, [[B:%.*]]