summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-09-22 19:54:15 +0000
committerCraig Topper <craig.topper@intel.com>2017-09-22 19:54:15 +0000
commit3f364aa9081b305245963b3298c31aecbd2acdaf (patch)
tree488f23149ab4e3bf1b977f98da2d860fd5dcf511 /llvm/test/Transforms
parent0c723bb0179cae061b6332dfbf25e2b723787038 (diff)
downloadbcm5719-llvm-3f364aa9081b305245963b3298c31aecbd2acdaf.tar.gz
bcm5719-llvm-3f364aa9081b305245963b3298c31aecbd2acdaf.zip
[InstCombine] Add constant splat handling to one of the ICMP_SLT/SGT cases in foldICmpUsingKnownBits.
llvm-svn: 314025
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/icmp-add.ll41
1 files changed, 39 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstCombine/icmp-add.ll b/llvm/test/Transforms/InstCombine/icmp-add.ll
index efeb9d5bb45..c9e13717f29 100644
--- a/llvm/test/Transforms/InstCombine/icmp-add.ll
+++ b/llvm/test/Transforms/InstCombine/icmp-add.ll
@@ -96,6 +96,16 @@ define i1 @nsw_slt1(i8 %a) {
ret i1 %c
}
+define <2 x i1> @nsw_slt1_splat_vec(<2 x i8> %a) {
+; CHECK-LABEL: @nsw_slt1_splat_vec(
+; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i8> [[A:%.*]], <i8 -128, i8 -128>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %b = add nsw <2 x i8> %a, <i8 100, i8 100>
+ %c = icmp slt <2 x i8> %b, <i8 -27, i8 -27>
+ ret <2 x i1> %c
+}
+
; icmp Pred (add nsw X, C2), C --> icmp Pred X, (C - C2), when C - C2 does not overflow.
; This becomes equality because it's at the limit.
@@ -109,6 +119,16 @@ define i1 @nsw_slt2(i8 %a) {
ret i1 %c
}
+define <2 x i1> @nsw_slt2_splat_vec(<2 x i8> %a) {
+; CHECK-LABEL: @nsw_slt2_splat_vec(
+; CHECK-NEXT: [[C:%.*]] = icmp ne <2 x i8> [[A:%.*]], <i8 127, i8 127>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %b = add nsw <2 x i8> %a, <i8 -100, i8 -100>
+ %c = icmp slt <2 x i8> %b, <i8 27, i8 27>
+ ret <2 x i1> %c
+}
+
; icmp Pred (add nsw X, C2), C --> icmp Pred X, (C - C2), when C - C2 does not overflow.
; Less than the limit, so the predicate doesn't change.
@@ -148,9 +168,26 @@ define i1 @nsw_sgt1(i8 %a) {
ret i1 %c
}
-; icmp Pred (add nsw X, C2), C --> icmp Pred X, (C - C2), when C - C2 does not overflow.
-; Try a vector type to make sure that works too.
; FIXME: This should be 'eq 127' as above.
+define <2 x i1> @nsw_sgt1_splat_vec(<2 x i8> %a) {
+; CHECK-LABEL: @nsw_sgt1_splat_vec(
+; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i8> [[A:%.*]], <i8 127, i8 127>
+; CHECK-NEXT: ret <2 x i1> [[C]]
+;
+ %b = add nsw <2 x i8> %a, <i8 -100, i8 -100>
+ %c = icmp sgt <2 x i8> %b, <i8 26, i8 26>
+ ret <2 x i1> %c
+}
+
+define i1 @nsw_sgt2(i8 %a) {
+; CHECK-LABEL: @nsw_sgt2(
+; CHECK-NEXT: [[C:%.*]] = icmp sgt i8 [[A:%.*]], -126
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %b = add nsw i8 %a, 100
+ %c = icmp sgt i8 %b, -26
+ ret i1 %c
+}
define <2 x i1> @nsw_sgt2_splat_vec(<2 x i8> %a) {
; CHECK-LABEL: @nsw_sgt2_splat_vec(
OpenPOWER on IntegriCloud