Commit f1c2729d authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [builtins] Introduce proper Float64Tan operator.

Port c87168bc

Original commit message:

    Import base::ieee754::tan() from fdlibm and introduce Float64Tan TurboFan
    operator based on that, similar to what we do for Float64Cos and Float64Sin.
    Rewrite Math.tan() as TurboFan builtin and use those operators to also
    inline Math.tan() into optimized TurboFan functions.

    Drive-by-fix: Kill the %_ConstructDouble intrinsics, and provide only
    the %ConstructDouble runtime entry for writing tests.

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

BUG=v8:5086,v8:5126
LOG=N

Review-Url: https://codereview.chromium.org/2080303002
Cr-Commit-Position: refs/heads/master@{#37115}
parent 3665ae7d
......@@ -1263,6 +1263,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kIeee754Float64Atan2:
ASSEMBLE_IEEE754_BINOP(atan2);
break;
case kIeee754Float64Tan:
ASSEMBLE_IEEE754_UNOP(tan);
break;
case kIeee754Float64Cbrt:
ASSEMBLE_IEEE754_UNOP(cbrt);
break;
......
......@@ -1252,6 +1252,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
case kIeee754Float64Atan2:
ASSEMBLE_IEEE754_BINOP(atan2);
break;
case kIeee754Float64Tan:
ASSEMBLE_IEEE754_UNOP(tan);
break;
case kIeee754Float64Cbrt:
ASSEMBLE_IEEE754_UNOP(cbrt);
break;
......
......@@ -5308,18 +5308,6 @@ void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
}
void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
Register hi_reg = ToRegister(instr->hi());
Register lo_reg = ToRegister(instr->lo());
DoubleRegister result_reg = ToDoubleRegister(instr->result());
#if V8_TARGET_ARCH_PPC64
__ MovInt64ComponentsToDouble(result_reg, hi_reg, lo_reg, r0);
#else
__ MovInt64ToDouble(result_reg, hi_reg, lo_reg);
#endif
}
void LCodeGen::DoAllocate(LAllocate* instr) {
class DeferredAllocate final : public LDeferredCode {
public:
......
......@@ -1964,13 +1964,6 @@ LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
}
LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
LOperand* lo = UseRegister(instr->lo());
LOperand* hi = UseRegister(instr->hi());
return DefineAsRegister(new (zone()) LConstructDouble(hi, lo));
}
LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
LOperand* context = info()->IsStub() ? UseFixed(instr->context(), cp) : NULL;
LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
......
......@@ -53,7 +53,6 @@ class LCodeGen;
V(ConstantI) \
V(ConstantS) \
V(ConstantT) \
V(ConstructDouble) \
V(Context) \
V(DebugBreak) \
V(DeclareGlobals) \
......@@ -2279,20 +2278,6 @@ class LDoubleBits final : public LTemplateInstruction<1, 1, 0> {
};
class LConstructDouble final : public LTemplateInstruction<1, 2, 0> {
public:
LConstructDouble(LOperand* hi, LOperand* lo) {
inputs_[0] = hi;
inputs_[1] = lo;
}
LOperand* hi() { return inputs_[0]; }
LOperand* lo() { return inputs_[1]; }
DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
};
class LAllocate final : public LTemplateInstruction<1, 2, 2> {
public:
LAllocate(LOperand* context, LOperand* size, LOperand* temp1,
......
......@@ -5204,20 +5204,6 @@ void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
}
}
void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
Register hi_reg = ToRegister(instr->hi());
Register lo_reg = ToRegister(instr->lo());
DoubleRegister result_reg = ToDoubleRegister(instr->result());
Register scratch = scratch0();
// Combine hi_reg:lo_reg into a single 64-bit register.
__ sllg(scratch, hi_reg, Operand(32));
__ lr(scratch, lo_reg);
// Bitwise convert from GPR to FPR
__ ldgr(result_reg, scratch);
}
void LCodeGen::DoAllocate(LAllocate* instr) {
class DeferredAllocate final : public LDeferredCode {
public:
......
......@@ -1793,12 +1793,6 @@ LInstruction* LChunkBuilder::DoDoubleBits(HDoubleBits* instr) {
return DefineAsRegister(new (zone()) LDoubleBits(UseRegister(value)));
}
LInstruction* LChunkBuilder::DoConstructDouble(HConstructDouble* instr) {
LOperand* lo = UseRegister(instr->lo());
LOperand* hi = UseRegister(instr->hi());
return DefineAsRegister(new (zone()) LConstructDouble(hi, lo));
}
LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
LOperand* context = info()->IsStub() ? UseFixed(instr->context(), cp) : NULL;
LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
......
......@@ -53,7 +53,6 @@ class LCodeGen;
V(ConstantI) \
V(ConstantS) \
V(ConstantT) \
V(ConstructDouble) \
V(Context) \
V(DebugBreak) \
V(DeclareGlobals) \
......@@ -2128,19 +2127,6 @@ class LDoubleBits final : public LTemplateInstruction<1, 1, 0> {
DECLARE_HYDROGEN_ACCESSOR(DoubleBits)
};
class LConstructDouble final : public LTemplateInstruction<1, 2, 0> {
public:
LConstructDouble(LOperand* hi, LOperand* lo) {
inputs_[0] = hi;
inputs_[1] = lo;
}
LOperand* hi() { return inputs_[0]; }
LOperand* lo() { return inputs_[1]; }
DECLARE_CONCRETE_INSTRUCTION(ConstructDouble, "construct-double")
};
class LAllocate final : public LTemplateInstruction<1, 2, 2> {
public:
LAllocate(LOperand* context, LOperand* size, LOperand* temp1,
......
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