Revision: 18810
Author: [email protected]
Date: Fri Jan 24 11:10:42 2014 UTC
Log: A64: Optimize LCodeGen::DoMathFloorOfDiv after r18780
BUG=314606
[email protected], [email protected], [email protected]
Review URL: https://codereview.chromium.org/140413005
http://code.google.com/p/v8/source/detail?r=18810
Modified:
/branches/experimental/a64/src/a64/lithium-codegen-a64.cc
=======================================
--- /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Thu Jan 23
18:07:26 2014 UTC
+++ /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Fri Jan 24
11:10:42 2014 UTC
@@ -3579,18 +3579,23 @@
void LCodeGen::DoMathFloorOfDiv(LMathFloorOfDiv* instr) {
- const Register result = ToRegister32(instr->result());
- const Register left = ToRegister32(instr->left());
- const Register right = ToRegister32(instr->right());
- const Register remainder = ToRegister32(instr->temp());
+ Register result = ToRegister32(instr->result());
+ Register left = ToRegister32(instr->left());
+ Register right = ToRegister32(instr->right());
+ Register remainder = ToRegister32(instr->temp());
+
+ // This can't cause an exception on ARM, so we can speculatively
+ // execute it already now.
+ __ Sdiv(result, left, right);
// Check for x / 0.
DeoptimizeIfZero(right, instr->environment());
// Check for (kMinInt / -1).
if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
- __ Cmp(left, kMinInt);
- __ Ccmp(right, -1, ZFlag, eq);
+ // The V flag will be set iff left == kMinInt.
+ __ Cmp(left, 1);
+ __ Ccmp(right, -1, ZFlag, vs);
DeoptimizeIf(eq, instr->environment());
}
@@ -3605,17 +3610,14 @@
}
Label done;
- __ Sdiv(result, left, right);
// If both operands have the same sign then we are done.
- __ Eor(remainder, left, Operand(right));
+ __ Eor(remainder, left, right);
__ Tbz(remainder, kWSignBit, &done);
// Check if the result needs to be corrected.
- __ Mul(remainder, result, right);
- __ Sub(remainder, remainder, left);
- __ Cmp(remainder, 0);
- __ B(eq, &done);
- __ Sub(result, result, Operand(1));
+ __ Msub(remainder, result, right, left);
+ __ Cbz(remainder, &done);
+ __ Sub(result, result, 1);
__ Bind(&done);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.