| 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 f86ffe76439f73b3daa7ac461b276c722bf29e83..963eb0f8d1277a4c76df9d1b7206eef803d0084e 100644
|
| --- a/src/compiler/mips/instruction-selector-mips.cc
|
| +++ b/src/compiler/mips/instruction-selector-mips.cc
|
| @@ -444,8 +444,32 @@ void InstructionSelector::VisitWord32Popcnt(Node* node) {
|
|
|
| void InstructionSelector::VisitInt32Add(Node* node) {
|
| MipsOperandGenerator g(this);
|
| + Int32BinopMatcher m(node);
|
| +
|
| + // Select Lsa for (left + (left_of_right << imm)).
|
| + if (m.right().opcode() == IrOpcode::kWord32Shl &&
|
| + CanCover(node, m.left().node()) && CanCover(node, m.right().node())) {
|
| + Int32BinopMatcher mright(m.right().node());
|
| + if (mright.right().HasValue()) {
|
| + int32_t shift_value = static_cast<int32_t>(mright.right().Value());
|
| + Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
|
| + g.UseRegister(mright.left().node()), g.TempImmediate(shift_value));
|
| + return;
|
| + }
|
| + }
|
| +
|
| + // Select Lsa for ((left_of_left << imm) + right).
|
| + if (m.left().opcode() == IrOpcode::kWord32Shl &&
|
| + CanCover(node, m.right().node()) && CanCover(node, m.left().node())) {
|
| + Int32BinopMatcher mleft(m.left().node());
|
| + if (mleft.right().HasValue()) {
|
| + int32_t shift_value = static_cast<int32_t>(mleft.right().Value());
|
| + Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.right().node()),
|
| + g.UseRegister(mleft.left().node()), g.TempImmediate(shift_value));
|
| + return;
|
| + }
|
| + }
|
|
|
| - // TODO(plind): Consider multiply & add optimization from arm port.
|
| VisitBinop(this, node, kMipsAdd);
|
| }
|
|
|
| @@ -467,12 +491,9 @@ void InstructionSelector::VisitInt32Mul(Node* node) {
|
| return;
|
| }
|
| if (base::bits::IsPowerOfTwo32(value - 1)) {
|
| - InstructionOperand temp = g.TempRegister();
|
| - Emit(kMipsShl | AddressingModeField::encode(kMode_None), temp,
|
| + Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
|
| g.UseRegister(m.left().node()),
|
| g.TempImmediate(WhichPowerOf2(value - 1)));
|
| - Emit(kMipsAdd | AddressingModeField::encode(kMode_None),
|
| - g.DefineAsRegister(node), g.UseRegister(m.left().node()), temp);
|
| return;
|
| }
|
| if (base::bits::IsPowerOfTwo32(value + 1)) {
|
|
|