Commit d9440156 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [builtins] Introduce proper Float64Tan operator.

  port c87168bc (r37087)

  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.

BUG=

Review-Url: https://codereview.chromium.org/2101233002
Cr-Commit-Position: refs/heads/master@{#37313}
parent 353e1152
......@@ -790,6 +790,11 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
ASSEMBLE_IEEE754_UNOP(sin);
__ X87SetFPUCW(0x037F);
break;
case kIeee754Float64Tan:
__ X87SetFPUCW(0x027F);
ASSEMBLE_IEEE754_UNOP(tan);
__ X87SetFPUCW(0x037F);
break;
case kX87Add:
if (HasImmediateInput(instr, 1)) {
__ add(i.InputOperand(0), i.InputImmediate(1));
......
......@@ -5301,21 +5301,6 @@ void LCodeGen::DoDoubleBits(LDoubleBits* instr) {
}
void LCodeGen::DoConstructDouble(LConstructDouble* instr) {
Register hi_reg = ToRegister(instr->hi());
Register lo_reg = ToRegister(instr->lo());
X87Register result_reg = ToX87Register(instr->result());
// Follow below pattern to write a x87 fp register.
X87PrepareToWrite(result_reg);
__ sub(esp, Immediate(kDoubleSize));
__ mov(Operand(esp, 0), lo_reg);
__ mov(Operand(esp, kPointerSize), hi_reg);
__ fld_d(Operand(esp, 0));
__ add(esp, Immediate(kDoubleSize));
X87CommitWrite(result_reg);
}
void LCodeGen::DoAllocate(LAllocate* instr) {
class DeferredAllocate final : public LDeferredCode {
public:
......
......@@ -1992,13 +1992,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(), esi) : NULL;
LOperand* parameter_count = UseRegisterOrConstant(instr->parameter_count());
......
......@@ -58,7 +58,6 @@ class LCodeGen;
V(ConstantI) \
V(ConstantS) \
V(ConstantT) \
V(ConstructDouble) \
V(Context) \
V(DebugBreak) \
V(DeclareGlobals) \
......@@ -2357,20 +2356,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, 1> {
public:
LAllocate(LOperand* context, LOperand* size, LOperand* temp) {
......
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