aboutsummaryrefslogtreecommitdiffstats
path: root/test/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-08-27 20:44:45 +0000
committerChris Lattner <sabre@nondot.org>2010-08-27 20:44:45 +0000
commitd07ad667914015551bbfd156465219daee729616 (patch)
treece09aaeeb3df95be11176f8fe88e15a025d9a15f /test/Transforms
parent7673290a96ff90391719721c5ae06c7da88a2585 (diff)
downloadexternal_llvm-d07ad667914015551bbfd156465219daee729616.zip
external_llvm-d07ad667914015551bbfd156465219daee729616.tar.gz
external_llvm-d07ad667914015551bbfd156465219daee729616.tar.bz2
merge and filecheckize test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112289 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r--test/Transforms/InstCombine/shift-simplify.ll42
-rw-r--r--test/Transforms/InstCombine/shift.ll57
2 files changed, 57 insertions, 42 deletions
diff --git a/test/Transforms/InstCombine/shift-simplify.ll b/test/Transforms/InstCombine/shift-simplify.ll
deleted file mode 100644
index e5cc705..0000000
--- a/test/Transforms/InstCombine/shift-simplify.ll
+++ /dev/null
@@ -1,42 +0,0 @@
-; RUN: opt < %s -instcombine -S | \
-; RUN: egrep {shl|lshr|ashr} | count 3
-
-define i32 @test0(i32 %A, i32 %B, i32 %C) {
- %X = shl i32 %A, %C
- %Y = shl i32 %B, %C
- %Z = and i32 %X, %Y
- ret i32 %Z
-}
-
-define i32 @test1(i32 %A, i32 %B, i32 %C) {
- %X = lshr i32 %A, %C
- %Y = lshr i32 %B, %C
- %Z = or i32 %X, %Y
- ret i32 %Z
-}
-
-define i32 @test2(i32 %A, i32 %B, i32 %C) {
- %X = ashr i32 %A, %C
- %Y = ashr i32 %B, %C
- %Z = xor i32 %X, %Y
- ret i32 %Z
-}
-
-define i1 @test3(i32 %X) {
- %tmp1 = shl i32 %X, 7
- %tmp2 = icmp slt i32 %tmp1, 0
- ret i1 %tmp2
-}
-
-define i1 @test4(i32 %X) {
- %tmp1 = lshr i32 %X, 7
- %tmp2 = icmp slt i32 %tmp1, 0
- ret i1 %tmp2
-}
-
-define i1 @test5(i32 %X) {
- %tmp1 = ashr i32 %X, 7
- %tmp2 = icmp slt i32 %tmp1, 0
- ret i1 %tmp2
-}
-
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index c194b68..411d809 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/test/Transforms/InstCombine/shift.ll
@@ -355,3 +355,60 @@ entry:
}
+define i32 @test30(i32 %A, i32 %B, i32 %C) {
+ %X = shl i32 %A, %C
+ %Y = shl i32 %B, %C
+ %Z = and i32 %X, %Y
+ ret i32 %Z
+; CHECK: @test30
+; CHECK: %X1 = and i32 %A, %B
+; CHECK: %Z = shl i32 %X1, %C
+}
+
+define i32 @test31(i32 %A, i32 %B, i32 %C) {
+ %X = lshr i32 %A, %C
+ %Y = lshr i32 %B, %C
+ %Z = or i32 %X, %Y
+ ret i32 %Z
+; CHECK: @test31
+; CHECK: %X1 = or i32 %A, %B
+; CHECK: %Z = lshr i32 %X1, %C
+}
+
+define i32 @test32(i32 %A, i32 %B, i32 %C) {
+ %X = ashr i32 %A, %C
+ %Y = ashr i32 %B, %C
+ %Z = xor i32 %X, %Y
+ ret i32 %Z
+; CHECK: @test32
+; CHECK: %X1 = xor i32 %A, %B
+; CHECK: %Z = ashr i32 %X1, %C
+; CHECK: ret i32 %Z
+}
+
+define i1 @test33(i32 %X) {
+ %tmp1 = shl i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+; CHECK: @test33
+; CHECK: %tmp1.mask = and i32 %X, 16777216
+; CHECK: %tmp2 = icmp ne i32 %tmp1.mask, 0
+}
+
+define i1 @test34(i32 %X) {
+ %tmp1 = lshr i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+; CHECK: @test34
+; CHECK: ret i1 false
+}
+
+define i1 @test35(i32 %X) {
+ %tmp1 = ashr i32 %X, 7
+ %tmp2 = icmp slt i32 %tmp1, 0
+ ret i1 %tmp2
+; CHECK: @test35
+; CHECK: %tmp2 = icmp slt i32 %X, 0
+; CHECK: ret i1 %tmp2
+}
+