blob: 4af79af84db26b8ff12830271d6a13d845382682 [file] [log] [blame]
Nick Lewycky37d04642009-04-23 05:15:08 +00001; RUN: llvm-as < %s | opt -analyze -scalar-evolution | grep truncate | not grep extend
2
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}