forked from OSchip/llvm-project
[X86] Prevent (bitcast (broadcast_load)) combine from producing vXf16 broadcast instructions.
The combine tries to put the broadcast in either the integer or fp domain to match the bitcast domain. But we can only do this if the broadcast size is 32 or larger.
This commit is contained in:
parent
ce5173c0e1
commit
32fbea1548
|
@ -37385,19 +37385,22 @@ static SDValue combineBitcast(SDNode *N, SelectionDAG &DAG,
|
||||||
auto *BCast = cast<MemIntrinsicSDNode>(N0);
|
auto *BCast = cast<MemIntrinsicSDNode>(N0);
|
||||||
unsigned SrcVTSize = SrcVT.getScalarSizeInBits();
|
unsigned SrcVTSize = SrcVT.getScalarSizeInBits();
|
||||||
unsigned MemSize = BCast->getMemoryVT().getScalarSizeInBits();
|
unsigned MemSize = BCast->getMemoryVT().getScalarSizeInBits();
|
||||||
MVT MemVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(MemSize)
|
// Don't swap i8/i16 since don't have fp types that size.
|
||||||
: MVT::getIntegerVT(MemSize);
|
if (MemSize >= 32) {
|
||||||
MVT LoadVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(SrcVTSize)
|
MVT MemVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(MemSize)
|
||||||
: MVT::getIntegerVT(SrcVTSize);
|
: MVT::getIntegerVT(MemSize);
|
||||||
LoadVT = MVT::getVectorVT(LoadVT, SrcVT.getVectorNumElements());
|
MVT LoadVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(SrcVTSize)
|
||||||
|
: MVT::getIntegerVT(SrcVTSize);
|
||||||
|
LoadVT = MVT::getVectorVT(LoadVT, SrcVT.getVectorNumElements());
|
||||||
|
|
||||||
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
|
||||||
SDValue Ops[] = { BCast->getChain(), BCast->getBasePtr() };
|
SDValue Ops[] = { BCast->getChain(), BCast->getBasePtr() };
|
||||||
SDValue ResNode =
|
SDValue ResNode =
|
||||||
DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, SDLoc(N), Tys, Ops,
|
DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, SDLoc(N), Tys, Ops,
|
||||||
MemVT, BCast->getMemOperand());
|
MemVT, BCast->getMemOperand());
|
||||||
DAG.ReplaceAllUsesOfValueWith(SDValue(BCast, 1), ResNode.getValue(1));
|
DAG.ReplaceAllUsesOfValueWith(SDValue(BCast, 1), ResNode.getValue(1));
|
||||||
return DAG.getBitcast(VT, ResNode);
|
return DAG.getBitcast(VT, ResNode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since MMX types are special and don't usually play with other vector types,
|
// Since MMX types are special and don't usually play with other vector types,
|
||||||
|
|
Loading…
Reference in New Issue