blob: eff3e6b34bf56e75da8f6b7e7c6e3ee7eef482a4 [file] [log] [blame]
Reid Spencer69ccadd2006-12-02 04:23:10 +00001; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -dce | llvm-dis | not grep '\(and\|sub\)'
Chris Lattner1a82ca82005-05-08 18:54:40 +00002
3int %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
10int %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
18int %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}