Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8331281: RISC-V: C2: Support vector-scalar and vector-immediate bitwise logic instructions #18999

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions src/hotspot/cpu/riscv/riscv.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2150,11 +2150,44 @@ bool size_fits_all_mem_uses(AddPNode* addp, int shift) {
return true;
}

// Binary src (Replicate scalar/immediate)
static bool is_vector_scalar_bitwise_pattern(Node* n, Node* m) {
if (n == nullptr || m == nullptr) {
return false;
}

if (m->Opcode() != Op_Replicate) {
return false;
}

switch (n->Opcode()) {
case Op_AndV:
case Op_OrV:
case Op_XorV: {
return true;
}
default:
return false;
}
}

// (XorV src (Replicate m1))
// (XorVMask src (MaskAll m1))
static bool is_vector_bitwise_not_pattern(Node* n, Node* m) {
if (n != nullptr && m != nullptr) {
return (n->Opcode() == Op_XorV || n->Opcode() == Op_XorVMask) &&
VectorNode::is_all_ones_vector(m);
}
return false;
}

// Should the Matcher clone input 'm' of node 'n'?
bool Matcher::pd_clone_node(Node* n, Node* m, Matcher::MStack& mstack) {
assert_cond(m != nullptr);
if (is_vshift_con_pattern(n, m)) { // ShiftV src (ShiftCntV con)
mstack.push(m, Visit); // m = ShiftCntV
if (is_vshift_con_pattern(n, m) || // ShiftV src (ShiftCntV con)
is_vector_bitwise_not_pattern(n, m) ||
is_vector_scalar_bitwise_pattern(n, m)) {
mstack.push(m, Visit);
return true;
}
return false;
Expand Down
Loading