From: jacob.bramley Date: Mon, 23 Mar 2015 10:25:11 +0000 (-0700) Subject: [ARM64] [turbofan] Support Float64Min and Float64Max. X-Git-Tag: upstream/4.7.83~3679 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9ef7d42678d486123445aa17459ff778625bcb0;p=platform%2Fupstream%2Fv8.git [ARM64] [turbofan] Support Float64Min and Float64Max. ARM64 support for Float64Min and Float64Max machine operators (https://codereview.chromium.org/998283002/) using fmin and fmax. BUG= Review URL: https://codereview.chromium.org/1024093002 Cr-Commit-Position: refs/heads/master@{#27361} --- diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc index 312222508..eed1e13f7 100644 --- a/src/compiler/arm64/code-generator-arm64.cc +++ b/src/compiler/arm64/code-generator-arm64.cc @@ -740,6 +740,14 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { __ Fmov(i.OutputFloat64Register(), i.InputRegister(0)); break; } + case kArm64Float64Max: + __ Fmax(i.OutputDoubleRegister(), i.InputDoubleRegister(0), + i.InputDoubleRegister(1)); + break; + case kArm64Float64Min: + __ Fmin(i.OutputDoubleRegister(), i.InputDoubleRegister(0), + i.InputDoubleRegister(1)); + break; case kArm64Ldrb: __ Ldrb(i.OutputRegister(), i.MemoryOperand()); break; @@ -842,7 +850,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { ASSEMBLE_CHECKED_STORE_FLOAT(64); break; } -} +} // NOLINT(readability/fn_size) // Assemble branches after this instruction. diff --git a/src/compiler/arm64/instruction-codes-arm64.h b/src/compiler/arm64/instruction-codes-arm64.h index 3e3f5c37d..ab19216e6 100644 --- a/src/compiler/arm64/instruction-codes-arm64.h +++ b/src/compiler/arm64/instruction-codes-arm64.h @@ -101,6 +101,8 @@ namespace compiler { V(Arm64Float64InsertLowWord32) \ V(Arm64Float64InsertHighWord32) \ V(Arm64Float64MoveU64) \ + V(Arm64Float64Max) \ + V(Arm64Float64Min) \ V(Arm64LdrS) \ V(Arm64StrS) \ V(Arm64LdrD) \ diff --git a/src/compiler/arm64/instruction-selector-arm64.cc b/src/compiler/arm64/instruction-selector-arm64.cc index 97099e225..c6c47d76d 100644 --- a/src/compiler/arm64/instruction-selector-arm64.cc +++ b/src/compiler/arm64/instruction-selector-arm64.cc @@ -1104,10 +1104,22 @@ void InstructionSelector::VisitFloat64Mod(Node* node) { } -void InstructionSelector::VisitFloat64Max(Node* node) { UNREACHABLE(); } +void InstructionSelector::VisitFloat64Max(Node* node) { + Arm64OperandGenerator g(this); + Node* left = node->InputAt(0); + Node* right = node->InputAt(1); + Emit(kArm64Float64Max, g.DefineAsRegister(node), g.UseRegister(left), + g.UseRegister(right)); +} -void InstructionSelector::VisitFloat64Min(Node* node) { UNREACHABLE(); } +void InstructionSelector::VisitFloat64Min(Node* node) { + Arm64OperandGenerator g(this); + Node* left = node->InputAt(0); + Node* right = node->InputAt(1); + Emit(kArm64Float64Min, g.DefineAsRegister(node), g.UseRegister(left), + g.UseRegister(right)); +} void InstructionSelector::VisitFloat64Sqrt(Node* node) { @@ -1681,6 +1693,8 @@ InstructionSelector::SupportedMachineOperatorFlags() { return MachineOperatorBuilder::kFloat64RoundDown | MachineOperatorBuilder::kFloat64RoundTruncate | MachineOperatorBuilder::kFloat64RoundTiesAway | + MachineOperatorBuilder::kFloat64Max | + MachineOperatorBuilder::kFloat64Min | MachineOperatorBuilder::kWord32ShiftIsSafe | MachineOperatorBuilder::kInt32DivIsSafe | MachineOperatorBuilder::kUint32DivIsSafe;