Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8257483: C2: Split immediate vector rotate from RotateLeftV and Rotat…
…eRightV nodes

Reviewed-by: vlivanov
  • Loading branch information
Dong Bo authored and RealFYang committed Dec 10, 2020
1 parent 0a0691e commit 026b09c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/hotspot/cpu/aarch64/aarch64.ad
Expand Up @@ -2437,6 +2437,10 @@ bool Matcher::supports_vector_variable_shifts(void) {
return true;
}

bool Matcher::supports_vector_variable_rotates(void) {
return false; // not supported
}

const int Matcher::float_pressure(int default_pressure_threshold) {
return default_pressure_threshold;
}
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/arm/arm.ad
Expand Up @@ -997,6 +997,10 @@ bool Matcher::supports_vector_variable_shifts(void) {
return VM_Version::has_simd();
}

bool Matcher::supports_vector_variable_rotates(void) {
return false; // not supported
}

const int Matcher::float_pressure(int default_pressure_threshold) {
return default_pressure_threshold;
}
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/ppc/ppc.ad
Expand Up @@ -2155,6 +2155,10 @@ bool Matcher::supports_vector_variable_shifts(void) {
return false; // not supported
}

bool Matcher::supports_vector_variable_rotates(void) {
return false; // not supported
}

const int Matcher::float_pressure(int default_pressure_threshold) {
return default_pressure_threshold;
}
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/s390/s390.ad
Expand Up @@ -1550,6 +1550,10 @@ bool Matcher::supports_vector_variable_shifts(void) {
return false; // not supported
}

bool Matcher::supports_vector_variable_rotates(void) {
return false; // not supported
}

const int Matcher::float_pressure(int default_pressure_threshold) {
return default_pressure_threshold;
}
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/x86/x86.ad
Expand Up @@ -1814,6 +1814,10 @@ bool Matcher::supports_vector_variable_shifts(void) {
return (UseAVX >= 2);
}

bool Matcher::supports_vector_variable_rotates(void) {
return true;
}

const bool Matcher::has_predicated_vectors(void) {
bool ret_value = false;
if (UseAVX > 2) {
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/opto/matcher.hpp
Expand Up @@ -348,6 +348,9 @@ class Matcher : public PhaseTransform {
// Does the CPU supports vector variable shift instructions?
static bool supports_vector_variable_shifts(void);

// Does the CPU supports vector vairable rotate instructions?
static bool supports_vector_variable_rotates(void);

// CPU supports misaligned vectors store/load.
static const bool misaligned_vectors_ok();

Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/opto/vectornode.cpp
Expand Up @@ -1172,7 +1172,8 @@ Node* VectorNode::degenerate_vector_rotate(Node* src, Node* cnt, bool is_rotate_
Node* RotateLeftVNode::Ideal(PhaseGVN* phase, bool can_reshape) {
int vlen = length();
BasicType bt = vect_type()->element_basic_type();
if (!Matcher::match_rule_supported_vector(Op_RotateLeftV, vlen, bt)) {
if ((!in(2)->is_Con() && !Matcher::supports_vector_variable_rotates()) ||
!Matcher::match_rule_supported_vector(Op_RotateLeftV, vlen, bt)) {
return VectorNode::degenerate_vector_rotate(in(1), in(2), true, vlen, bt, phase);
}
return NULL;
Expand All @@ -1181,7 +1182,8 @@ Node* RotateLeftVNode::Ideal(PhaseGVN* phase, bool can_reshape) {
Node* RotateRightVNode::Ideal(PhaseGVN* phase, bool can_reshape) {
int vlen = length();
BasicType bt = vect_type()->element_basic_type();
if (!Matcher::match_rule_supported_vector(Op_RotateRightV, vlen, bt)) {
if ((!in(2)->is_Con() && !Matcher::supports_vector_variable_rotates()) ||
!Matcher::match_rule_supported_vector(Op_RotateRightV, vlen, bt)) {
return VectorNode::degenerate_vector_rotate(in(1), in(2), false, vlen, bt, phase);
}
return NULL;
Expand Down

1 comment on commit 026b09c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.