summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-09 16:39:05 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-09 16:39:05 +0000
commit9f36a2d54be3145a1393459c299efb7ebea0c844 (patch)
tree1ce3dc3788006f1bc5398aade1e715c6eba06342
parentf36a29199f55c5fa13b2cd5307c500abc4153ab6 (diff)
downloadbcm5719-llvm-9f36a2d54be3145a1393459c299efb7ebea0c844.tar.gz
bcm5719-llvm-9f36a2d54be3145a1393459c299efb7ebea0c844.zip
add tests for missing vector icmp folds
llvm-svn: 278132
-rw-r--r--llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll24
-rw-r--r--llvm/test/Transforms/InstCombine/icmp.ll24
-rw-r--r--llvm/test/Transforms/InstCombine/xor2.ll12
3 files changed, 60 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll b/llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
index e815b82f888..c75fbd84c24 100644
--- a/llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
+++ b/llvm/test/Transforms/InstCombine/2008-08-17-ICmpXorSignbit.ll
@@ -33,6 +33,18 @@ define i1 @test3(i8 %x) {
ret i1 %tmp
}
+; FIXME: Vectors should fold too.
+define <2 x i1> @test3vec(<2 x i8> %x) {
+; CHECK-LABEL: @test3vec(
+; CHECK-NEXT: [[X:%.*]] = xor <2 x i8> %x, <i8 -128, i8 -128>
+; CHECK-NEXT: [[TMP:%.*]] = icmp ugt <2 x i8> [[X]], <i8 14, i8 14>
+; CHECK-NEXT: ret <2 x i1> [[TMP]]
+;
+ %X = xor <2 x i8> %x, <i8 128, i8 128>
+ %tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
+ ret <2 x i1> %tmp
+}
+
define i1 @test4(i8 %x, i8 %y) {
; CHECK-LABEL: @test4(
; CHECK-NEXT: [[TMP:%.*]] = icmp ugt i8 %x, %y
@@ -65,3 +77,15 @@ define i1 @test6(i8 %x) {
ret i1 %tmp
}
+; FIXME: Vectors should fold too.
+define <2 x i1> @test6vec(<2 x i8> %x) {
+; CHECK-LABEL: @test6vec(
+; CHECK-NEXT: [[X:%.*]] = xor <2 x i8> %x, <i8 127, i8 127>
+; CHECK-NEXT: [[TMP:%.*]] = icmp ugt <2 x i8> [[X]], <i8 14, i8 14>
+; CHECK-NEXT: ret <2 x i1> [[TMP]]
+;
+ %X = xor <2 x i8> %x, <i8 127, i8 127>
+ %tmp = icmp uge <2 x i8> %X, <i8 15, i8 15>
+ ret <2 x i1> %tmp
+}
+
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index 27ae64eb5d3..aa2a5049924 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -1546,6 +1546,18 @@ define i1 @icmp_sub_-1_X_ult_4(i32 %X) {
ret i1 %cmp
}
+; FIXME: Vectors should fold too.
+define <2 x i1> @icmp_sub_neg1_X_ult_4_vec(<2 x i32> %X) {
+; CHECK-LABEL: @icmp_sub_neg1_X_ult_4_vec(
+; CHECK-NEXT: [[SUB:%.*]] = xor <2 x i32> %X, <i32 -1, i32 -1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult <2 x i32> [[SUB]], <i32 4, i32 4>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sub = sub <2 x i32> <i32 -1, i32 -1>, %X
+ %cmp = icmp ult <2 x i32> %sub, <i32 4, i32 4>
+ ret <2 x i1> %cmp
+}
+
define i1 @icmp_sub_-1_X_uge_4(i32 %X) {
; CHECK-LABEL: @icmp_sub_-1_X_uge_4(
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 %X, -4
@@ -1556,6 +1568,18 @@ define i1 @icmp_sub_-1_X_uge_4(i32 %X) {
ret i1 %cmp
}
+; FIXME: Vectors should fold too.
+define <2 x i1> @icmp_sub_neg1_X_uge_4_vec(<2 x i32> %X) {
+; CHECK-LABEL: @icmp_sub_neg1_X_uge_4_vec(
+; CHECK-NEXT: [[SUB:%.*]] = xor <2 x i32> %X, <i32 -1, i32 -1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt <2 x i32> [[SUB]], <i32 3, i32 3>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %sub = sub <2 x i32> <i32 -1, i32 -1>, %X
+ %cmp = icmp uge <2 x i32> %sub, <i32 4, i32 4>
+ ret <2 x i1> %cmp
+}
+
define i1 @icmp_swap_operands_for_cse(i32 %X, i32 %Y) {
; CHECK-LABEL: @icmp_swap_operands_for_cse(
; CHECK-NEXT: entry:
diff --git a/llvm/test/Transforms/InstCombine/xor2.ll b/llvm/test/Transforms/InstCombine/xor2.ll
index 320666235c0..5bd6bf6808f 100644
--- a/llvm/test/Transforms/InstCombine/xor2.ll
+++ b/llvm/test/Transforms/InstCombine/xor2.ll
@@ -12,6 +12,18 @@ define i1 @test0(i32 %A) {
ret i1 %C
}
+; FIXME: Vectors should fold too.
+define <2 x i1> @test0vec(<2 x i32> %A) {
+; CHECK-LABEL: @test0vec(
+; CHECK-NEXT: [[B:%.*]] = xor <2 x i32> %A, <i32 -2147483648, i32 -2147483648>
+; CHECK-NEXT: [[C:%.*]] = icmp sgt <2 x i32> [[B]], <i32 -1, i32 -1>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %B = xor <2 x i32> %A, <i32 -2147483648, i32 -2147483648>
+ %C = icmp sgt <2 x i32> %B, <i32 -1, i32 -1>
+ ret <2 x i1> %C
+}
+
define i1 @test1(i32 %A) {
; CHECK-LABEL: @test1(
; CHECK-NEXT: [[C:%.*]] = icmp slt i32 %A, 0
OpenPOWER on IntegriCloud