Revision: 19499
Author:   [email protected]
Date:     Wed Feb 19 18:16:06 2014 UTC
Log:      MIPS: Harmony: optimize Math.clz32.

Port r19487 (bd8c70f)

BUG=v8:2938
LOG=N
[email protected]

Review URL: https://codereview.chromium.org/172533002

Patch from Balazs Kilvady <[email protected]>.
http://code.google.com/p/v8/source/detail?r=19499

Modified:
 /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.cc
 /branches/bleeding_edge/src/mips/lithium-mips.h

=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Feb 19 14:03:48 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Wed Feb 19 18:16:06 2014 UTC
@@ -3794,6 +3794,13 @@
                    0, 1);
   __ MovFromFloatResult(ToDoubleRegister(instr->result()));
 }
+
+
+void LCodeGen::DoMathClz32(LMathClz32* instr) {
+  Register input = ToRegister(instr->value());
+  Register result = ToRegister(instr->result());
+  __ Clz(result, input);
+}


 void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.cc Thu Feb 13 18:11:49 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-mips.cc Wed Feb 19 18:16:06 2014 UTC
@@ -1101,6 +1101,7 @@
     case kMathExp: return DoMathExp(instr);
     case kMathSqrt: return DoMathSqrt(instr);
     case kMathPowHalf: return DoMathPowHalf(instr);
+    case kMathClz32: return DoMathClz32(instr);
     default:
       UNREACHABLE();
       return NULL;
@@ -1114,6 +1115,13 @@
   LOperand* input = UseFixedDouble(instr->value(), f4);
return MarkAsCall(DefineFixedDouble(new(zone()) LMathLog(input), f4), instr);
 }
+
+
+LInstruction* LChunkBuilder::DoMathClz32(HUnaryMathOperation* instr) {
+  LOperand* input = UseRegisterAtStart(instr->value());
+  LMathClz32* result = new(zone()) LMathClz32(input);
+  return DefineAsRegister(result);
+}


 LInstruction* LChunkBuilder::DoMathExp(HUnaryMathOperation* instr) {
=======================================
--- /branches/bleeding_edge/src/mips/lithium-mips.h Thu Feb 13 18:11:49 2014 UTC +++ /branches/bleeding_edge/src/mips/lithium-mips.h Wed Feb 19 18:16:06 2014 UTC
@@ -125,6 +125,7 @@
   V(MapEnumLength)                              \
   V(MathAbs)                                    \
   V(MathExp)                                    \
+  V(MathClz32)                                  \
   V(MathFloor)                                  \
   V(MathFloorOfDiv)                             \
   V(MathLog)                                    \
@@ -801,6 +802,18 @@
   DECLARE_CONCRETE_INSTRUCTION(MathLog, "math-log")
 };

+
+class LMathClz32 V8_FINAL : public LTemplateInstruction<1, 1, 0> {
+ public:
+  explicit LMathClz32(LOperand* value) {
+    inputs_[0] = value;
+  }
+
+  LOperand* value() { return inputs_[0]; }
+
+  DECLARE_CONCRETE_INSTRUCTION(MathClz32, "math-clz32")
+};
+

 class LMathExp V8_FINAL : public LTemplateInstruction<1, 1, 3> {
  public:
@@ -2578,6 +2591,7 @@
   LInstruction* DoMathExp(HUnaryMathOperation* instr);
   LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
   LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
+  LInstruction* DoMathClz32(HUnaryMathOperation* instr);

  private:
   enum Status {

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

Reply via email to