@@ -41694,6 +41694,8 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4169441694 TargetLowering::DAGCombinerInfo &DCI,
4169541695 const X86Subtarget &Subtarget) {
4169641696 MVT VT = N.getSimpleValueType();
41697+ unsigned NumElts = VT.getVectorNumElements();
41698+
4169741699 SmallVector<int, 4> Mask;
4169841700 unsigned Opcode = N.getOpcode();
4169941701 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
@@ -41979,7 +41981,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4197941981 APInt Mask = APInt::getHighBitsSet(64, 32);
4198041982 if (DAG.MaskedValueIsZero(In, Mask)) {
4198141983 SDValue Trunc = DAG.getNode(ISD::TRUNCATE, DL, MVT::i32, In);
41982- MVT VecVT = MVT::getVectorVT(MVT::i32, VT.getVectorNumElements() * 2);
41984+ MVT VecVT = MVT::getVectorVT(MVT::i32, NumElts * 2);
4198341985 SDValue SclVec = DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, VecVT, Trunc);
4198441986 SDValue Movl = DAG.getNode(X86ISD::VZEXT_MOVL, DL, VecVT, SclVec);
4198541987 return DAG.getBitcast(VT, Movl);
@@ -41994,7 +41996,6 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4199441996 // Create a vector constant - scalar constant followed by zeros.
4199541997 EVT ScalarVT = N0.getOperand(0).getValueType();
4199641998 Type *ScalarTy = ScalarVT.getTypeForEVT(*DAG.getContext());
41997- unsigned NumElts = VT.getVectorNumElements();
4199841999 Constant *Zero = ConstantInt::getNullValue(ScalarTy);
4199942000 SmallVector<Constant *, 32> ConstantVec(NumElts, Zero);
4200042001 ConstantVec[0] = const_cast<ConstantInt *>(C->getConstantIntValue());
@@ -42045,9 +42046,8 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4204542046 MVT SrcVT = N0.getOperand(0).getSimpleValueType();
4204642047 unsigned SrcBits = SrcVT.getScalarSizeInBits();
4204742048 if ((EltBits % SrcBits) == 0 && SrcBits >= 32) {
42048- unsigned Size = VT.getVectorNumElements();
4204942049 unsigned NewSize = SrcVT.getVectorNumElements();
42050- APInt BlendMask = N.getConstantOperandAPInt(2).zextOrTrunc(Size );
42050+ APInt BlendMask = N.getConstantOperandAPInt(2).zextOrTrunc(NumElts );
4205142051 APInt NewBlendMask = APIntOps::ScaleBitMask(BlendMask, NewSize);
4205242052 return DAG.getBitcast(
4205342053 VT, DAG.getNode(X86ISD::BLENDI, DL, SrcVT, N0.getOperand(0),
@@ -42460,7 +42460,7 @@ static SDValue combineTargetShuffle(SDValue N, const SDLoc &DL,
4246042460 int DOffset = N.getOpcode() == X86ISD::PSHUFLW ? 0 : 2;
4246142461 DMask[DOffset + 0] = DOffset + 1;
4246242462 DMask[DOffset + 1] = DOffset + 0;
42463- MVT DVT = MVT::getVectorVT(MVT::i32, VT.getVectorNumElements() / 2);
42463+ MVT DVT = MVT::getVectorVT(MVT::i32, NumElts / 2);
4246442464 V = DAG.getBitcast(DVT, V);
4246542465 V = DAG.getNode(X86ISD::PSHUFD, DL, DVT, V,
4246642466 getV4X86ShuffleImm8ForMask(DMask, DL, DAG));
0 commit comments