1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00

[InstCombine] add tests for trunc(shuffle X, C, M); NFC

llvm-svn: 295513
This commit is contained in:
Sanjay Patel 2017-02-17 23:16:54 +00:00
parent e6e3ee6e99
commit 07d20a8352

View File

@ -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
}