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