X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=test%2FTransforms%2FInstCombine%2Fbswap.ll;h=ba7df3125f4ef382afea9bf73642b7fe2b01b8bd;hb=7b837d8c75f78fe55c9b348b9ec2281169a48d2a;hp=5db4e73a546305f62b89ecb045cf13305ab12599;hpb=76806b6a434ad5477727d3733d18fe309a1281fe;p=oota-llvm.git diff --git a/test/Transforms/InstCombine/bswap.ll b/test/Transforms/InstCombine/bswap.ll index 5db4e73a546..ba7df3125f4 100644 --- a/test/Transforms/InstCombine/bswap.ll +++ b/test/Transforms/InstCombine/bswap.ll @@ -1,5 +1,7 @@ -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ -; RUN: grep {call.*llvm.bswap} | count 5 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32" + +; RUN: opt < %s -instcombine -S | \ +; RUN: grep "call.*llvm.bswap" | count 6 define i32 @test1(i32 %i) { %tmp1 = lshr i32 %i, 24 ; [#uses=1] @@ -55,3 +57,18 @@ define i16 @test5(i16 %a) { %retval = trunc i32 %tmp6.upgrd.4 to i16 ; [#uses=1] ret i16 %retval } + +; PR2842 +define i32 @test6(i32 %x) nounwind readnone { + %tmp = shl i32 %x, 16 ; [#uses=1] + %x.mask = and i32 %x, 65280 ; [#uses=1] + %tmp1 = lshr i32 %x, 16 ; [#uses=1] + %tmp2 = and i32 %tmp1, 255 ; [#uses=1] + %tmp3 = or i32 %x.mask, %tmp ; [#uses=1] + %tmp4 = or i32 %tmp3, %tmp2 ; [#uses=1] + %tmp5 = shl i32 %tmp4, 8 ; [#uses=1] + %tmp6 = lshr i32 %x, 24 ; [#uses=1] + %tmp7 = or i32 %tmp5, %tmp6 ; [#uses=1] + ret i32 %tmp7 +} +