Index: src/crankshaft/ia32/lithium-codegen-ia32.cc |
diff --git a/src/crankshaft/ia32/lithium-codegen-ia32.cc b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
index 31c70a79bb24fc4c6b63443c37897d02c6c14b3f..436521ae1dd77be824bc32b7a2746e71b61c40a8 100644 |
--- a/src/crankshaft/ia32/lithium-codegen-ia32.cc |
+++ b/src/crankshaft/ia32/lithium-codegen-ia32.cc |
@@ -3177,8 +3177,14 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) { |
} |
} |
+void LCodeGen::DoMathFloorD(LMathFloorD* instr) { |
+ XMMRegister output_reg = ToDoubleRegister(instr->result()); |
+ XMMRegister input_reg = ToDoubleRegister(instr->value()); |
+ CpuFeatureScope scope(masm(), SSE4_1); |
+ __ roundsd(output_reg, input_reg, kRoundDown); |
+} |
-void LCodeGen::DoMathFloor(LMathFloor* instr) { |
+void LCodeGen::DoMathFloorI(LMathFloorI* instr) { |
XMMRegister xmm_scratch = double_scratch0(); |
Register output_reg = ToRegister(instr->result()); |
XMMRegister input_reg = ToDoubleRegister(instr->value()); |
@@ -3242,8 +3248,23 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) { |
} |
} |
+void LCodeGen::DoMathRoundD(LMathRoundD* instr) { |
+ XMMRegister xmm_scratch = double_scratch0(); |
+ XMMRegister output_reg = ToDoubleRegister(instr->result()); |
+ XMMRegister input_reg = ToDoubleRegister(instr->value()); |
+ CpuFeatureScope scope(masm(), SSE4_1); |
+ Label done; |
+ __ roundsd(output_reg, input_reg, kRoundUp); |
+ __ Move(xmm_scratch, -0.5); |
+ __ addsd(xmm_scratch, output_reg); |
+ __ ucomisd(xmm_scratch, input_reg); |
+ __ j(below_equal, &done, Label::kNear); |
+ __ Move(xmm_scratch, 1.0); |
+ __ subsd(output_reg, xmm_scratch); |
+ __ bind(&done); |
+} |
-void LCodeGen::DoMathRound(LMathRound* instr) { |
+void LCodeGen::DoMathRoundI(LMathRoundI* instr) { |
Register output_reg = ToRegister(instr->result()); |
XMMRegister input_reg = ToDoubleRegister(instr->value()); |
XMMRegister xmm_scratch = double_scratch0(); |