diff options
| -rw-r--r-- | llvm/test/Transforms/InstCombine/trunc.ll | 31 | 
1 files changed, 29 insertions, 2 deletions
diff --git a/llvm/test/Transforms/InstCombine/trunc.ll b/llvm/test/Transforms/InstCombine/trunc.ll index eaa45bbb286..1da4f42ccc4 100644 --- a/llvm/test/Transforms/InstCombine/trunc.ll +++ b/llvm/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> <i32 undef, i32 3634, i32 90, i32 undef>, <4 x i32> <i32 1, i32 5, i32 6, i32 2> +; 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> <i32 35, i32 3634, i32 90, i32 -1>, <4 x i32> <i32 1, i32 5, i32 6, i32 2> +  %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> <i32 -3500, i32 undef, i32 undef, i32 -1>, <4 x i32> %x, <4 x i32> <i32 3, i32 6, i32 6, i32 0> +; CHECK-NEXT:    [[TRUNC:%.*]] = trunc <4 x i32> [[SHUF]] to <4 x i8> +; CHECK-NEXT:    ret <4 x i8> [[TRUNC]] +; +  %shuf = shufflevector <4 x i32> <i32 -3500, i32 3634, i32 90, i32 -1>, <4 x i32> %x, <4 x i32> <i32 3, i32 6, i32 6, i32 0> +  %trunc = trunc <4 x i32> %shuf to <4 x i8> +  ret <4 x i8> %trunc +} +  | 

