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 2aad6277854460aa90362868860764bcc2fbbf43..63190339b90e905d9cf5232353957458be3d44b7 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -1941,51 +1941,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 == kMips64Tst) { |
+ 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 == kMips64Tst) { |
+ 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), |