Chris Lattner | a8de4cc | 2007-06-15 05:57:20 +0000 | [diff] [blame^] | 1 | ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep xor | wc -l | grep 2 |
| 2 | ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep and |
| 3 | ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep { or} |
| 4 | |
| 5 | ; PR1510 |
| 6 | |
| 7 | ; These are all equivelent to A^B |
| 8 | |
| 9 | define i32 @test1(i32 %a, i32 %b) { |
| 10 | entry: |
| 11 | %tmp3 = or i32 %b, %a ; <i32> [#uses=1] |
| 12 | %tmp3not = xor i32 %tmp3, -1 ; <i32> [#uses=1] |
| 13 | %tmp6 = and i32 %b, %a ; <i32> [#uses=1] |
| 14 | %tmp7 = or i32 %tmp6, %tmp3not ; <i32> [#uses=1] |
| 15 | %tmp7not = xor i32 %tmp7, -1 ; <i32> [#uses=1] |
| 16 | ret i32 %tmp7not |
| 17 | } |
| 18 | |
| 19 | define i32 @test2(i32 %a, i32 %b) { |
| 20 | entry: |
| 21 | %tmp3 = or i32 %b, %a ; <i32> [#uses=1] |
| 22 | %tmp6 = and i32 %b, %a ; <i32> [#uses=1] |
| 23 | %tmp6not = xor i32 %tmp6, -1 ; <i32> [#uses=1] |
| 24 | %tmp7 = and i32 %tmp3, %tmp6not ; <i32> [#uses=1] |
| 25 | ret i32 %tmp7 |
| 26 | } |
| 27 | |