]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/InstCombine/zext.ll
Import LLVM, at r72732.
[FreeBSD/FreeBSD.git] / test / Transforms / InstCombine / zext.ll
1 ; Tests to make sure elimination of casts is working correctly
2 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
3 ; RUN:   notcast {} {%c1.*}
4
5 define i64 @test_sext_zext(i16 %A) {
6         %c1 = zext i16 %A to i32                ; <i32> [#uses=1]
7         %c2 = sext i32 %c1 to i64               ; <i64> [#uses=1]
8         ret i64 %c2
9 }
10
11 ; PR3599
12 define i32 @test2(i64 %tmp) nounwind readnone {
13 entry:
14         %tmp5 = trunc i64 %tmp to i8            ; <i8> [#uses=1]
15         %tmp7 = lshr i64 %tmp, 8                ; <i64> [#uses=1]
16         %tmp8 = trunc i64 %tmp7 to i8           ; <i8> [#uses=1]
17         %tmp10 = lshr i64 %tmp, 16              ; <i64> [#uses=1]
18         %tmp11 = trunc i64 %tmp10 to i8         ; <i8> [#uses=1]
19         %tmp13 = lshr i64 %tmp, 24              ; <i64> [#uses=1]
20         %tmp14 = trunc i64 %tmp13 to i8         ; <i8> [#uses=1]
21         %tmp1 = zext i8 %tmp5 to i32            ; <i32> [#uses=1]
22         %tmp2 = zext i8 %tmp8 to i32            ; <i32> [#uses=1]
23         %tmp3 = shl i32 %tmp2, 8                ; <i32> [#uses=1]
24         %tmp4 = zext i8 %tmp11 to i32           ; <i32> [#uses=1]
25         %tmp6 = shl i32 %tmp4, 16               ; <i32> [#uses=1]
26         %tmp9 = zext i8 %tmp14 to i32           ; <i32> [#uses=1]
27         %tmp12 = shl i32 %tmp9, 24              ; <i32> [#uses=1]
28         %tmp15 = or i32 %tmp12, %tmp1           ; <i32> [#uses=1]
29         %tmp16 = or i32 %tmp15, %tmp6           ; <i32> [#uses=1]
30         %tmp17 = or i32 %tmp16, %tmp3           ; <i32> [#uses=1]
31         ret i32 %tmp17
32 }
33