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 cd30405b6f2d7da8b6e620d129b98061f210ec12..4186fc7c457738caebcbd28b6ea39074ff5b0550 100644 |
--- a/src/compiler/mips64/instruction-selector-mips64.cc |
+++ b/src/compiler/mips64/instruction-selector-mips64.cc |
@@ -836,8 +836,40 @@ void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { |
g.UseRegister(value->InputAt(0))); |
return; |
default: |
- VisitRR(this, kMips64TruncWD, node); |
+ break; |
+ } |
+ if (value->opcode() == IrOpcode::kChangeFloat32ToFloat64) { |
+ Node* next = value->InputAt(0); |
+ if (CanCover(value, next)) { |
+ // Match ChangeFloat64ToInt32(ChangeFloat32ToFloat64(Float64Round##OP)) |
+ switch (next->opcode()) { |
+ case IrOpcode::kFloat32RoundDown: |
+ Emit(kMips64FloorWS, g.DefineAsRegister(node), |
+ g.UseRegister(next->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat32RoundUp: |
+ Emit(kMips64CeilWS, g.DefineAsRegister(node), |
+ g.UseRegister(next->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat32RoundTiesEven: |
+ Emit(kMips64RoundWS, g.DefineAsRegister(node), |
+ g.UseRegister(next->InputAt(0))); |
+ return; |
+ case IrOpcode::kFloat32RoundTruncate: |
+ Emit(kMips64TruncWS, g.DefineAsRegister(node), |
+ g.UseRegister(next->InputAt(0))); |
+ return; |
+ default: |
+ Emit(kMips64TruncWS, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ } |
+ } else { |
+ // Match float32 -> float64 -> int32 representation change path. |
+ Emit(kMips64TruncWS, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
return; |
+ } |
} |
} |
VisitRR(this, kMips64TruncWD, node); |
@@ -954,6 +986,16 @@ void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
+ Mips64OperandGenerator g(this); |
+ Node* value = node->InputAt(0); |
+ // Match TruncateFloat64ToFloat32(ChangeInt32ToFloat64) to corresponding |
+ // instruction. |
+ if (CanCover(node, value) && |
+ value->opcode() == IrOpcode::kChangeInt32ToFloat64) { |
+ Emit(kMips64CvtSW, g.DefineAsRegister(node), |
+ g.UseRegister(value->InputAt(0))); |
+ return; |
+ } |
VisitRR(this, kMips64CvtSD, node); |
} |