aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/icmp.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-11-21 06:44:42 +0000
committerChris Lattner <sabre@nondot.org>2010-11-21 06:44:42 +0000
commit75d8f599e72c151df48a28bebc6e4e342f469b8a (patch)
tree204abb357393b3d57e53da6a821c9780ded364f2 /test/Transforms/InstCombine/icmp.ll
parent79a980ad85286614bbb4c68c84ea9e3c6ed36d0d (diff)
optimize:
void a(int x) { if (((1<<x)&8)==0) b(); } into "x != 3", which occurs over 100 times in 403.gcc but in no other program in llvm-test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/icmp.ll')
-rw-r--r--test/Transforms/InstCombine/icmp.ll38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index 802957f47b..96038ca56b 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -154,3 +154,41 @@ entry:
; CHECK: @test16
; CHECK: ret i1 undef
}
+
+define i1 @test17(i32 %x) nounwind {
+ %shl = shl i32 1, %x
+ %and = and i32 %shl, 8
+ %cmp = icmp eq i32 %and, 0
+ ret i1 %cmp
+; CHECK: @test17
+; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
+}
+
+
+define i1 @test18(i32 %x) nounwind {
+ %sh = lshr i32 8, %x
+ %and = and i32 %sh, 1
+ %cmp = icmp eq i32 %and, 0
+ ret i1 %cmp
+; CHECK: @test18
+; CHECK-NEXT: %cmp = icmp eq i32 %x, 3
+}
+
+define i1 @test19(i32 %x) nounwind {
+ %shl = shl i32 1, %x
+ %and = and i32 %shl, 8
+ %cmp = icmp eq i32 %and, 8
+ ret i1 %cmp
+; CHECK: @test19
+; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
+}
+
+define i1 @test20(i32 %x) nounwind {
+ %shl = shl i32 1, %x
+ %and = and i32 %shl, 8
+ %cmp = icmp ne i32 %and, 0
+ ret i1 %cmp
+; CHECK: @test20
+; CHECK-NEXT: %cmp = icmp ne i32 %x, 3
+}
+