summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/max-of-nots.ll
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/Transforms/InstCombine/max-of-nots.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/max-of-nots.ll20
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
+}
+
OpenPOWER on IntegriCloud