From 50ca0204c5b81c736c26f07fc49a0c19594f1d10 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 5 Jan 2010 21:48:13 +0000 Subject: [PATCH] merge cast2 into cast.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92784 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/cast.ll | 37 ++++++++++++++++++++++++++++ test/Transforms/InstCombine/cast2.ll | 37 ---------------------------- 2 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 test/Transforms/InstCombine/cast2.ll diff --git a/test/Transforms/InstCombine/cast.ll b/test/Transforms/InstCombine/cast.ll index 5f75cd0a893..5bcfded872c 100644 --- a/test/Transforms/InstCombine/cast.ll +++ b/test/Transforms/InstCombine/cast.ll @@ -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 +} + + diff --git a/test/Transforms/InstCombine/cast2.ll b/test/Transforms/InstCombine/cast2.ll deleted file mode 100644 index 2941ee0e702..00000000000 --- a/test/Transforms/InstCombine/cast2.ll +++ /dev/null @@ -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 ; [#uses=2] - %tmp21 = lshr i32 %tmp, 8 ; [#uses=1] - %tmp5 = shl i32 %tmp, 8 ; [#uses=1] - %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; [#uses=1] - %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to 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 ; [#uses=2] - %tmp21 = lshr i32 %tmp, 9 ; [#uses=1] - %tmp5 = shl i32 %tmp, 8 ; [#uses=1] - %tmp.upgrd.32 = or i32 %tmp21, %tmp5 ; [#uses=1] - %tmp.upgrd.3 = trunc i32 %tmp.upgrd.32 to 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 ; [#uses=1] - ret i32* %tmp65 -; CHECK: ret i32* %tmp1 -} - -