Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Unified Diff: src/crankshaft/ppc/lithium-codegen-ppc.cc

Issue 1839643007: PPC: [crankshaft] Address the deoptimization loops of Math.floor, Math.round and Math.ceil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix DEBUG Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ppc/lithium-ppc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/crankshaft/ppc/lithium-codegen-ppc.cc
diff --git a/src/crankshaft/ppc/lithium-codegen-ppc.cc b/src/crankshaft/ppc/lithium-codegen-ppc.cc
index edc0d696b02d2b8de142f8e05a53ef947ed3a7a8..d3ba2a91730348e50dad6958e625b41e0febb8ba 100644
--- a/src/crankshaft/ppc/lithium-codegen-ppc.cc
+++ b/src/crankshaft/ppc/lithium-codegen-ppc.cc
@@ -3613,8 +3613,13 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) {
}
}
+void LCodeGen::DoMathFloorD(LMathFloorD* instr) {
+ DoubleRegister input_reg = ToDoubleRegister(instr->value());
+ DoubleRegister output_reg = ToDoubleRegister(instr->result());
+ __ frim(output_reg, input_reg);
+}
-void LCodeGen::DoMathFloor(LMathFloor* instr) {
+void LCodeGen::DoMathFloorI(LMathFloorI* instr) {
DoubleRegister input = ToDoubleRegister(instr->value());
Register result = ToRegister(instr->result());
Register input_high = scratch0();
@@ -3636,8 +3641,30 @@ void LCodeGen::DoMathFloor(LMathFloor* instr) {
__ bind(&done);
}
+void LCodeGen::DoMathRoundD(LMathRoundD* instr) {
+ DoubleRegister input_reg = ToDoubleRegister(instr->value());
+ DoubleRegister output_reg = ToDoubleRegister(instr->result());
+ DoubleRegister dot_five = double_scratch0();
+ Label done;
+
+ __ frin(output_reg, input_reg);
+ __ fcmpu(input_reg, kDoubleRegZero);
+ __ bge(&done);
+ __ fcmpu(output_reg, input_reg);
+ __ beq(&done);
+
+ // Negative, non-integer case
+ __ LoadDoubleLiteral(dot_five, 0.5, r0);
+ __ fadd(output_reg, input_reg, dot_five);
+ __ frim(output_reg, output_reg);
+ // The range [-0.5, -0.0[ yielded +0.0. Force the sign to negative.
+ __ fabs(output_reg, output_reg);
+ __ fneg(output_reg, output_reg);
+
+ __ bind(&done);
+}
-void LCodeGen::DoMathRound(LMathRound* instr) {
+void LCodeGen::DoMathRoundI(LMathRoundI* instr) {
DoubleRegister input = ToDoubleRegister(instr->value());
Register result = ToRegister(instr->result());
DoubleRegister double_scratch1 = ToDoubleRegister(instr->temp());
« no previous file with comments | « src/crankshaft/hydrogen-instructions.h ('k') | src/crankshaft/ppc/lithium-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698