RFR: 8346993: C2 SuperWord: refactor to make more vector nodes available in VectorNode::make
Emanuel Peter
epeter at openjdk.org
Mon Jan 6 07:44:57 UTC 2025
On Fri, 3 Jan 2025 15:44:02 GMT, Emanuel Peter <epeter at openjdk.org> wrote:
> Extracted from cost-model code https://github.com/openjdk/jdk/pull/20964.
>
> Currently, some nodes are only generated in their dedicated methods:
> - VectorNode::shift_count
> - LShiftCntVNode
> - RShiftCntVNode
> - VectorCastNode::make
> - Vector(U)Cast...
> - VectorBlendNode has no corresponding "factory" method.
>
> The goal is to have all available under VectorNode::make, so that they can be generated simply with the vector opcode. This is helpful for the plans with the cost-model, where the VTransform nodes will only carry the vector-opc, and I need to generate vectors for these vector-opc.
src/hotspot/share/opto/vectornode.cpp line 669:
> 667: }
> 668:
> 669: // Make a vector node for unary or binary operation
Note: there were already unary cases, this just fixes the comment.
src/hotspot/share/opto/vectornode.cpp line 752:
> 750: case Op_LShiftCntV: return new LShiftCntVNode(n1, vt);
> 751: case Op_RShiftCntV: return new RShiftCntVNode(n1, vt);
> 752:
Note: used to be in `VectorNode::shift_count`
src/hotspot/share/opto/vectornode.cpp line 783:
> 781: case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
> 782: case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);
> 783:
Note: used to be in `VectorCastNode::make`
src/hotspot/share/opto/vectornode.cpp line 856:
> 854: default:
> 855: fatal("Node class '%s' is not supported for shift count", NodeClassNames[opc]);
> 856: return -1;
Note: splitting the old `VectorNode::shift_count` (scalar opc -> L/RShiftCntVNode).
- Created new `VectorNode::shift_count_opcode` (scalar opc -> vector shift cnt opc)
- Moved node creation to `VectorNode::make` (vector shift cnt opc -> L/RShiftCntVNode)
I need this for later VTransform changes, where I need to do the vector-opc determination in one stage (VTransform build), and then the vector-node creation in a later stage (VTransform apply).
src/hotspot/share/opto/vectornode.cpp line 1437:
> 1435: VectorNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
> 1436: const TypeVect* vt = TypeVect::make(bt, vlen);
> 1437: return VectorNode::make(vopc, n1, nullptr, vt);
Note: the code is moved to `VectorNode::make`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22917#discussion_r1901918030
PR Review Comment: https://git.openjdk.org/jdk/pull/22917#discussion_r1901918317
PR Review Comment: https://git.openjdk.org/jdk/pull/22917#discussion_r1901918499
PR Review Comment: https://git.openjdk.org/jdk/pull/22917#discussion_r1901922127
PR Review Comment: https://git.openjdk.org/jdk/pull/22917#discussion_r1901922545
More information about the hotspot-compiler-dev
mailing list