Reid Spencer | ea8b07e | 2007-03-23 20:48:34 +0000 | [diff] [blame] | 1 | ; This test case checks that the merge of and/xor can work on arbitrary |
| 2 | ; precision integers. |
| 3 | |
Dan Gohman | 72a13d2 | 2009-09-08 22:34:10 +0000 | [diff] [blame] | 4 | ; RUN: opt < %s -instcombine -S | grep and | count 1 |
| 5 | ; RUN: opt < %s -instcombine -S | grep xor | count 2 |
Reid Spencer | ea8b07e | 2007-03-23 20:48:34 +0000 | [diff] [blame] | 6 | |
| 7 | ; (x &z ) ^ (y & z) -> (x ^ y) & z |
| 8 | define i57 @test1(i57 %x, i57 %y, i57 %z) { |
| 9 | %tmp3 = and i57 %z, %x |
| 10 | %tmp6 = and i57 %z, %y |
| 11 | %tmp7 = xor i57 %tmp3, %tmp6 |
| 12 | ret i57 %tmp7 |
| 13 | } |
| 14 | |
| 15 | ; (x & y) ^ (x | y) -> x ^ y |
| 16 | define i23 @test2(i23 %x, i23 %y, i23 %z) { |
| 17 | %tmp3 = and i23 %y, %x |
| 18 | %tmp6 = or i23 %y, %x |
| 19 | %tmp7 = xor i23 %tmp3, %tmp6 |
| 20 | ret i23 %tmp7 |
| 21 | } |
| 22 | |