[PATCH] D123683: [SVE] Refactor MGATHER lowering for unsupported passthru values.
Paul Walker via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 08:15:45 PDT 2022
paulwalker-arm created this revision.
Herald added subscribers: psnobl, hiraditya, tschuett.
Herald added a reviewer: efriedma.
Herald added a project: All.
paulwalker-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Handle unsupported passthru values before lowering the gather to
target specific nodes. This is a simplification that's on the road
to moving more of MGATHER lowering into td based isel.
Depends On D123670 <https://reviews.llvm.org/D123670>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D123683
Files:
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -4664,6 +4664,17 @@
ISD::LoadExtType ExtType = MGT->getExtensionType();
ISD::MemIndexType IndexType = MGT->getIndexType();
+ // SVE supports zero (and so undef) passthrough values only, everything else
+ // must be handled manually by an explicit select on the load's output.
+ if (!PassThru->isUndef() && !isZerosVector(PassThru.getNode())) {
+ SDValue Ops[] = {Chain, DAG.getUNDEF(VT), Mask, BasePtr, Index, Scale};
+ SDValue Load =
+ DAG.getMaskedGather(MGT->getVTList(), MemVT, DL, Ops,
+ MGT->getMemOperand(), IndexType, ExtType);
+ SDValue Select = DAG.getSelect(DL, VT, Mask, Load, PassThru);
+ return DAG.getMergeValues({Select, Load.getValue(1)}, DL);
+ }
+
bool IsScaled =
IndexType == ISD::SIGNED_SCALED || IndexType == ISD::UNSIGNED_SCALED;
bool IsSigned =
@@ -4710,17 +4721,9 @@
VT.changeVectorElementType(IndexVT.getVectorElementType()), Mask);
}
- if (PassThru->isUndef() || isZerosVector(PassThru.getNode()))
- PassThru = SDValue();
-
- if (VT.isFloatingPoint() && !IsFixedLength) {
- // Handle FP data by using an integer gather and casting the result.
- if (PassThru) {
- EVT PassThruVT = getPackedSVEVectorVT(VT.getVectorElementCount());
- PassThru = getSVESafeBitCast(PassThruVT, PassThru, DAG);
- }
+ // Handle FP data by using an integer gather and casting the result.
+ if (VT.isFloatingPoint() && !IsFixedLength)
InputVT = DAG.getValueType(MemVT.changeVectorElementTypeToInteger());
- }
SDVTList VTs = DAG.getVTList(IndexVT, MVT::Other);
@@ -4752,16 +4755,8 @@
Result);
Result = DAG.getNode(ISD::TRUNCATE, DL, VT.changeTypeToInteger(), Result);
Result = DAG.getNode(ISD::BITCAST, DL, VT, Result);
-
- if (PassThru)
- Result = DAG.getSelect(DL, VT, MGT->getMask(), Result, PassThru);
- } else {
- if (PassThru)
- Result = DAG.getSelect(DL, IndexVT, Mask, Result, PassThru);
-
- if (VT.isFloatingPoint())
- Result = getSVESafeBitCast(VT, Result, DAG);
- }
+ } else if (VT.isFloatingPoint())
+ Result = getSVESafeBitCast(VT, Result, DAG);
return DAG.getMergeValues({Result, Chain}, DL);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123683.422523.patch
Type: text/x-patch
Size: 2419 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220413/a3b24ba3/attachment.bin>
More information about the llvm-commits
mailing list