Commit 00c158a6 authored by jyan's avatar jyan Committed by Commit bot

S390: [builtins] Migrate Math.log to TurboFan.

Port f2da19fe

Original commit message:

    Introduce a dedicated Float64Log machine operator, that is either
    implemented by a direct C call or by platform specific code, i.e.
    using the FPU on x64 and ia32.

    This operator is used to implement Math.log as a proper TurboFan
    builtin on top of the CodeStubAssembler.

    Also introduce a NumberLog simplified operator on top of Float64Log
    and use that for the fast inline path of Math.log inside TurboFan
    optimized code.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com, bjaideep@ca.ibm.com
BUG=

Review-Url: https://codereview.chromium.org/2033353003
Cr-Commit-Position: refs/heads/master@{#36724}
parent 4cc2a731
......@@ -1219,6 +1219,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kS390_ModDouble:
ASSEMBLE_FLOAT_MODULO();
break;
case kS390_LogDouble: {
// TODO(bmeurer): We should really get rid of this special instruction,
// and generate a CallAddress instruction instead.
FrameScope scope(masm(), StackFrame::MANUAL);
__ PrepareCallCFunction(0, 1, kScratchReg);
__ MovToFloatParameter(i.InputDoubleRegister(0));
__ CallCFunction(ExternalReference::math_log_double_function(isolate()),
0, 1);
// Move the result in the double result register.
__ MovFromFloatResult(i.OutputDoubleRegister());
break;
}
case kS390_Neg:
__ LoadComplementRR(i.OutputRegister(), i.InputRegister(0));
break;
......
......@@ -61,6 +61,7 @@ namespace compiler {
V(S390_ModU32) \
V(S390_ModU64) \
V(S390_ModDouble) \
V(S390_LogDouble) \
V(S390_Neg) \
V(S390_NegDouble) \
V(S390_SqrtFloat) \
......
......@@ -62,6 +62,7 @@ int InstructionScheduler::GetTargetInstructionFlags(
case kS390_ModU32:
case kS390_ModU64:
case kS390_ModDouble:
case kS390_LogDouble:
case kS390_Neg:
case kS390_NegDouble:
case kS390_SqrtFloat:
......
......@@ -1191,6 +1191,13 @@ void InstructionSelector::VisitFloat64Abs(Node* node) {
VisitRR(this, kS390_AbsDouble, node);
}
void InstructionSelector::VisitFloat64Log(Node* node) {
S390OperandGenerator g(this);
Emit(kS390_LogDouble, g.DefineAsFixed(node, d1),
g.UseFixed(node->InputAt(0), d1))
->MarkAsCall();
}
void InstructionSelector::VisitFloat32Sqrt(Node* node) {
VisitRR(this, kS390_SqrtFloat, node);
}
......
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