MIPS: [turbofan] Optimize division/modulus by constant.
authorbalazs.kilvady@imgtec.com <balazs.kilvady@imgtec.com>
Tue, 14 Oct 2014 17:26:14 +0000 (17:26 +0000)
committerbalazs.kilvady@imgtec.com <balazs.kilvady@imgtec.com>
Tue, 14 Oct 2014 17:26:14 +0000 (17:26 +0000)
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
src/compiler/mips/instruction-codes-mips.h
src/compiler/mips/instruction-selector-mips.cc

index 8dcca27601ecf684d2de257ab017e3aa200d7482..9609cf4e64a2c939c22e8f8620b169db79edc3f0 100644 (file)
@@ -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;
index cd05afccbc935818ebc3d6386fe5da7bacecae80..4c18ae1e5a07939a47db0e617cc22644d98d8173 100644 (file)
@@ -17,6 +17,7 @@ namespace compiler {
   V(MipsSub)                       \
   V(MipsSubOvf)                    \
   V(MipsMul)                       \
+  V(MipsMulHigh)                   \
   V(MipsDiv)                       \
   V(MipsDivU)                      \
   V(MipsMod)                       \
index c96bb3ac543b5a82e9a7b41a84b12098b333879d..0c9afb062d331849a0e1270e457e745a5efd3c3c 100644 (file)
@@ -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);