[llvm-commits] [llvm] r92353 - in /llvm/trunk/test/Transforms/Reassociate: basictest.ll mul-factor3.ll mul-neg-add.ll
Chris Lattner
sabre at nondot.org
Thu Dec 31 00:32:22 PST 2009
Author: lattner
Date: Thu Dec 31 02:32:22 2009
New Revision: 92353
URL: http://llvm.org/viewvc/llvm-project?rev=92353&view=rev
Log:
merge some more tests in.
Removed:
llvm/trunk/test/Transforms/Reassociate/mul-factor3.ll
llvm/trunk/test/Transforms/Reassociate/mul-neg-add.ll
Modified:
llvm/trunk/test/Transforms/Reassociate/basictest.ll
Modified: llvm/trunk/test/Transforms/Reassociate/basictest.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/basictest.ll?rev=92353&r1=92352&r2=92353&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/basictest.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/basictest.ll Thu Dec 31 02:32:22 2009
@@ -105,3 +105,31 @@
; 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
+}
Removed: llvm/trunk/test/Transforms/Reassociate/mul-factor3.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mul-factor3.ll?rev=92352&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/mul-factor3.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/mul-factor3.ll (removed)
@@ -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
-}
-
Removed: llvm/trunk/test/Transforms/Reassociate/mul-neg-add.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mul-neg-add.ll?rev=92352&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/mul-neg-add.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/mul-neg-add.ll (removed)
@@ -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
-}
More information about the llvm-commits
mailing list