PPC/s390: [turbofan] Refactor the compare-zero folding in instruction selector.
Port 9b308dcaf5
R=jarin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, bjaideep@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com
BUG=
Review-Url: https://codereview.chromium.org/2470043006
Cr-Commit-Position: refs/heads/master@{#40774}
This commit is contained in:
parent
9906b3e677
commit
bbab241ca1
@ -1602,21 +1602,22 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node,
|
||||
void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
||||
Node* value, InstructionCode opcode,
|
||||
FlagsContinuation* cont) {
|
||||
while (selector->CanCover(user, value)) {
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kWord32Equal: {
|
||||
// Combine with comparisons against 0 by simply inverting the
|
||||
// continuation.
|
||||
// Try to combine with comparisons against 0 by simply inverting the branch.
|
||||
while (value->opcode() == IrOpcode::kWord32Equal &&
|
||||
selector->CanCover(user, value)) {
|
||||
Int32BinopMatcher m(value);
|
||||
if (m.right().Is(0)) {
|
||||
if (!m.right().Is(0)) break;
|
||||
|
||||
user = value;
|
||||
value = m.left().node();
|
||||
cont->Negate();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (selector->CanCover(user, value)) {
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kWord32Equal:
|
||||
cont->OverwriteAndNegateIfEqual(kEqual);
|
||||
return VisitWord32Compare(selector, value, cont);
|
||||
}
|
||||
case IrOpcode::kInt32LessThan:
|
||||
cont->OverwriteAndNegateIfEqual(kSignedLessThan);
|
||||
return VisitWord32Compare(selector, value, cont);
|
||||
@ -1738,7 +1739,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Branch could not be combined with a compare, emit compare against 0.
|
||||
|
@ -1607,21 +1607,22 @@ void VisitFloat64Compare(InstructionSelector* selector, Node* node,
|
||||
void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
||||
Node* value, InstructionCode opcode,
|
||||
FlagsContinuation* cont) {
|
||||
while (selector->CanCover(user, value)) {
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kWord32Equal: {
|
||||
// Combine with comparisons against 0 by simply inverting the
|
||||
// continuation.
|
||||
// Try to combine with comparisons against 0 by simply inverting the branch.
|
||||
while (value->opcode() == IrOpcode::kWord32Equal &&
|
||||
selector->CanCover(user, value)) {
|
||||
Int32BinopMatcher m(value);
|
||||
if (m.right().Is(0)) {
|
||||
if (!m.right().Is(0)) break;
|
||||
|
||||
user = value;
|
||||
value = m.left().node();
|
||||
cont->Negate();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (selector->CanCover(user, value)) {
|
||||
switch (value->opcode()) {
|
||||
case IrOpcode::kWord32Equal:
|
||||
cont->OverwriteAndNegateIfEqual(kEqual);
|
||||
return VisitWord32Compare(selector, value, cont);
|
||||
}
|
||||
case IrOpcode::kInt32LessThan:
|
||||
cont->OverwriteAndNegateIfEqual(kSignedLessThan);
|
||||
return VisitWord32Compare(selector, value, cont);
|
||||
@ -1740,7 +1741,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Branch could not be combined with a compare, emit compare against 0.
|
||||
|
Loading…
Reference in New Issue
Block a user