[llvm] 32fbea1 - [X86] Prevent (bitcast (broadcast_load)) combine from producing vXf16 broadcast instructions.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 20 09:16:21 PDT 2020
Author: Craig Topper
Date: 2020-03-20T09:15:07-07:00
New Revision: 32fbea15485dbb04ad7222ffb017a9356c159d81
URL: https://github.com/llvm/llvm-project/commit/32fbea15485dbb04ad7222ffb017a9356c159d81
DIFF: https://github.com/llvm/llvm-project/commit/32fbea15485dbb04ad7222ffb017a9356c159d81.diff
LOG: [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.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index e4bf4ab68538..575803f03239 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -37385,19 +37385,22 @@ static SDValue combineBitcast(SDNode *N, SelectionDAG &DAG,
auto *BCast = cast<MemIntrinsicSDNode>(N0);
unsigned SrcVTSize = SrcVT.getScalarSizeInBits();
unsigned MemSize = BCast->getMemoryVT().getScalarSizeInBits();
- MVT MemVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(MemSize)
- : MVT::getIntegerVT(MemSize);
- MVT LoadVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(SrcVTSize)
- : MVT::getIntegerVT(SrcVTSize);
- LoadVT = MVT::getVectorVT(LoadVT, SrcVT.getVectorNumElements());
-
- SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
- SDValue Ops[] = { BCast->getChain(), BCast->getBasePtr() };
- SDValue ResNode =
- DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, SDLoc(N), Tys, Ops,
- MemVT, BCast->getMemOperand());
- DAG.ReplaceAllUsesOfValueWith(SDValue(BCast, 1), ResNode.getValue(1));
- return DAG.getBitcast(VT, ResNode);
+ // Don't swap i8/i16 since don't have fp types that size.
+ if (MemSize >= 32) {
+ MVT MemVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(MemSize)
+ : MVT::getIntegerVT(MemSize);
+ MVT LoadVT = VT.isFloatingPoint() ? MVT::getFloatingPointVT(SrcVTSize)
+ : MVT::getIntegerVT(SrcVTSize);
+ LoadVT = MVT::getVectorVT(LoadVT, SrcVT.getVectorNumElements());
+
+ SDVTList Tys = DAG.getVTList(LoadVT, MVT::Other);
+ SDValue Ops[] = { BCast->getChain(), BCast->getBasePtr() };
+ SDValue ResNode =
+ DAG.getMemIntrinsicNode(X86ISD::VBROADCAST_LOAD, SDLoc(N), Tys, Ops,
+ MemVT, BCast->getMemOperand());
+ DAG.ReplaceAllUsesOfValueWith(SDValue(BCast, 1), ResNode.getValue(1));
+ return DAG.getBitcast(VT, ResNode);
+ }
}
// Since MMX types are special and don't usually play with other vector types,
More information about the llvm-commits
mailing list