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 a254ea27681fdee8e913300b8336494e375bc368..8d441599a9313d9b0ad200382923be0a4e023ef9 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -763,6 +763,33 @@ void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) { |
void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { |
+ Mips64OperandGenerator g(this); |
+ Node* value = node->InputAt(0); |
+ // Match ChangeFloat64ToInt32(Float64Round##OP) to corresponding instruction |
+ // which does rounding and conversion to integer format. |
+ if (CanCover(node, value)) { |
+ switch (value->opcode()) { |
+ case IrOpcode::kFloat64RoundDown: |
+ Emit(kMips64FloorWD, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat64RoundUp: |
+ Emit(kMips64CeilWD, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat64RoundTiesEven: |
+ Emit(kMips64RoundWD, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat64RoundTruncate: |
+ Emit(kMips64TruncWD, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ default: |
+ VisitRR(this, kMips64TruncWD, node); |
+ return; |
+ } |
+ } |
VisitRR(this, kMips64TruncWD, node); |
} |