1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[SelectionDAG] Add support for vector demandedelts in TRUNCATE opcodes

llvm-svn: 286481
This commit is contained in:
Simon Pilgrim 2016-11-10 17:43:52 +00:00
parent 334f136dbd
commit 9b52058816
2 changed files with 4 additions and 13 deletions

View File

@ -2394,7 +2394,8 @@ void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
unsigned InBits = InVT.getScalarSizeInBits(); unsigned InBits = InVT.getScalarSizeInBits();
KnownZero = KnownZero.zext(InBits); KnownZero = KnownZero.zext(InBits);
KnownOne = KnownOne.zext(InBits); KnownOne = KnownOne.zext(InBits);
computeKnownBits(Op.getOperand(0), KnownZero, KnownOne, Depth+1); computeKnownBits(Op.getOperand(0), KnownZero, KnownOne, DemandedElts,
Depth + 1);
KnownZero = KnownZero.trunc(BitWidth); KnownZero = KnownZero.trunc(BitWidth);
KnownOne = KnownOne.trunc(BitWidth); KnownOne = KnownOne.trunc(BitWidth);
break; break;

View File

@ -190,22 +190,12 @@ define <4 x i32> @knownbits_mask_mul_shuffle_shl(<4 x i32> %a0, <4 x i32> %a1) n
define <4 x i32> @knownbits_mask_trunc_shuffle_shl(<4 x i64> %a0) nounwind { define <4 x i32> @knownbits_mask_trunc_shuffle_shl(<4 x i64> %a0) nounwind {
; X32-LABEL: knownbits_mask_trunc_shuffle_shl: ; X32-LABEL: knownbits_mask_trunc_shuffle_shl:
; X32: # BB#0: ; X32: # BB#0:
; X32-NEXT: vandps {{\.LCPI.*}}, %ymm0, %ymm0 ; X32-NEXT: vxorps %xmm0, %xmm0, %xmm0
; X32-NEXT: vextractf128 $1, %ymm0, %xmm1
; X32-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
; X32-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,2,2]
; X32-NEXT: vpslld $22, %xmm0, %xmm0
; X32-NEXT: vzeroupper
; X32-NEXT: retl ; X32-NEXT: retl
; ;
; X64-LABEL: knownbits_mask_trunc_shuffle_shl: ; X64-LABEL: knownbits_mask_trunc_shuffle_shl:
; X64: # BB#0: ; X64: # BB#0:
; X64-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0 ; X64-NEXT: vxorps %xmm0, %xmm0, %xmm0
; X64-NEXT: vextractf128 $1, %ymm0, %xmm1
; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
; X64-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,2,2]
; X64-NEXT: vpslld $22, %xmm0, %xmm0
; X64-NEXT: vzeroupper
; X64-NEXT: retq ; X64-NEXT: retq
%1 = and <4 x i64> %a0, <i64 -65536, i64 -7, i64 7, i64 -65536> %1 = and <4 x i64> %a0, <i64 -65536, i64 -7, i64 7, i64 -65536>
%2 = trunc <4 x i64> %1 to <4 x i32> %2 = trunc <4 x i64> %1 to <4 x i32>