diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-07-22 21:28:20 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-07-22 21:28:20 +0000 |
| commit | cbc4377af18eec1e4e3b51d18fa92da404533d24 (patch) | |
| tree | 2436225ff0ba4d31ec2dcf0beac8d03e317cf705 /llvm/test/Transforms | |
| parent | 97e61dcc2d2345c47514ac71810077064b48f045 (diff) | |
| download | bcm5719-llvm-cbc4377af18eec1e4e3b51d18fa92da404533d24.tar.gz bcm5719-llvm-cbc4377af18eec1e4e3b51d18fa92da404533d24.zip | |
add tests for icmp vector folds
llvm-svn: 276476
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/icmp.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll index e39b2097732..326e24f9819 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, <i32 -12, i32 -12> +; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i32> [[MUL]], zeroinitializer +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %mul = mul nsw <2 x i32> %x, <i32 -12, i32 -12> + %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, <i32 42, i32 42> +; CHECK-NEXT: [[CMP:%.*]] = icmp eq <2 x i32> [[OR]], <i32 -1, i32 -1> +; CHECK-NEXT: ret <2 x i1> [[CMP]] +; + %or = or <2 x i32> %x, <i32 42, i32 42> + %cmp = icmp eq <2 x i32> %or, <i32 -1, i32 -1> + 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 |

