Skip to content

[X86] combineINSERT_SUBVECTOR - use concatSubVectors instead of direct fold to X86ISD::SUBV_BROADCAST_LOAD #140919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59360,7 +59360,8 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
}

// If we're splatting the lower half subvector of a full vector load into the
// upper half, attempt to create a subvector broadcast.
// upper half, just splat the subvector directly, potentially creating a
// subvector broadcast.
// TODO: Drop hasOneUse checks.
if ((int)IdxVal == (VecNumElts / 2) &&
Vec.getValueSizeInBits() == (2 * SubVec.getValueSizeInBits()) &&
Expand All @@ -59370,12 +59371,7 @@ static SDValue combineINSERT_SUBVECTOR(SDNode *N, SelectionDAG &DAG,
if (VecLd && SubLd &&
DAG.areNonVolatileConsecutiveLoads(
SubLd, VecLd, SubVec.getValueSizeInBits() / 8, 0)) {
SDValue BcastLd = getBROADCAST_LOAD(X86ISD::SUBV_BROADCAST_LOAD, dl, OpVT,
SubVecVT, SubLd, 0, DAG);
SDValue NewSubVec = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, SubVecVT,
BcastLd, DAG.getVectorIdxConstant(0, dl));
DCI.CombineTo(SubLd, NewSubVec, BcastLd.getValue(1));
return BcastLd;
return concatSubVectors(SubVec, SubVec, DAG, dl);
}
}

Expand Down