mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-15 04:45:25 +00:00
8346993: C2 SuperWord: refactor to make more vector nodes available in VectorNode::make
Reviewed-by: chagedorn, kvn
This commit is contained in:
parent
de0250368e
commit
08debd335e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -666,7 +666,7 @@ VectorNode* VectorNode::make_mask_node(int vopc, Node* n1, Node* n2, uint vlen,
|
||||
}
|
||||
}
|
||||
|
||||
// Make a vector node for binary operation
|
||||
// Make a vector node for unary or binary operation
|
||||
VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask, bool is_var_shift, bool is_unsigned) {
|
||||
// This method should not be called for unimplemented vectors.
|
||||
guarantee(vopc > 0, "vopc must be > 0");
|
||||
@ -747,6 +747,9 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
|
||||
case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift);
|
||||
case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift);
|
||||
|
||||
case Op_LShiftCntV: return new LShiftCntVNode(n1, vt);
|
||||
case Op_RShiftCntV: return new RShiftCntVNode(n1, vt);
|
||||
|
||||
case Op_AndV: return new AndVNode(n1, n2, vt);
|
||||
case Op_OrV: return new OrVNode (n1, n2, vt);
|
||||
case Op_XorV: return new XorVNode(n1, n2, vt);
|
||||
@ -766,6 +769,18 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
|
||||
case Op_SaturatingAddV: return new SaturatingAddVNode(n1, n2, vt, is_unsigned);
|
||||
case Op_SaturatingSubV: return new SaturatingSubVNode(n1, n2, vt, is_unsigned);
|
||||
|
||||
case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
|
||||
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
|
||||
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
|
||||
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
|
||||
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
|
||||
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
|
||||
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
|
||||
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
|
||||
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
|
||||
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
|
||||
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);
|
||||
|
||||
default:
|
||||
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
|
||||
return nullptr;
|
||||
@ -791,6 +806,7 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeV
|
||||
case Op_SelectFromTwoVector: return new SelectFromTwoVectorNode(n1, n2, n3, vt);
|
||||
case Op_SignumVD: return new SignumVDNode(n1, n2, n3, vt);
|
||||
case Op_SignumVF: return new SignumVFNode(n1, n2, n3, vt);
|
||||
case Op_VectorBlend: return new VectorBlendNode(n1, n2, n3);
|
||||
default:
|
||||
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
|
||||
return nullptr;
|
||||
@ -818,22 +834,26 @@ VectorNode* VectorNode::scalar2vector(Node* s, uint vlen, BasicType bt, bool is_
|
||||
}
|
||||
|
||||
VectorNode* VectorNode::shift_count(int opc, Node* cnt, uint vlen, BasicType bt) {
|
||||
// Match shift count type with shift vector type.
|
||||
int vopc = VectorNode::shift_count_opcode(opc);
|
||||
const TypeVect* vt = TypeVect::make(bt, vlen);
|
||||
return VectorNode::make(vopc, cnt, nullptr, vt);
|
||||
}
|
||||
|
||||
int VectorNode::shift_count_opcode(int opc) {
|
||||
switch (opc) {
|
||||
case Op_LShiftI:
|
||||
case Op_LShiftL:
|
||||
return new LShiftCntVNode(cnt, vt);
|
||||
return Op_LShiftCntV;
|
||||
case Op_RShiftI:
|
||||
case Op_RShiftL:
|
||||
case Op_URShiftB:
|
||||
case Op_URShiftS:
|
||||
case Op_URShiftI:
|
||||
case Op_URShiftL:
|
||||
return new RShiftCntVNode(cnt, vt);
|
||||
return Op_RShiftCntV;
|
||||
default:
|
||||
fatal("Missed vector creation for '%s'", NodeClassNames[opc]);
|
||||
return nullptr;
|
||||
fatal("Node class '%s' is not supported for shift count", NodeClassNames[opc]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1412,24 +1432,9 @@ VectorStoreMaskNode* VectorStoreMaskNode::make(PhaseGVN& gvn, Node* in, BasicTyp
|
||||
return new VectorStoreMaskNode(in, gvn.intcon(elem_size), vt);
|
||||
}
|
||||
|
||||
VectorCastNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
|
||||
VectorNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
|
||||
const TypeVect* vt = TypeVect::make(bt, vlen);
|
||||
switch (vopc) {
|
||||
case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
|
||||
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
|
||||
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
|
||||
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
|
||||
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
|
||||
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
|
||||
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
|
||||
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
|
||||
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
|
||||
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
|
||||
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);
|
||||
default:
|
||||
assert(false, "unknown node: %s", NodeClassNames[vopc]);
|
||||
return nullptr;
|
||||
}
|
||||
return VectorNode::make(vopc, n1, nullptr, vt);
|
||||
}
|
||||
|
||||
int VectorCastNode::opcode(int sopc, BasicType bt, bool is_signed) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -95,6 +95,8 @@ class VectorNode : public TypeNode {
|
||||
static int opcode(int sopc, BasicType bt); // scalar_opc -> vector_opc
|
||||
static int scalar_opcode(int vopc, BasicType bt); // vector_opc -> scalar_opc
|
||||
|
||||
static int shift_count_opcode(int opc);
|
||||
|
||||
// Limits on vector size (number of elements) for auto-vectorization.
|
||||
static bool vector_size_supported_auto_vectorization(const BasicType bt, int size);
|
||||
static bool implemented(int opc, uint vlen, BasicType bt);
|
||||
@ -1764,7 +1766,7 @@ class VectorCastNode : public VectorNode {
|
||||
VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {}
|
||||
virtual int Opcode() const;
|
||||
|
||||
static VectorCastNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
|
||||
static VectorNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
|
||||
static int opcode(int opc, BasicType bt, bool is_signed = true);
|
||||
static bool implemented(int opc, uint vlen, BasicType src_type, BasicType dst_type);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user