Revision: 22051
Author:   [email protected]
Date:     Fri Jun 27 09:00:31 2014 UTC
Log:      ARM64: avoid duplicate load of double constants

[email protected], [email protected]

BUG=

Review URL: https://codereview.chromium.org/357973002
http://code.google.com/p/v8/source/detail?r=22051

Modified:
 /branches/bleeding_edge/src/arm64/lithium-arm64.cc
 /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc

=======================================
--- /branches/bleeding_edge/src/arm64/lithium-arm64.cc Thu Jun 26 10:00:36 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-arm64.cc Fri Jun 27 09:00:31 2014 UTC
@@ -1274,15 +1274,13 @@
     ASSERT(r.IsDouble());
     ASSERT(instr->left()->representation().IsDouble());
     ASSERT(instr->right()->representation().IsDouble());
- // TODO(all): In fact the only case that we can handle more efficiently is - // when one of the operand is the constant 0. Currently the MacroAssembler - // will be able to cope with any constant by loading it into an internal - // scratch register. This means that if the constant is used more that once,
-    // it will be loaded multiple times. Unfortunatly crankshaft already
- // duplicates constant loads, but we should modify the code below once this
-    // issue has been addressed in crankshaft.
-    LOperand* left = UseRegisterOrConstantAtStart(instr->left());
-    LOperand* right = UseRegisterOrConstantAtStart(instr->right());
+    if (instr->left()->IsConstant() && instr->right()->IsConstant()) {
+      LOperand* left = UseConstant(instr->left());
+      LOperand* right = UseConstant(instr->right());
+      return new(zone()) LCompareNumericAndBranch(left, right);
+    }
+    LOperand* left = UseRegisterAtStart(instr->left());
+    LOperand* right = UseRegisterAtStart(instr->right());
     return new(zone()) LCompareNumericAndBranch(left, right);
   }
 }
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Thu Jun 26 10:00:36 2014 UTC +++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Fri Jun 27 09:00:31 2014 UTC
@@ -2484,17 +2484,7 @@
     EmitGoto(next_block);
   } else {
     if (instr->is_double()) {
-      if (right->IsConstantOperand()) {
-        __ Fcmp(ToDoubleRegister(left),
-                ToDouble(LConstantOperand::cast(right)));
-      } else if (left->IsConstantOperand()) {
-        // Commute the operands and the condition.
-        __ Fcmp(ToDoubleRegister(right),
-                ToDouble(LConstantOperand::cast(left)));
-        cond = CommuteCondition(cond);
-      } else {
-        __ Fcmp(ToDoubleRegister(left), ToDoubleRegister(right));
-      }
+      __ Fcmp(ToDoubleRegister(left), ToDoubleRegister(right));

       // If a NaN is involved, i.e. the result is unordered (V set),
       // jump to false block label.

--
--
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.

Reply via email to