Revision: 19814
Author: [email protected]
Date: Tue Mar 11 17:12:34 2014 UTC
Log: A64: UseRegisterAtStart for rhs of LMulS
BUG=
[email protected]
Review URL: https://codereview.chromium.org/191283002
http://code.google.com/p/v8/source/detail?r=19814
Modified:
/branches/bleeding_edge/src/a64/lithium-a64.cc
/branches/bleeding_edge/src/a64/lithium-codegen-a64.cc
=======================================
--- /branches/bleeding_edge/src/a64/lithium-a64.cc Tue Mar 11 15:46:31 2014
UTC
+++ /branches/bleeding_edge/src/a64/lithium-a64.cc Tue Mar 11 17:12:34 2014
UTC
@@ -1906,8 +1906,7 @@
// allocated for the second operand.
LInstruction* result;
if (instr->representation().IsSmi()) {
- // TODO(jbramley/rmcilroy): Fix LMulS so we can UseRegisterAtStart
here.
- LOperand* right = UseRegister(most_const);
+ LOperand* right = UseRegisterAtStart(most_const);
result = DefineAsRegister(new(zone()) LMulS(left, right));
} else {
LOperand* right = UseRegisterAtStart(most_const);
=======================================
--- /branches/bleeding_edge/src/a64/lithium-codegen-a64.cc Tue Mar 11
15:46:31 2014 UTC
+++ /branches/bleeding_edge/src/a64/lithium-codegen-a64.cc Tue Mar 11
17:12:34 2014 UTC
@@ -4318,7 +4318,7 @@
bool bailout_on_minus_zero =
instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
- if (bailout_on_minus_zero) {
+ if (bailout_on_minus_zero && !left.Is(right)) {
// If one operand is zero and the other is negative, the result is -0.
// - Set Z (eq) if either left or right, or both, are 0.
__ Cmp(left, 0);
@@ -4348,7 +4348,7 @@
bool bailout_on_minus_zero =
instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero);
- if (bailout_on_minus_zero) {
+ if (bailout_on_minus_zero && !left.Is(right)) {
// If one operand is zero and the other is negative, the result is -0.
// - Set Z (eq) if either left or right, or both, are 0.
__ Cmp(left, 0);
@@ -4366,10 +4366,25 @@
__ SmiTag(result);
DeoptimizeIf(ne, instr->environment());
} else {
- // TODO(jbramley): This could be rewritten to support
UseRegisterAtStart.
- ASSERT(!AreAliased(result, right));
- __ SmiUntag(result, left);
- __ Mul(result, result, right);
+ if (AreAliased(result, left, right)) {
+ // All three registers are the same: half untag the input and then
+ // multiply, giving a tagged result.
+ STATIC_ASSERT((kSmiShift % 2) == 0);
+ __ Asr(result, left, kSmiShift / 2);
+ __ Mul(result, result, result);
+ } else if (result.Is(left) && !left.Is(right)) {
+ // Registers result and left alias, right is distinct: untag left
into
+ // result, and then multiply by right, giving a tagged result.
+ __ SmiUntag(result, left);
+ __ Mul(result, result, right);
+ } else {
+ ASSERT(!left.Is(result));
+ // Registers result and right alias, left is distinct, or all
registers
+ // are distinct: untag right into result, and then multiply by left,
+ // giving a tagged result.
+ __ SmiUntag(result, right);
+ __ Mul(result, left, result);
+ }
}
}
--
--
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/d/optout.