From cbc4377af18eec1e4e3b51d18fa92da404533d24 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 22 Jul 2016 21:28:20 +0000 Subject: [PATCH] add tests for icmp vector folds llvm-svn: 276476 --- llvm/test/Transforms/InstCombine/icmp.ll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index e39b2097732e..326e24f98196 100644 --- a/llvm/test/Transforms/InstCombine/icmp.ll +++ b/llvm/test/Transforms/InstCombine/icmp.ll @@ -1186,6 +1186,18 @@ define i1 @icmp_mul_neq0(i32 %x) { ret i1 %cmp } +; FIXME: Vectors should fold the same way. +define <2 x i1> @icmp_mul_neq0_vec(<2 x i32> %x) { +; CHECK-LABEL: @icmp_mul_neq0_vec( +; CHECK-NEXT: [[MUL:%.*]] = mul nsw <2 x i32> %x, +; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[MUL]], zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %mul = mul nsw <2 x i32> %x, + %cmp = icmp ne <2 x i32> %mul, zeroinitializer + ret <2 x i1> %cmp +} + define i1 @icmp_mul_eq0(i32 %x) { ; CHECK-LABEL: @icmp_mul_eq0( ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 %x, 0 @@ -2005,6 +2017,18 @@ define i1 @cmp_inverse_mask_bits_set_eq(i32 %x) { ret i1 %cmp } +; FIXME: Vectors should fold the same way. +define <2 x i1> @cmp_inverse_mask_bits_set_eq_vec(<2 x i32> %x) { +; CHECK-LABEL: @cmp_inverse_mask_bits_set_eq_vec( +; CHECK-NEXT: [[OR:%.*]] = or <2 x i32> %x, +; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[OR]], +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %or = or <2 x i32> %x, + %cmp = icmp eq <2 x i32> %or, + ret <2 x i1> %cmp +} + define i1 @cmp_inverse_mask_bits_set_ne(i32 %x) { ; CHECK-LABEL: @cmp_inverse_mask_bits_set_ne( ; CHECK-NEXT: [[TMP1:%.*]] = and i32 %x, -43 -- GitLab