From 2de468e8543f57fada9d507c181ca6d41f9c1191 Mon Sep 17 00:00:00 2001 From: "balazs.kilvady@imgtec.com" Date: Tue, 14 Oct 2014 17:26:14 +0000 Subject: [PATCH] MIPS: [turbofan] Optimize division/modulus by constant. Port r24595 (d0f464e) TEST=cctest,mjsunit,unittests BUG= R=paul.lind@imgtec.com Review URL: https://codereview.chromium.org/651223003 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24611 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/compiler/mips/code-generator-mips.cc | 3 +++ src/compiler/mips/instruction-codes-mips.h | 1 + src/compiler/mips/instruction-selector-mips.cc | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc index 8dcca27..9609cf4 100644 --- a/src/compiler/mips/code-generator-mips.cc +++ b/src/compiler/mips/code-generator-mips.cc @@ -185,6 +185,9 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) { case kMipsMul: __ Mul(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); break; + case kMipsMulHigh: + __ Mulh(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); + break; case kMipsDiv: __ Div(i.OutputRegister(), i.InputRegister(0), i.InputOperand(1)); break; diff --git a/src/compiler/mips/instruction-codes-mips.h b/src/compiler/mips/instruction-codes-mips.h index cd05afc..4c18ae1 100644 --- a/src/compiler/mips/instruction-codes-mips.h +++ b/src/compiler/mips/instruction-codes-mips.h @@ -17,6 +17,7 @@ namespace compiler { V(MipsSub) \ V(MipsSubOvf) \ V(MipsMul) \ + V(MipsMulHigh) \ V(MipsDiv) \ V(MipsDivU) \ V(MipsMod) \ diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc index c96bb3a..0c9afb0 100644 --- a/src/compiler/mips/instruction-selector-mips.cc +++ b/src/compiler/mips/instruction-selector-mips.cc @@ -300,6 +300,13 @@ void InstructionSelector::VisitInt32Mul(Node* node) { } +void InstructionSelector::VisitInt32MulHigh(Node* node) { + MipsOperandGenerator g(this); + Emit(kMipsMulHigh, g.DefineAsRegister(node), g.UseRegister(node->InputAt(0)), + g.UseRegister(node->InputAt(1))); +} + + void InstructionSelector::VisitInt32Div(Node* node) { MipsOperandGenerator g(this); Int32BinopMatcher m(node); -- 2.7.4