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 d26b8a28c4bb880d7ecb52cb4a3d958baad10979..a60f4a339e72e32cdb2a899dcc9e002ce117330b 100644 |
--- a/src/compiler/mips/instruction-selector-mips.cc |
+++ b/src/compiler/mips/instruction-selector-mips.cc |
@@ -1396,51 +1396,61 @@ void VisitWordCompare(InstructionSelector* selector, Node* node, |
// Match immediates on left or right side of comparison. |
if (g.CanBeImmediate(right, opcode)) { |
- switch (cont->condition()) { |
- case kEqual: |
- case kNotEqual: |
- if (cont->IsSet()) { |
+ if (opcode == kMipsTst) { |
+ VisitCompare(selector, opcode, g.UseRegister(left), g.UseImmediate(right), |
+ cont); |
+ } else { |
+ switch (cont->condition()) { |
+ case kEqual: |
+ case kNotEqual: |
+ if (cont->IsSet()) { |
+ VisitCompare(selector, opcode, g.UseRegister(left), |
+ g.UseImmediate(right), cont); |
+ } else { |
+ VisitCompare(selector, opcode, g.UseRegister(left), |
+ g.UseRegister(right), cont); |
+ } |
+ break; |
+ case kSignedLessThan: |
+ case kSignedGreaterThanOrEqual: |
+ case kUnsignedLessThan: |
+ case kUnsignedGreaterThanOrEqual: |
VisitCompare(selector, opcode, g.UseRegister(left), |
g.UseImmediate(right), cont); |
- } else { |
+ break; |
+ default: |
VisitCompare(selector, opcode, g.UseRegister(left), |
g.UseRegister(right), cont); |
- } |
- break; |
- 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(); |
- switch (cont->condition()) { |
- case kEqual: |
- case kNotEqual: |
- if (cont->IsSet()) { |
+ if (opcode == kMipsTst) { |
+ VisitCompare(selector, opcode, g.UseRegister(right), g.UseImmediate(left), |
+ cont); |
+ } else { |
+ switch (cont->condition()) { |
+ case kEqual: |
+ case kNotEqual: |
+ if (cont->IsSet()) { |
+ VisitCompare(selector, opcode, g.UseRegister(right), |
+ g.UseImmediate(left), cont); |
+ } else { |
+ VisitCompare(selector, opcode, g.UseRegister(right), |
+ g.UseRegister(left), cont); |
+ } |
+ break; |
+ case kSignedLessThan: |
+ case kSignedGreaterThanOrEqual: |
+ case kUnsignedLessThan: |
+ case kUnsignedGreaterThanOrEqual: |
VisitCompare(selector, opcode, g.UseRegister(right), |
g.UseImmediate(left), cont); |
- } else { |
+ break; |
+ default: |
VisitCompare(selector, opcode, g.UseRegister(right), |
g.UseRegister(left), cont); |
- } |
- break; |
- 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), |