Chandler Carruth | a5a29f9 | 2012-07-02 12:47:22 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | grep "and i32 %x, %y" | count 4 |
| 2 | ; RUN: opt < %s -instcombine -S | not grep "or" |
Bill Wendling | 9eef421 | 2008-11-30 13:08:13 +0000 | [diff] [blame] | 3 | |
| 4 | define i32 @func1(i32 %x, i32 %y) nounwind { |
| 5 | entry: |
| 6 | %n = xor i32 %y, -1 |
| 7 | %o = or i32 %n, %x |
| 8 | %a = and i32 %o, %y |
| 9 | ret i32 %a |
| 10 | } |
| 11 | |
| 12 | define i32 @func2(i32 %x, i32 %y) nounwind { |
| 13 | entry: |
| 14 | %n = xor i32 %y, -1 |
| 15 | %o = or i32 %x, %n |
| 16 | %a = and i32 %o, %y |
| 17 | ret i32 %a |
| 18 | } |
| 19 | |
| 20 | define i32 @func3(i32 %x, i32 %y) nounwind { |
| 21 | entry: |
| 22 | %n = xor i32 %y, -1 |
| 23 | %o = or i32 %n, %x |
| 24 | %a = and i32 %y, %o |
| 25 | ret i32 %a |
| 26 | } |
| 27 | |
| 28 | define i32 @func4(i32 %x, i32 %y) nounwind { |
| 29 | entry: |
| 30 | %n = xor i32 %y, -1 |
| 31 | %o = or i32 %x, %n |
| 32 | %a = and i32 %y, %o |
| 33 | ret i32 %a |
| 34 | } |