Reid Spencer | 69ccadd | 2006-12-02 04:23:10 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -dce | llvm-dis | not grep '\(and\|sub\)' |
Chris Lattner | 1a82ca8 | 2005-05-08 18:54:40 +0000 | [diff] [blame] | 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 | } |