Skip to content

Commit 3ea8c2a

Browse files
committed
[X86] combineLoad - begun making the load split code more generic. NFCI.
This is currently only used for ymm->xmm splitting but we shouldn't hardcode the offsets/alignment. This is necessary for an upcoming patch to split under-aligned non-temporal vector loads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363570 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent bdd7b78 commit 3ea8c2a

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39111,27 +39111,26 @@ static SDValue combineLoad(SDNode *N, SelectionDAG &DAG,
3911139111
Ext == ISD::NON_EXTLOAD &&
3911239112
((Ld->isNonTemporal() && !Subtarget.hasInt256() && Alignment >= 16) ||
3911339113
(TLI.allowsMemoryAccess(*DAG.getContext(), DAG.getDataLayout(), RegVT,
39114-
*Ld->getMemOperand(), &Fast) && !Fast))) {
39114+
*Ld->getMemOperand(), &Fast) &&
39115+
!Fast))) {
3911539116
unsigned NumElems = RegVT.getVectorNumElements();
3911639117
if (NumElems < 2)
3911739118
return SDValue();
3911839119

39119-
SDValue Ptr = Ld->getBasePtr();
39120-
39120+
unsigned HalfAlign = 16;
39121+
SDValue Ptr1 = Ld->getBasePtr();
39122+
SDValue Ptr2 = DAG.getMemBasePlusOffset(Ptr1, HalfAlign, dl);
3912139123
EVT HalfVT = EVT::getVectorVT(*DAG.getContext(), MemVT.getScalarType(),
39122-
NumElems/2);
39124+
NumElems / 2);
3912339125
SDValue Load1 =
39124-
DAG.getLoad(HalfVT, dl, Ld->getChain(), Ptr, Ld->getPointerInfo(),
39126+
DAG.getLoad(HalfVT, dl, Ld->getChain(), Ptr1, Ld->getPointerInfo(),
3912539127
Alignment, Ld->getMemOperand()->getFlags());
39126-
39127-
Ptr = DAG.getMemBasePlusOffset(Ptr, 16, dl);
39128-
SDValue Load2 =
39129-
DAG.getLoad(HalfVT, dl, Ld->getChain(), Ptr,
39130-
Ld->getPointerInfo().getWithOffset(16),
39131-
MinAlign(Alignment, 16U), Ld->getMemOperand()->getFlags());
39128+
SDValue Load2 = DAG.getLoad(HalfVT, dl, Ld->getChain(), Ptr2,
39129+
Ld->getPointerInfo().getWithOffset(HalfAlign),
39130+
MinAlign(Alignment, HalfAlign),
39131+
Ld->getMemOperand()->getFlags());
3913239132
SDValue TF = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
39133-
Load1.getValue(1),
39134-
Load2.getValue(1));
39133+
Load1.getValue(1), Load2.getValue(1));
3913539134

3913639135
SDValue NewVec = DAG.getNode(ISD::CONCAT_VECTORS, dl, RegVT, Load1, Load2);
3913739136
return DCI.CombineTo(N, NewVec, TF, true);

0 commit comments

Comments
 (0)