[PATCH] D116594: [VP][ISel] use LEGALPOS for legalization action
Simon Moll via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 04:33:51 PST 2022
simoll created this revision.
simoll added reviewers: craig.topper, frasercrmck, rogfer01, RKSimon, victor-eds.
simoll added a project: VP.
Herald added subscribers: dexonsmith, hiraditya.
simoll requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Use the VPIntrinsics.def's LEGALPOS that is specified with every VP SDNode to determine which return or operand value type shall be used to infer the legalization action.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116594
Files:
llvm/include/llvm/IR/VPIntrinsics.def
llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
@@ -350,7 +350,6 @@
case ISD::CTPOP:
case ISD::SELECT:
case ISD::VSELECT:
- case ISD::VP_SELECT:
case ISD::SELECT_CC:
case ISD::ZERO_EXTEND:
case ISD::ANY_EXTEND:
@@ -459,6 +458,14 @@
Action = TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0));
break;
}
+
+#define BEGIN_REGISTER_VP_SDNODE(VPID, LEGALPOS, ...) \
+ case ISD::VPID: { \
+ EVT LegalizeVT = LEGALPOS < 0 ? Node->getValueType(-(1 + LEGALPOS)) \
+ : Node->getOperand(LEGALPOS).getValueType(); \
+ Action = TLI.getOperationAction(Node->getOpcode(), LegalizeVT); \
+ } break;
+#include "llvm/IR/VPIntrinsics.def"
}
LLVM_DEBUG(dbgs() << "\nLegalizing vector op: "; Node->dump(&DAG));
Index: llvm/include/llvm/IR/VPIntrinsics.def
===================================================================
--- llvm/include/llvm/IR/VPIntrinsics.def
+++ llvm/include/llvm/IR/VPIntrinsics.def
@@ -39,9 +39,9 @@
// same name. Since the operands are also the same, we open the property
// scopes for both the VPIntrinsic and the SDNode at once.
// \p VPSD The SelectionDAG Node id (eg VP_ADD).
-// \p LEGALPOS The operand position of the SDNode that is used for legalizing
-// this SDNode. This can be `-1`, in which case the return type of
-// the SDNode is used.
+// \p LEGALPOS The operand position of the SDNode that is used for legalizing.
+// If LEGALPOS < 0, then the return type given by
+// TheNode->getValueType(-1-LEGALPOS) is used.
// \p TDNAME The name of the TableGen definition of this SDNode.
// \p MASKPOS The mask operand position.
// \p EVLPOS The explicit vector length operand position.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116594.397264.patch
Type: text/x-patch
Size: 2054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220104/d2e72521/attachment.bin>
More information about the llvm-commits
mailing list