summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-31 08:32:22 +0000
committerChris Lattner <sabre@nondot.org>2009-12-31 08:32:22 +0000
commit7f4ae5c84cfa0ab5454e3303427f1ee424c0ebcd (patch)
treee5a391d45fb541a2664090dd43cd978bd4977cd0 /test
parente1f5460f787f190522058653388a3ecc3c8ec4fa (diff)
merge some more tests in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92353 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/Reassociate/basictest.ll28
-rw-r--r--test/Transforms/Reassociate/mul-factor3.ll15
-rw-r--r--test/Transforms/Reassociate/mul-neg-add.ll10
3 files changed, 28 insertions, 25 deletions
diff --git a/test/Transforms/Reassociate/basictest.ll b/test/Transforms/Reassociate/basictest.ll
index 445aaaa7f57..c7d54af1e4b 100644
--- a/test/Transforms/Reassociate/basictest.ll
+++ b/test/Transforms/Reassociate/basictest.ll
@@ -105,3 +105,31 @@ define i32 @test6() {
; CHECK: @test6
; CHECK: ret i32 0
}
+
+; This should be one add and two multiplies.
+define i32 @test7(i32 %A, i32 %B, i32 %C) {
+ %aa = mul i32 %A, %A
+ %aab = mul i32 %aa, %B
+ %ac = mul i32 %A, %C
+ %aac = mul i32 %ac, %A
+ %r = add i32 %aab, %aac
+ ret i32 %r
+; CHECK: @test7
+; CHECK-NEXT: add i32 %C, %B
+; CHECK-NEXT: mul i32
+; CHECK-NEXT: mul i32
+; CHECK-NEXT: ret i32
+}
+
+
+define i32 @test8(i32 %X, i32 %Y, i32 %Z) {
+ %A = sub i32 0, %X
+ %B = mul i32 %A, %Y
+ ; (-X)*Y + Z -> Z-X*Y
+ %C = add i32 %B, %Z
+ ret i32 %C
+; CHECK: @test8
+; CHECK-NEXT: %A = mul i32 %Y, %X
+; CHECK-NEXT: %C = sub i32 %Z, %A
+; CHECK-NEXT: ret i32 %C
+}
diff --git a/test/Transforms/Reassociate/mul-factor3.ll b/test/Transforms/Reassociate/mul-factor3.ll
deleted file mode 100644
index 4d0517618e0..00000000000
--- a/test/Transforms/Reassociate/mul-factor3.ll
+++ /dev/null
@@ -1,15 +0,0 @@
-; This should be one add and two multiplies.
-
-; RUN: opt < %s -reassociate -instcombine -S > %t
-; RUN: grep mul %t | count 2
-; RUN: grep add %t | count 1
-
-define i32 @test(i32 %A, i32 %B, i32 %C) {
- %aa = mul i32 %A, %A ; <i32> [#uses=1]
- %aab = mul i32 %aa, %B ; <i32> [#uses=1]
- %ac = mul i32 %A, %C ; <i32> [#uses=1]
- %aac = mul i32 %ac, %A ; <i32> [#uses=1]
- %r = add i32 %aab, %aac ; <i32> [#uses=1]
- ret i32 %r
-}
-
diff --git a/test/Transforms/Reassociate/mul-neg-add.ll b/test/Transforms/Reassociate/mul-neg-add.ll
deleted file mode 100644
index dd6ddd9b62e..00000000000
--- a/test/Transforms/Reassociate/mul-neg-add.ll
+++ /dev/null
@@ -1,10 +0,0 @@
-; RUN: opt < %s -reassociate -instcombine -S |\
-; RUN: not grep {sub i32 0}
-
-define i32 @test(i32 %X, i32 %Y, i32 %Z) {
- %A = sub i32 0, %X ; <i32> [#uses=1]
- %B = mul i32 %A, %Y ; <i32> [#uses=1]
- ; (-X)*Y + Z -> Z-X*Y
- %C = add i32 %B, %Z ; <i32> [#uses=1]
- ret i32 %C
-}