summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-05-17 22:20:02 +0000
committerSanjay Patel <spatel@rotateright.com>2017-05-17 22:20:02 +0000
commit3cd38a8d4ce8048b833f7058bfe2c11219f410e8 (patch)
tree6f6bbaad233589fab93484945e20fa115f50481f /llvm
parente5747e3cbd9690928882e15d45036d3b9bd25359 (diff)
downloadbcm5719-llvm-3cd38a8d4ce8048b833f7058bfe2c11219f410e8.tar.gz
bcm5719-llvm-3cd38a8d4ce8048b833f7058bfe2c11219f410e8.zip
[InstCombine] add test for missing icmp bool fold; NFC
llvm-svn: 303310
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/Transforms/InstCombine/set.ll36
1 files changed, 26 insertions, 10 deletions
diff --git a/llvm/test/Transforms/InstCombine/set.ll b/llvm/test/Transforms/InstCombine/set.ll
index 494a6037901..f1bbc6cda0b 100644
--- a/llvm/test/Transforms/InstCombine/set.ll
+++ b/llvm/test/Transforms/InstCombine/set.ll
@@ -110,8 +110,8 @@ define i1 @test12(i1 %A) {
define i1 @test13(i1 %A, i1 %B) {
; CHECK-LABEL: @test13(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %B, true
-; CHECK-NEXT: [[C:%.*]] = or i1 [[CTMP]], %A
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %B, true
+; CHECK-NEXT: [[C:%.*]] = or i1 [[TMP1]], %A
; CHECK-NEXT: ret i1 [[C]]
;
%C = icmp uge i1 %A, %B
@@ -120,8 +120,8 @@ define i1 @test13(i1 %A, i1 %B) {
define <2 x i1> @test13vec(<2 x i1> %A, <2 x i1> %B) {
; CHECK-LABEL: @test13vec(
-; CHECK-NEXT: [[CTMP:%.*]] = xor <2 x i1> %B, <i1 true, i1 true>
-; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[CTMP]], %A
+; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i1> %B, <i1 true, i1 true>
+; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[TMP1]], %A
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%C = icmp uge <2 x i1> %A, %B
@@ -130,8 +130,8 @@ define <2 x i1> @test13vec(<2 x i1> %A, <2 x i1> %B) {
define i1 @test14(i1 %A, i1 %B) {
; CHECK-LABEL: @test14(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor i1 [[CTMP]], true
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor i1 [[TMP1]], true
; CHECK-NEXT: ret i1 [[C]]
;
%C = icmp eq i1 %A, %B
@@ -140,14 +140,30 @@ define i1 @test14(i1 %A, i1 %B) {
define <3 x i1> @test14vec(<3 x i1> %A, <3 x i1> %B) {
; CHECK-LABEL: @test14vec(
-; CHECK-NEXT: [[CTMP:%.*]] = xor <3 x i1> %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[CTMP]], <i1 true, i1 true, i1 true>
+; CHECK-NEXT: [[TMP1:%.*]] = xor <3 x i1> %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[TMP1]], <i1 true, i1 true, i1 true>
; CHECK-NEXT: ret <3 x i1> [[C]]
;
%C = icmp eq <3 x i1> %A, %B
ret <3 x i1> %C
}
+; FIXME: Not recognizing the icmp bool with constant exposes a missing fold.
+
+define i1 @bool_eq0(i64 %a) {
+; CHECK-LABEL: @bool_eq0(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i64 %a, 0
+; CHECK-NEXT: [[C:%.*]] = icmp eq i64 %a, 1
+; CHECK-NEXT: [[AND:%.*]] = xor i1 [[C]], [[B]]
+; CHECK-NEXT: ret i1 [[AND]]
+;
+ %b = icmp sgt i64 %a, 0
+ %c = icmp eq i64 %a, 1
+ %notc = icmp eq i1 %c, false
+ %and = and i1 %b, %notc
+ ret i1 %and
+}
+
define i1 @test16(i32 %A) {
; CHECK-LABEL: @test16(
; CHECK-NEXT: ret i1 false
@@ -191,8 +207,8 @@ endif:
define i1 @test19(i1 %A, i1 %B) {
; CHECK-LABEL: @test19(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor i1 [[CTMP]], true
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor i1 [[TMP1]], true
; CHECK-NEXT: ret i1 [[C]]
;
%a = zext i1 %A to i32
OpenPOWER on IntegriCloud