aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-11-09 05:11:23 +0000
committerChris Lattner <sabre@nondot.org>2006-11-09 05:11:23 +0000
commit12afb70894e5566491fb5dff79e2d657c90948ef (patch)
treeb77369cf1666a412c96b369499a93f1860eabf3e
parentd258efaf6eeb63792ba630edc50405fb559337fb (diff)
new testcases
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31585 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Transforms/InstCombine/add.ll13
-rw-r--r--test/Transforms/InstCombine/shift-sra.ll13
2 files changed, 24 insertions, 2 deletions
diff --git a/test/Transforms/InstCombine/add.ll b/test/Transforms/InstCombine/add.ll
index 81ab29a096..382596ba87 100644
--- a/test/Transforms/InstCombine/add.ll
+++ b/test/Transforms/InstCombine/add.ll
@@ -227,3 +227,16 @@ int %test32(int %A) {
%D = sub int %C, 16
ret int %D
}
+
+ubyte %test33(ubyte %A) { ;; OR A, 1
+ %B = and ubyte %A, 254
+ %C = add ubyte %B, 1
+ ret ubyte %C
+}
+
+ubyte %test34(ubyte %A) {
+ %B = add ubyte %A, 64 ;; dead
+ %C = and ubyte %B, 12
+ ret ubyte %C
+}
+
diff --git a/test/Transforms/InstCombine/shift-sra.ll b/test/Transforms/InstCombine/shift-sra.ll
index 1dc74ecfa1..fe1b142b74 100644
--- a/test/Transforms/InstCombine/shift-sra.ll
+++ b/test/Transforms/InstCombine/shift-sra.ll
@@ -1,8 +1,17 @@
; RUN: llvm-as < %s | opt -instcombine -disable-output &&
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int'
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int' | wc -l | grep 2 &&
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr
-int %test0(int %X, ubyte %A) {
+int %test1(int %X, ubyte %A) {
%Y = shr int %X, ubyte %A ; can be logical shift.
%Z = and int %Y, 1
ret int %Z
}
+
+int %test2(ubyte %tmp) {
+ %tmp3 = cast ubyte %tmp to int
+ %tmp4 = add int %tmp3, 7
+ %tmp5 = ashr int %tmp4, ubyte 3 ; lshr
+ ret int %tmp5
+}
+