Skip to content

Commit

Permalink
reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
rwestrel committed Dec 7, 2021
1 parent 415b7ef commit d5a6c50
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions src/hotspot/share/opto/mulnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ const Type* AndINode::Value(PhaseGVN* phase) const {
return TypeInt::ZERO;
}

return MulINode::Value(phase);
return MulNode::Value(phase);
}

//------------------------------Identity---------------------------------------
Expand Down Expand Up @@ -650,7 +650,7 @@ const Type* AndLNode::Value(PhaseGVN* phase) const {
return TypeLong::ZERO;
}

return MulLNode::Value(phase);
return MulNode::Value(phase);
}

//------------------------------Identity---------------------------------------
Expand Down Expand Up @@ -1714,7 +1714,11 @@ const Type* RotateRightNode::Value(PhaseGVN* phase) const {
}
}

bool MulNode::AndIL_shift_and_mask(PhaseGVN* phase, Node* mask, Node* shift, BasicType bt) const {
// Helper method to transform:
// patterns similar to (v << 2) & 3 to 0
// and
// patterns similar to (v1 + (v2 << 2)) & 3 transformed to v1 & 3
bool MulNode::AndIL_shift_and_mask(PhaseGVN* phase, Node* mask, Node* shift, BasicType bt) {
if (mask == NULL || shift == NULL) {
return false;
}
Expand Down Expand Up @@ -1750,6 +1754,8 @@ bool MulNode::AndIL_shift_and_mask(PhaseGVN* phase, Node* mask, Node* shift, Bas
return false;
}

// Helper method to transform:
// patterns similar to (v1 + (v2 << 2)) & 3 to v1 & 3
Node* MulNode::AndIL_add_shift_and_mask(PhaseGVN* phase, BasicType bt) {
Node* in1 = in(1);
Node* in2 = in(2);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/mulnode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MulNode : public Node {

static MulNode* make(Node* in1, Node* in2, BasicType bt);

bool AndIL_shift_and_mask(PhaseGVN* phase, Node* mask, Node* shift, BasicType bt) const;
static bool AndIL_shift_and_mask(PhaseGVN* phase, Node* mask, Node* shift, BasicType bt);
Node* AndIL_add_shift_and_mask(PhaseGVN* phase, BasicType bt);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/*
* @test
* @bug JDK-8277850
* @bug 8277850
* @summary C2: optimize mask checks in counted loops
* @library /test/lib /
* @run driver compiler.c2.irTests.TestShiftAndMask
Expand Down

0 comments on commit d5a6c50

Please sign in to comment.