Chris Lattner | 7a2bdde | 2011-04-15 05:18:47 +0000 | [diff] [blame] | 1 | ; This is a basic sanity check for constant propagation. It tests the basic |
Reid Spencer | c6b9efa | 2007-04-13 22:33:10 +0000 | [diff] [blame] | 2 | ; logic operations. |
| 3 | |
| 4 | |
Dan Gohman | 9c7a988 | 2009-09-08 22:57:49 +0000 | [diff] [blame] | 5 | ; RUN: opt < %s -sccp -S | not grep and |
| 6 | ; RUN: opt < %s -sccp -S | not grep trunc |
Chandler Carruth | 4177e6f | 2012-07-02 12:47:22 +0000 | [diff] [blame] | 7 | ; RUN: opt < %s -sccp -S | grep "ret i100 -1" |
Reid Spencer | c6b9efa | 2007-04-13 22:33:10 +0000 | [diff] [blame] | 8 | |
| 9 | define i100 @test(i133 %A) { |
| 10 | %B = and i133 0, %A |
| 11 | %C = icmp sgt i133 %B, 0 |
| 12 | br i1 %C, label %BB1, label %BB2 |
| 13 | BB1: |
| 14 | %t3 = xor i133 %B, -1 |
| 15 | %t4 = trunc i133 %t3 to i100 |
| 16 | br label %BB3 |
| 17 | BB2: |
| 18 | %f1 = or i133 -1, %A |
| 19 | %f2 = lshr i133 %f1, 33 |
| 20 | %f3 = trunc i133 %f2 to i100 |
| 21 | br label %BB3 |
| 22 | BB3: |
| 23 | %Ret = phi i100 [%t4, %BB1], [%f3, %BB2] |
| 24 | ret i100 %Ret |
| 25 | } |