Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: src/compiler/mips/instruction-selector-mips.cc

Issue 2509203003: MIPS[64]: Disable Add/Shl to Lsa optimization if operand is immediate (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/mips64/instruction-selector-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 645
646 646
647 void InstructionSelector::VisitInt32Add(Node* node) { 647 void InstructionSelector::VisitInt32Add(Node* node) {
648 MipsOperandGenerator g(this); 648 MipsOperandGenerator g(this);
649 Int32BinopMatcher m(node); 649 Int32BinopMatcher m(node);
650 650
651 // Select Lsa for (left + (left_of_right << imm)). 651 // Select Lsa for (left + (left_of_right << imm)).
652 if (m.right().opcode() == IrOpcode::kWord32Shl && 652 if (m.right().opcode() == IrOpcode::kWord32Shl &&
653 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) { 653 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) {
654 Int32BinopMatcher mright(m.right().node()); 654 Int32BinopMatcher mright(m.right().node());
655 if (mright.right().HasValue()) { 655 if (mright.right().HasValue() && !m.left().HasValue()) {
656 int32_t shift_value = static_cast<int32_t>(mright.right().Value()); 656 int32_t shift_value = static_cast<int32_t>(mright.right().Value());
657 Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()), 657 Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
658 g.UseRegister(mright.left().node()), g.TempImmediate(shift_value)); 658 g.UseRegister(mright.left().node()), g.TempImmediate(shift_value));
659 return; 659 return;
660 } 660 }
661 } 661 }
662 662
663 // Select Lsa for ((left_of_left << imm) + right). 663 // Select Lsa for ((left_of_left << imm) + right).
664 if (m.left().opcode() == IrOpcode::kWord32Shl && 664 if (m.left().opcode() == IrOpcode::kWord32Shl &&
665 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) { 665 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) {
666 Int32BinopMatcher mleft(m.left().node()); 666 Int32BinopMatcher mleft(m.left().node());
667 if (mleft.right().HasValue()) { 667 if (mleft.right().HasValue() && !m.right().HasValue()) {
668 int32_t shift_value = static_cast<int32_t>(mleft.right().Value()); 668 int32_t shift_value = static_cast<int32_t>(mleft.right().Value());
669 Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.right().node()), 669 Emit(kMipsLsa, g.DefineAsRegister(node), g.UseRegister(m.right().node()),
670 g.UseRegister(mleft.left().node()), g.TempImmediate(shift_value)); 670 g.UseRegister(mleft.left().node()), g.TempImmediate(shift_value));
671 return; 671 return;
672 } 672 }
673 } 673 }
674 674
675 VisitBinop(this, node, kMipsAdd, true, kMipsAdd); 675 VisitBinop(this, node, kMipsAdd, true, kMipsAdd);
676 } 676 }
677 677
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || 1917 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) ||
1918 IsMipsArchVariant(kMips32r2)); 1918 IsMipsArchVariant(kMips32r2));
1919 return MachineOperatorBuilder::AlignmentRequirements:: 1919 return MachineOperatorBuilder::AlignmentRequirements::
1920 NoUnalignedAccessSupport(); 1920 NoUnalignedAccessSupport();
1921 } 1921 }
1922 } 1922 }
1923 1923
1924 } // namespace compiler 1924 } // namespace compiler
1925 } // namespace internal 1925 } // namespace internal
1926 } // namespace v8 1926 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/mips64/instruction-selector-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698