summaryrefslogtreecommitdiff
path: root/test/Transforms/Reassociate/shift-factor.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-14 06:54:32 +0000
committerChris Lattner <sabre@nondot.org>2006-03-14 06:54:32 +0000
commit000c7c4c7b9481fb596fb2a2db9d163b800a8a09 (patch)
treec09aa8bce5bcfa4744bf027561d664e9c80e14cf /test/Transforms/Reassociate/shift-factor.ll
parent09a053a777056ea3e246a6b2fc3df139c6dff9f1 (diff)
downloadllvm-000c7c4c7b9481fb596fb2a2db9d163b800a8a09.tar.gz
llvm-000c7c4c7b9481fb596fb2a2db9d163b800a8a09.tar.bz2
llvm-000c7c4c7b9481fb596fb2a2db9d163b800a8a09.tar.xz
Test that we can reassociate (x<<1)+(y<<1) -> (X+Y)<<1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Reassociate/shift-factor.ll')
-rw-r--r--test/Transforms/Reassociate/shift-factor.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/shift-factor.ll b/test/Transforms/Reassociate/shift-factor.ll
new file mode 100644
index 0000000000..b0499f5cb2
--- /dev/null
+++ b/test/Transforms/Reassociate/shift-factor.ll
@@ -0,0 +1,11 @@
+; There should be exactly one shift and one add left.
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep shl | wc -l | grep 1 &&
+; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep add | wc -l | grep 1
+
+int %test(int %X, int %Y) {
+ %tmp.2 = shl int %X, ubyte 1 ; <int> [#uses=1]
+ %tmp.6 = shl int %Y, ubyte 1 ; <int> [#uses=1]
+ %tmp.4 = add int %tmp.6, %tmp.2 ; <int> [#uses=1]
+ ret int %tmp.4
+}
+