Skip to content

Commit 53900a1

Browse files
committed
[X86][AVX] combineConcatVectorOps - use getBROADCAST_LOAD helper for splat of normal vector loads. NFCI.
Reapplied from rG1cfecf4fc427 with fix for PR51226 - ensure the load is a normal (non-ext) load.
1 parent dd5ce50 commit 53900a1

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -51665,9 +51665,11 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5166551665
if (Op0.getOpcode() == X86ISD::VBROADCAST)
5166651666
return DAG.getNode(Op0.getOpcode(), DL, VT, Op0.getOperand(0));
5166751667

51668-
// If this scalar/subvector broadcast_load is inserted into both halves, use
51669-
// a larger broadcast_load. Update other uses to use an extracted subvector.
51670-
if (Op0.getOpcode() == X86ISD::VBROADCAST_LOAD ||
51668+
// If this simple subvector or scalar/subvector broadcast_load is inserted
51669+
// into both halves, use a larger broadcast_load. Update other uses to use
51670+
// an extracted subvector.
51671+
if (ISD::isNormalLoad(Op0.getNode()) ||
51672+
Op0.getOpcode() == X86ISD::VBROADCAST_LOAD ||
5167151673
Op0.getOpcode() == X86ISD::SUBV_BROADCAST_LOAD) {
5167251674
auto *Mem = cast<MemSDNode>(Op0);
5167351675
unsigned Opc = Op0.getOpcode() == X86ISD::VBROADCAST_LOAD
@@ -51682,24 +51684,6 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5168251684
}
5168351685
}
5168451686

51685-
// If this is a simple subvector load repeated across multiple lanes, then
51686-
// broadcast the load. Update other uses to use an extracted subvector.
51687-
if (auto *Ld = dyn_cast<LoadSDNode>(Op0)) {
51688-
if (Ld->isSimple() && !Ld->isNonTemporal() &&
51689-
Ld->getExtensionType() == ISD::NON_EXTLOAD) {
51690-
SDVTList Tys = DAG.getVTList(VT, MVT::Other);
51691-
SDValue Ops[] = {Ld->getChain(), Ld->getBasePtr()};
51692-
SDValue BcastLd =
51693-
DAG.getMemIntrinsicNode(X86ISD::SUBV_BROADCAST_LOAD, DL, Tys, Ops,
51694-
Ld->getMemoryVT(), Ld->getMemOperand());
51695-
DAG.ReplaceAllUsesOfValueWith(
51696-
Op0,
51697-
extractSubVector(BcastLd, 0, DAG, DL, Op0.getValueSizeInBits()));
51698-
DAG.ReplaceAllUsesOfValueWith(SDValue(Ld, 1), BcastLd.getValue(1));
51699-
return BcastLd;
51700-
}
51701-
}
51702-
5170351687
// concat_vectors(movddup(x),movddup(x)) -> broadcast(x)
5170451688
if (Op0.getOpcode() == X86ISD::MOVDDUP && VT == MVT::v4f64 &&
5170551689
(Subtarget.hasAVX2() ||

0 commit comments

Comments
 (0)