Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -dce | llvm-dis | \ |
| 2 | ; RUN: not grep {\\(and\\|sub\\)} |
| 3 | |
| 4 | int %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 | |
| 11 | int %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 | |
| 19 | int %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 | } |