Commit adfed0a1 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Harmony: optimize Math.clz32.

Port r19487 (bd8c70f)

BUG=v8:2938
LOG=N
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19499 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 5202249e
......@@ -3796,6 +3796,13 @@ void LCodeGen::DoMathLog(LMathLog* instr) {
}
void LCodeGen::DoMathClz32(LMathClz32* instr) {
Register input = ToRegister(instr->value());
Register result = ToRegister(instr->result());
__ Clz(result, input);
}
void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
ASSERT(ToRegister(instr->context()).is(cp));
ASSERT(ToRegister(instr->function()).is(a1));
......
......@@ -1101,6 +1101,7 @@ LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
case kMathExp: return DoMathExp(instr);
case kMathSqrt: return DoMathSqrt(instr);
case kMathPowHalf: return DoMathPowHalf(instr);
case kMathClz32: return DoMathClz32(instr);
default:
UNREACHABLE();
return NULL;
......@@ -1116,6 +1117,13 @@ LInstruction* LChunkBuilder::DoMathLog(HUnaryMathOperation* 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) {
ASSERT(instr->representation().IsDouble());
ASSERT(instr->value()->representation().IsDouble());
......
......@@ -125,6 +125,7 @@ class LCodeGen;
V(MapEnumLength) \
V(MathAbs) \
V(MathExp) \
V(MathClz32) \
V(MathFloor) \
V(MathFloorOfDiv) \
V(MathLog) \
......@@ -802,6 +803,18 @@ class LMathLog V8_FINAL : public LTemplateInstruction<1, 1, 0> {
};
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:
LMathExp(LOperand* value,
......@@ -2578,6 +2591,7 @@ class LChunkBuilder V8_FINAL : public LChunkBuilderBase {
LInstruction* DoMathExp(HUnaryMathOperation* instr);
LInstruction* DoMathSqrt(HUnaryMathOperation* instr);
LInstruction* DoMathPowHalf(HUnaryMathOperation* instr);
LInstruction* DoMathClz32(HUnaryMathOperation* instr);
private:
enum Status {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment