blob: e431328a4816adacc87c08162e476429fe9298b8 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -dce | llvm-dis | \
2; RUN: not grep {\\(and\\|sub\\)}
3
4int %test1(int %a, int %b) {
5 %tmp.2 = and int %b, %a
6 %tmp.4 = xor int %a, -1
7 %tmp.5 = and int %tmp.2, %tmp.4 ; (A&B)&~A == 0
8 ret int %tmp.5
9}
10
11int %test2(int %a, int %b) {
12 %tmp.1 = and int %a, 1234
13 %tmp.2 = and int %b, %tmp.1
14 %tmp.4 = xor int %a, -1
15 %tmp.5 = and int %tmp.2, %tmp.4 ; A&~A == 0
16 ret int %tmp.5
17}
18
19int %test3(int %b, int %a) {
20 %tmp.1 = add int %a, 1234
21 %tmp.2 = add int %b, %tmp.1
22 %tmp.4 = sub int 0, %a
23 %tmp.5 = add int %tmp.2, %tmp.4 ; (b+(a+1234))+-a -> b+1234
24 ret int %tmp.5
25}