| Index: src/compiler/mips64/instruction-selector-mips64.cc
|
| diff --git a/src/compiler/mips64/instruction-selector-mips64.cc b/src/compiler/mips64/instruction-selector-mips64.cc
|
| index 6f72c6451d1fb920c0aae444f7cf1dbeb3ff6182..93d51d3df3fab3f3bc81e2188927184d2300c8ca 100644
|
| --- a/src/compiler/mips64/instruction-selector-mips64.cc
|
| +++ b/src/compiler/mips64/instruction-selector-mips64.cc
|
| @@ -2037,21 +2037,30 @@ void EmitWordCompareZero(InstructionSelector* selector, Node* value,
|
| // Shared routine for word comparisons against zero.
|
| void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
| Node* value, FlagsContinuation* cont) {
|
| + // Try to combine with comparisons against 0 by simply inverting the branch.
|
| while (selector->CanCover(user, value)) {
|
| + if (value->opcode() == IrOpcode::kWord32Equal) {
|
| + Int32BinopMatcher m(value);
|
| + if (!m.right().Is(0)) break;
|
| + user = value;
|
| + value = m.left().node();
|
| + } else if (value->opcode() == IrOpcode::kWord64Equal) {
|
| + Int64BinopMatcher m(value);
|
| + if (!m.right().Is(0)) break;
|
| + user = value;
|
| + value = m.left().node();
|
| + } else {
|
| + break;
|
| + }
|
| +
|
| + cont->Negate();
|
| + }
|
| +
|
| + if (selector->CanCover(user, value)) {
|
| switch (value->opcode()) {
|
| - case IrOpcode::kWord32Equal: {
|
| - // Combine with comparisons against 0 by simply inverting the
|
| - // continuation.
|
| - Int32BinopMatcher m(value);
|
| - if (m.right().Is(0)) {
|
| - user = value;
|
| - value = m.left().node();
|
| - cont->Negate();
|
| - continue;
|
| - }
|
| + case IrOpcode::kWord32Equal:
|
| cont->OverwriteAndNegateIfEqual(kEqual);
|
| return VisitWord32Compare(selector, value, cont);
|
| - }
|
| case IrOpcode::kInt32LessThan:
|
| cont->OverwriteAndNegateIfEqual(kSignedLessThan);
|
| return VisitWord32Compare(selector, value, cont);
|
| @@ -2064,19 +2073,9 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
| case IrOpcode::kUint32LessThanOrEqual:
|
| cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual);
|
| return VisitWord32Compare(selector, value, cont);
|
| - case IrOpcode::kWord64Equal: {
|
| - // Combine with comparisons against 0 by simply inverting the
|
| - // continuation.
|
| - Int64BinopMatcher m(value);
|
| - if (m.right().Is(0)) {
|
| - user = value;
|
| - value = m.left().node();
|
| - cont->Negate();
|
| - continue;
|
| - }
|
| + case IrOpcode::kWord64Equal:
|
| cont->OverwriteAndNegateIfEqual(kEqual);
|
| return VisitWord64Compare(selector, value, cont);
|
| - }
|
| case IrOpcode::kInt64LessThan:
|
| cont->OverwriteAndNegateIfEqual(kSignedLessThan);
|
| return VisitWord64Compare(selector, value, cont);
|
| @@ -2147,7 +2146,6 @@ void VisitWordCompareZero(InstructionSelector* selector, Node* user,
|
| default:
|
| break;
|
| }
|
| - break;
|
| }
|
|
|
| // Continuation could not be combined with a compare, emit compare against 0.
|
|
|