merge some more tests in.
authorChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 08:32:22 +0000 (08:32 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 31 Dec 2009 08:32:22 +0000 (08:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92353 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/Reassociate/basictest.ll
test/Transforms/Reassociate/mul-factor3.ll [deleted file]
test/Transforms/Reassociate/mul-neg-add.ll [deleted file]

index 445aaaa7f57334fdbfef851411574455b50d8af1..c7d54af1e4be56ee0f6ec0a0986b0eab6a1175ce 100644 (file)
@@ -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 (file)
index 4d05176..0000000
+++ /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 (file)
index dd6ddd9..0000000
+++ /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
-}