diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-04 09:35:02 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-04 09:35:02 +0000 |
commit | 9e14cd355f4b1b5222965c108ad2c750bc1c891a (patch) | |
tree | f499bc65ec1faad746837635747f990b9c55effa /test/Transforms/Reassociate | |
parent | e5022fe4cd83eef91f5c3a21c943ca9b65507ab8 (diff) | |
download | llvm-9e14cd355f4b1b5222965c108ad2c750bc1c891a.tar.gz llvm-9e14cd355f4b1b5222965c108ad2c750bc1c891a.tar.bz2 llvm-9e14cd355f4b1b5222965c108ad2c750bc1c891a.tar.xz |
new testcase
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/Reassociate')
-rw-r--r-- | test/Transforms/Reassociate/mulfactor.ll | 14 | ||||
-rw-r--r-- | test/Transforms/Reassociate/mulfactor2.ll | 13 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/mulfactor.ll b/test/Transforms/Reassociate/mulfactor.ll new file mode 100644 index 0000000000..76db242128 --- /dev/null +++ b/test/Transforms/Reassociate/mulfactor.ll @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | grep mul | wc -l | grep 2 + +; This should have exactly 2 multiplies when we're done. + +int %f(int %a, int %b) { + %tmp.2 = mul int %a, %a + %tmp.5 = shl int %a, ubyte 1 + %tmp.6 = mul int %tmp.5, %b + %tmp.10 = mul int %b, %b + %tmp.7 = add int %tmp.6, %tmp.2 + %tmp.11 = add int %tmp.7, %tmp.10 + ret int %tmp.11 +} + diff --git a/test/Transforms/Reassociate/mulfactor2.ll b/test/Transforms/Reassociate/mulfactor2.ll new file mode 100644 index 0000000000..e2c1a79bc5 --- /dev/null +++ b/test/Transforms/Reassociate/mulfactor2.ll @@ -0,0 +1,13 @@ +; This should turn into one multiply and one add. + +; RUN: llvm-as < mulfactor2.ll | opt -instcombine -reassociate -instcombine | llvm-dis | grep mul | wc -l | grep 1 && +; RUN: llvm-as < mulfactor2.ll | opt -instcombine -reassociate -instcombine | llvm-dis | grep add | wc -l | grep 1 +int %main(int %t) { + %tmp.3 = mul int %t, 12 ; <int> [#uses=1] + %tmp.4 = add int %tmp.3, 5 ; <int> [#uses=1] + %tmp.6 = mul int %t, 6 ; <int> [#uses=1] + %tmp.8 = mul int %tmp.4, 3 ; <int> [#uses=1] + %tmp.9 = add int %tmp.8, %tmp.6 ; <int> [#uses=1] + ret int %tmp.9 +} + |