Index: src/compiler/mips/instruction-selector-mips.cc |
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc |
index f95c82627b080a0bc03c27f0a9d9ccfeff8976f1..8f2f6b212892d302eaa9bffd65a93d2877fd20e1 100644 |
--- a/src/compiler/mips/instruction-selector-mips.cc |
+++ b/src/compiler/mips/instruction-selector-mips.cc |
@@ -775,7 +775,6 @@ static void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
g.Label(cont->true_block()), g.Label(cont->false_block())); |
} else { |
DCHECK(cont->IsSet()); |
- // TODO(plind): Revisit and test this path. |
selector->Emit(opcode, g.DefineAsRegister(cont->result()), left, right); |
} |
} |
@@ -813,12 +812,32 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, |
// Match immediates on left or right side of comparison. |
if (g.CanBeImmediate(right, opcode)) { |
- VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right), |
- cont); |
+ switch (cont->condition()) { |
+ case kSignedLessThan: |
+ case kSignedGreaterThanOrEqual: |
+ case kUnsignedLessThan: |
+ case kUnsignedGreaterThanOrEqual: |
+ VisitCompare(selector, opcode, g.UseRegister(left), |
+ g.UseImmediate(right), cont); |
+ break; |
+ default: |
+ VisitCompare(selector, opcode, g.UseRegister(left), |
+ g.UseRegister(right), cont); |
+ } |
} else if (g.CanBeImmediate(left, opcode)) { |
if (!commutative) cont->Commute(); |
- VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left), |
- cont); |
+ switch (cont->condition()) { |
+ case kSignedLessThan: |
+ case kSignedGreaterThanOrEqual: |
+ case kUnsignedLessThan: |
+ case kUnsignedGreaterThanOrEqual: |
+ VisitCompare(selector, opcode, g.UseRegister(right), |
+ g.UseImmediate(left), cont); |
+ break; |
+ default: |
+ VisitCompare(selector, opcode, g.UseRegister(right), |
+ g.UseRegister(left), cont); |
+ } |
} else { |
VisitCompare(selector, opcode, g.UseRegister(left), g.UseRegister(right), |
cont); |