blob: ba7fe6fbeb3b29e44404023dcd34c9c2d8e13e8c [file] [log] [blame]
Chris Lattner4544d022005-05-08 21:28:33 +00001; RUN: llvm-as < %s | opt -reassociate -instcombine | llvm-dis | not grep sub
2
3; Test that we can turn things like X*-(Y*Z) -> X*-1*Y*Z.
4
5int %test1(int %a, int %b, int %z) {
6 %c = sub int 0, %z
7 %d = mul int %a, %b
8 %e = mul int %c, %d
9 %f = mul int %e, 12345
10 %g = sub int 0, %f
11 ret int %g
12}
13
14int %test2(int %a, int %b, int %z) {
15 %d = mul int %z, 40
16 %c = sub int 0, %d
17 %e = mul int %a, %c
18 %f = sub int 0, %e
19 ret int %f
20}