@@ -58562,16 +58562,22 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
5856258562
5856358563 // If we're splatting the lower half subvector of a full vector load into the
5856458564 // upper half, attempt to create a subvector broadcast.
58565+ // TODO: Drop hasOneUse checks.
5856558566 if (IdxVal == (OpVT.getVectorNumElements() / 2) &&
5856658567 Vec.getValueSizeInBits() == (2 * SubVec.getValueSizeInBits()) &&
5856758568 (Vec.hasOneUse() || SubVec.hasOneUse())) {
5856858569 auto *VecLd = dyn_cast<LoadSDNode>(Vec);
5856958570 auto *SubLd = dyn_cast<LoadSDNode>(SubVec);
5857058571 if (VecLd && SubLd &&
58571- DAG.areNonVolatileConsecutiveLoads(SubLd, VecLd,
58572- SubVec.getValueSizeInBits() / 8, 0))
58573- return getBROADCAST_LOAD(X86ISD::SUBV_BROADCAST_LOAD, dl, OpVT, SubVecVT,
58574- SubLd, 0, DAG);
58572+ DAG.areNonVolatileConsecutiveLoads(
58573+ SubLd, VecLd, SubVec.getValueSizeInBits() / 8, 0)) {
58574+ SDValue BcastLd = getBROADCAST_LOAD(X86ISD::SUBV_BROADCAST_LOAD, dl, OpVT,
58575+ SubVecVT, SubLd, 0, DAG);
58576+ SDValue NewSubVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SubVecVT,
58577+ BcastLd, DAG.getVectorIdxConstant(0, dl));
58578+ DCI.CombineTo(SubLd, NewSubVec, BcastLd.getValue(1));
58579+ return BcastLd;
58580+ }
5857558581 }
5857658582
5857758583 return SDValue();
0 commit comments