Reviewers: danno, Benedikt Meurer, paul.l..., gergely.kis.imgtec, akos.palfi.imgtec, dusmil.imgtec,

Description:
MIPS: [turbofan] Optimize division/modulus by constant.

Port r24595 (d0f464e)

TEST=cctest,mjsunit,unittests
BUG=

Please review this at https://codereview.chromium.org/651223003/

Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+11, -0 lines):
  M src/compiler/mips/code-generator-mips.cc
  M src/compiler/mips/instruction-codes-mips.h
  M src/compiler/mips/instruction-selector-mips.cc


Index: src/compiler/mips/code-generator-mips.cc
diff --git a/src/compiler/mips/code-generator-mips.cc b/src/compiler/mips/code-generator-mips.cc index 8dcca27601ecf684d2de257ab017e3aa200d7482..9609cf4e64a2c939c22e8f8620b169db79edc3f0 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;
Index: src/compiler/mips/instruction-codes-mips.h
diff --git a/src/compiler/mips/instruction-codes-mips.h b/src/compiler/mips/instruction-codes-mips.h index cd05afccbc935818ebc3d6386fe5da7bacecae80..4c18ae1e5a07939a47db0e617cc22644d98d8173 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)                       \
Index: src/compiler/mips/instruction-selector-mips.cc
diff --git a/src/compiler/mips/instruction-selector-mips.cc b/src/compiler/mips/instruction-selector-mips.cc index c96bb3ac543b5a82e9a7b41a84b12098b333879d..0c9afb062d331849a0e1270e457e745a5efd3c3c 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);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to