merge cast2 into cast.ll

llvm-svn: 92784
This commit is contained in:
Chris Lattner 2010-01-05 21:48:13 +00:00
parent 311b5584e5
commit fd23a9b6dd
2 changed files with 37 additions and 37 deletions

View File

@ -337,3 +337,40 @@ define i64 @test38(i32 %a) {
; CHECK: %2 = zext i1 %1 to i64
; CHECK: ret i64 %2
}
define i16 @test39(i16 %a) {
%tmp = zext i16 %a to i32
%tmp21 = lshr i32 %tmp, 8
%tmp5 = shl i32 %tmp, 8
%tmp.upgrd.32 = or i32 %tmp21, %tmp5
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16
ret i16 %tmp.upgrd.3
; CHECK: @test39
; CHECK: %tmp.upgrd.32 = call i16 @llvm.bswap.i16(i16 %a)
; CHECK: ret i16 %tmp.upgrd.32
}
define i16 @test40(i16 %a) {
%tmp = zext i16 %a to i32
%tmp21 = lshr i32 %tmp, 9
%tmp5 = shl i32 %tmp, 8
%tmp.upgrd.32 = or i32 %tmp21, %tmp5
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16
ret i16 %tmp.upgrd.3
; CHECK: @test40
; CHECK: %tmp21 = lshr i16 %a, 9
; CHECK: %tmp5 = shl i16 %a, 8
; CHECK: %tmp.upgrd.32 = or i16 %tmp21, %tmp5
; CHECK: ret i16 %tmp.upgrd.32
}
; PR1263
define i32* @test41(i32* %tmp1) {
%tmp64 = bitcast i32* %tmp1 to { i32 }*
%tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0
ret i32* %tmp65
; CHECK: @test41
; CHECK: ret i32* %tmp1
}

View File

@ -1,37 +0,0 @@
; Tests to make sure elimination of casts is working correctly
; RUN: opt < %s -instcombine -S | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
define i16 @test1(i16 %a) {
%tmp = zext i16 %a to i32 ; <i32> [#uses=2]
%tmp21 = lshr i32 %tmp, 8 ; <i32> [#uses=1]
%tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1]
%tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
ret i16 %tmp.upgrd.3
; CHECK: %tmp.upgrd.32 = call i16 @llvm.bswap.i16(i16 %a)
; CHECK: ret i16 %tmp.upgrd.32
}
define i16 @test2(i16 %a) {
%tmp = zext i16 %a to i32 ; <i32> [#uses=2]
%tmp21 = lshr i32 %tmp, 9 ; <i32> [#uses=1]
%tmp5 = shl i32 %tmp, 8 ; <i32> [#uses=1]
%tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; <i32> [#uses=1]
%tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to i16 ; <i16> [#uses=1]
ret i16 %tmp.upgrd.3
; CHECK: %tmp21 = lshr i16 %a, 9
; CHECK: %tmp5 = shl i16 %a, 8
; CHECK: %tmp.upgrd.32 = or i16 %tmp21, %tmp5
; CHECK: ret i16 %tmp.upgrd.32
}
; PR1263
define i32* @test3(i32* %tmp1) {
%tmp64 = bitcast i32* %tmp1 to { i32 }* ; <{ i32 }*> [#uses=1]
%tmp65 = getelementptr { i32 }* %tmp64, i32 0, i32 0 ; <i32*> [#uses=1]
ret i32* %tmp65
; CHECK: ret i32* %tmp1
}