diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2016-10-27 15:02:45 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2016-10-27 15:02:45 +0000 |
| commit | d5b8d64d4b5143a160f291b5f98f40d0fb32003d (patch) | |
| tree | bd40f4d72836ce76c58356f3faebe875046035f6 /llvm/test/Transforms/InstCombine/max-of-nots.ll | |
| parent | 807f732ce84dd2f4f253ae4bda4b8a49ef79906a (diff) | |
| download | bcm5719-llvm-d5b8d64d4b5143a160f291b5f98f40d0fb32003d.tar.gz bcm5719-llvm-d5b8d64d4b5143a160f291b5f98f40d0fb32003d.zip | |
[InstCombine] add tests for missing folds of vector abs/nabs/min/max
llvm-svn: 285299
Diffstat (limited to 'llvm/test/Transforms/InstCombine/max-of-nots.ll')
| -rw-r--r-- | llvm/test/Transforms/InstCombine/max-of-nots.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/max-of-nots.ll b/llvm/test/Transforms/InstCombine/max-of-nots.ll index 62ea1245e60..a3291685ed8 100644 --- a/llvm/test/Transforms/InstCombine/max-of-nots.ll +++ b/llvm/test/Transforms/InstCombine/max-of-nots.ll @@ -88,3 +88,23 @@ define i32 @max_of_nots(i32 %x, i32 %y) { ret i32 %smax96 } +; FIXME - vectors should get the same folds +define <2 x i32> @max_of_nots_vec(<2 x i32> %x, <2 x i32> %y) { +; CHECK-LABEL: @max_of_nots_vec( +; CHECK-NEXT: [[C0:%.*]] = icmp sgt <2 x i32> %y, zeroinitializer +; CHECK-NEXT: [[XOR_Y:%.*]] = xor <2 x i32> %y, <i32 -1, i32 -1> +; CHECK-NEXT: [[S0:%.*]] = select <2 x i1> [[C0]], <2 x i32> [[XOR_Y]], <2 x i32> <i32 -1, i32 -1> +; CHECK-NEXT: [[XOR_X:%.*]] = xor <2 x i32> %x, <i32 -1, i32 -1> +; CHECK-NEXT: [[C1:%.*]] = icmp slt <2 x i32> [[S0]], [[XOR_X]] +; CHECK-NEXT: [[SMAX96:%.*]] = select <2 x i1> [[C1]], <2 x i32> [[XOR_X]], <2 x i32> [[S0]] +; CHECK-NEXT: ret <2 x i32> [[SMAX96]] +; + %c0 = icmp sgt <2 x i32> %y, zeroinitializer + %xor_y = xor <2 x i32> %y, <i32 -1, i32 -1> + %s0 = select <2 x i1> %c0, <2 x i32> %xor_y, <2 x i32> <i32 -1, i32 -1> + %xor_x = xor <2 x i32> %x, <i32 -1, i32 -1> + %c1 = icmp slt <2 x i32> %s0, %xor_x + %smax96 = select <2 x i1> %c1, <2 x i32> %xor_x, <2 x i32> %s0 + ret <2 x i32> %smax96 +} + |

