Skip to content

Commit

Permalink
[SelectionDAG] Add SIGN_EXTEND_VECTOR_INREG support to computeKnownBits.
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D56168

llvm-svn: 350179
  • Loading branch information
topperc committed Dec 31, 2018
1 parent bb0873c commit ed3ffae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
10 changes: 9 additions & 1 deletion llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2827,7 +2827,15 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
Known.Zero.setBitsFrom(InVT.getScalarSizeInBits());
break;
}
// TODO ISD::SIGN_EXTEND_VECTOR_INREG
case ISD::SIGN_EXTEND_VECTOR_INREG: {
EVT InVT = Op.getOperand(0).getValueType();
APInt InDemandedElts = DemandedElts.zextOrSelf(InVT.getVectorNumElements());
Known = computeKnownBits(Op.getOperand(0), InDemandedElts, Depth + 1);
// If the sign bit is known to be zero or one, then sext will extend
// it to the top bits, else it will just zext.
Known = Known.sext(BitWidth);
break;
}
case ISD::SIGN_EXTEND: {
Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
// If the sign bit is known to be zero or one, then sext will extend
Expand Down
14 changes: 4 additions & 10 deletions llvm/test/CodeGen/X86/combine-shl.ll
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,11 @@ define <8 x i32> @combine_vec_shl_ext_shl1(<8 x i16> %x) {
; SSE41-LABEL: combine_vec_shl_ext_shl1:
; SSE41: # %bb.0:
; SSE41-NEXT: pmullw {{.*}}(%rip), %xmm0
; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,0,1]
; SSE41-NEXT: pmovsxwd %xmm1, %xmm1
; SSE41-NEXT: pmovsxwd %xmm0, %xmm0
; SSE41-NEXT: movdqa %xmm0, %xmm2
; SSE41-NEXT: pslld $30, %xmm2
; SSE41-NEXT: pslld $31, %xmm0
; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm2[4,5,6,7]
; SSE41-NEXT: movdqa %xmm1, %xmm2
; SSE41-NEXT: pslld $28, %xmm2
; SSE41-NEXT: pslld $29, %xmm1
; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0,1,2,3],xmm2[4,5,6,7]
; SSE41-NEXT: pslld $30, %xmm0
; SSE41-NEXT: pxor %xmm1, %xmm1
; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
; SSE41-NEXT: pxor %xmm1, %xmm1
; SSE41-NEXT: retq
;
; AVX-LABEL: combine_vec_shl_ext_shl1:
Expand Down

0 comments on commit ed3ffae

Please sign in to comment.