diff options
author | Simon Moll <simon.moll@emea.nec.com> | 2022-01-04 14:50:37 +0100 |
---|---|---|
committer | Simon Moll <simon.moll@emea.nec.com> | 2022-01-04 14:50:49 +0100 |
commit | 4c2aba999e54270871d5ff8f6c765e8b834dfe27 (patch) | |
tree | c3f974089d4abaefe2e3a727c17271243e87cfce | |
parent | 0a07c9662e67124b00e375aa4a395998d218b220 (diff) | |
download | llvm-4c2aba999e54270871d5ff8f6c765e8b834dfe27.tar.gz |
[VP][ISel] use LEGALPOS for legalization action
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.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D116594
-rw-r--r-- | llvm/include/llvm/IR/VPIntrinsics.def | 6 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/llvm/include/llvm/IR/VPIntrinsics.def b/llvm/include/llvm/IR/VPIntrinsics.def index 121c8bbc6c27..3b360d8d1506 100644 --- a/llvm/include/llvm/IR/VPIntrinsics.def +++ b/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. diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp index 96c5a79cf995..cbb28863850f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp @@ -350,7 +350,6 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) { 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 @@ SDValue VectorLegalizer::LegalizeOp(SDValue Op) { 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)); |