llvm.org GIT mirror llvm / 7f4ae5c
merge some more tests in. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92353 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 9 years ago
3 changed file(s) with 28 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
104104 ; CHECK: @test6
105105 ; CHECK: ret i32 0
106106 }
107
108 ; This should be one add and two multiplies.
109 define i32 @test7(i32 %A, i32 %B, i32 %C) {
110 %aa = mul i32 %A, %A
111 %aab = mul i32 %aa, %B
112 %ac = mul i32 %A, %C
113 %aac = mul i32 %ac, %A
114 %r = add i32 %aab, %aac
115 ret i32 %r
116 ; CHECK: @test7
117 ; CHECK-NEXT: add i32 %C, %B
118 ; CHECK-NEXT: mul i32
119 ; CHECK-NEXT: mul i32
120 ; CHECK-NEXT: ret i32
121 }
122
123
124 define i32 @test8(i32 %X, i32 %Y, i32 %Z) {
125 %A = sub i32 0, %X
126 %B = mul i32 %A, %Y
127 ; (-X)*Y + Z -> Z-X*Y
128 %C = add i32 %B, %Z
129 ret i32 %C
130 ; CHECK: @test8
131 ; CHECK-NEXT: %A = mul i32 %Y, %X
132 ; CHECK-NEXT: %C = sub i32 %Z, %A
133 ; CHECK-NEXT: ret i32 %C
134 }
+0
-15
test/Transforms/Reassociate/mul-factor3.ll less more
None ; This should be one add and two multiplies.
1
2 ; RUN: opt < %s -reassociate -instcombine -S > %t
3 ; RUN: grep mul %t | count 2
4 ; RUN: grep add %t | count 1
5
6 define i32 @test(i32 %A, i32 %B, i32 %C) {
7 %aa = mul i32 %A, %A ; [#uses=1]
8 %aab = mul i32 %aa, %B ; [#uses=1]
9 %ac = mul i32 %A, %C ; [#uses=1]
10 %aac = mul i32 %ac, %A ; [#uses=1]
11 %r = add i32 %aab, %aac ; [#uses=1]
12 ret i32 %r
13 }
14
+0
-10
test/Transforms/Reassociate/mul-neg-add.ll less more
None ; RUN: opt < %s -reassociate -instcombine -S |\
1 ; RUN: not grep {sub i32 0}
2
3 define i32 @test(i32 %X, i32 %Y, i32 %Z) {
4 %A = sub i32 0, %X ; [#uses=1]
5 %B = mul i32 %A, %Y ; [#uses=1]
6 ; (-X)*Y + Z -> Z-X*Y
7 %C = add i32 %B, %Z ; [#uses=1]
8 ret i32 %C
9 }