new testcases for PR557
[oota-llvm.git] / test / Transforms / Reassociate / inverses.ll
1 ; RUN: llvm-as < %s | opt -reassociate -dce | llvm-dis | not grep '\(and\|sub\)'
2
3 int %test1(int %a, int %b) {
4         %tmp.2 = and int %b, %a
5         %tmp.4 = xor int %a, -1
6         %tmp.5 = and int %tmp.2, %tmp.4 ; (A&B)&~A == 0
7         ret int %tmp.5
8 }
9
10 int %test2(int %a, int %b) {
11         %tmp.1 = and int %a, 1234
12         %tmp.2 = and int %b, %tmp.1
13         %tmp.4 = xor int %a, -1
14         %tmp.5 = and int %tmp.2, %tmp.4 ; A&~A == 0
15         ret int %tmp.5
16 }
17
18 int %test3(int %b, int %a) {
19         %tmp.1 = add int %a, 1234
20         %tmp.2 = add int %b, %tmp.1
21         %tmp.4 = sub int 0, %a
22         %tmp.5 = add int %tmp.2, %tmp.4   ; (b+(a+1234))+-a -> b+1234
23         ret int %tmp.5
24 }