From: Sanjay Patel Date: Fri, 17 Feb 2017 23:16:54 +0000 (+0000) Subject: [InstCombine] add tests for trunc(shuffle X, C, M); NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e581944506d4ada4edc87dd51792efcf96c9f0c1;p=llvm [InstCombine] add tests for trunc(shuffle X, C, M); NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295513 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Transforms/InstCombine/trunc.ll b/test/Transforms/InstCombine/trunc.ll index eaa45bbb286..1da4f42ccc4 100644 --- a/test/Transforms/InstCombine/trunc.ll +++ b/test/Transforms/InstCombine/trunc.ll @@ -119,8 +119,8 @@ define i64 @test8(i32 %A, i32 %B) { define i8 @test9(i32 %X) { ; CHECK-LABEL: @test9( -; CHECK-NEXT: [[X_TR:%.*]] = trunc i32 %X to i8 -; CHECK-NEXT: [[Z:%.*]] = and i8 [[X_TR]], 42 +; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 %X to i8 +; CHECK-NEXT: [[Z:%.*]] = and i8 [[TMP1]], 42 ; CHECK-NEXT: ret i8 [[Z]] ; %Y = and i32 %X, 42 @@ -464,3 +464,30 @@ define <8 x i16> @trunc_shl_v8i16_v8i32_4(<8 x i32> %a) { ret <8 x i16> %conv } +; FIXME: trunc (shuffle X, C, Mask) --> shuffle (trunc X), C', Mask + +define <4 x i8> @shuf1(<4 x i32> %x) { +; CHECK-LABEL: @shuf1( +; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> %x, <4 x i32> , <4 x i32> +; CHECK-NEXT: [[TRUNC:%.*]] = trunc <4 x i32> [[SHUF]] to <4 x i8> +; CHECK-NEXT: ret <4 x i8> [[TRUNC]] +; + %shuf = shufflevector <4 x i32> %x, <4 x i32> , <4 x i32> + %trunc = trunc <4 x i32> %shuf to <4 x i8> + ret <4 x i8> %trunc +} + +; TODO: Shuffle with constant operand should be canonicalized to operand 1? +; FIXME: trunc (shuffle C, X, Mask) --> shuffle C', (trunc X), Mask + +define <4 x i8> @shuf2(<4 x i32> %x) { +; CHECK-LABEL: @shuf2( +; CHECK-NEXT: [[SHUF:%.*]] = shufflevector <4 x i32> , <4 x i32> %x, <4 x i32> +; CHECK-NEXT: [[TRUNC:%.*]] = trunc <4 x i32> [[SHUF]] to <4 x i8> +; CHECK-NEXT: ret <4 x i8> [[TRUNC]] +; + %shuf = shufflevector <4 x i32> , <4 x i32> %x, <4 x i32> + %trunc = trunc <4 x i32> %shuf to <4 x i8> + ret <4 x i8> %trunc +} +