Chandler Carruth | 4177e6f | 2012-07-02 12:47:22 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -analyze -scalar-evolution | grep "(trunc i" | not grep ext |
Nick Lewycky | 5cd28fa | 2009-04-23 05:15:08 +0000 | [diff] [blame] | 2 | |
| 3 | define i16 @test1(i8 %x) { |
| 4 | %A = sext i8 %x to i32 |
| 5 | %B = trunc i32 %A to i16 |
| 6 | ret i16 %B |
| 7 | } |
| 8 | |
| 9 | define i8 @test2(i16 %x) { |
| 10 | %A = sext i16 %x to i32 |
| 11 | %B = trunc i32 %A to i8 |
| 12 | ret i8 %B |
| 13 | } |
| 14 | |
| 15 | define i16 @test3(i16 %x) { |
| 16 | %A = sext i16 %x to i32 |
| 17 | %B = trunc i32 %A to i16 |
| 18 | ret i16 %B |
| 19 | } |
| 20 | |
| 21 | define i16 @test4(i8 %x) { |
| 22 | %A = zext i8 %x to i32 |
| 23 | %B = trunc i32 %A to i16 |
| 24 | ret i16 %B |
| 25 | } |
| 26 | |
| 27 | define i8 @test5(i16 %x) { |
| 28 | %A = zext i16 %x to i32 |
| 29 | %B = trunc i32 %A to i8 |
| 30 | ret i8 %B |
| 31 | } |
| 32 | |
| 33 | define i16 @test6(i16 %x) { |
| 34 | %A = zext i16 %x to i32 |
| 35 | %B = trunc i32 %A to i16 |
| 36 | ret i16 %B |
| 37 | } |