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

Side by Side Diff: src/compiler/mips64/instruction-selector-mips64.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 | « src/compiler/mips/instruction-selector-mips.cc ('k') | no next file » | 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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 817
818 818
819 void InstructionSelector::VisitInt32Add(Node* node) { 819 void InstructionSelector::VisitInt32Add(Node* node) {
820 Mips64OperandGenerator g(this); 820 Mips64OperandGenerator g(this);
821 Int32BinopMatcher m(node); 821 Int32BinopMatcher m(node);
822 822
823 // Select Lsa for (left + (left_of_right << imm)). 823 // Select Lsa for (left + (left_of_right << imm)).
824 if (m.right().opcode() == IrOpcode::kWord32Shl && 824 if (m.right().opcode() == IrOpcode::kWord32Shl &&
825 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) { 825 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) {
826 Int32BinopMatcher mright(m.right().node()); 826 Int32BinopMatcher mright(m.right().node());
827 if (mright.right().HasValue()) { 827 if (mright.right().HasValue() && !m.left().HasValue()) {
828 int32_t shift_value = static_cast<int32_t>(mright.right().Value()); 828 int32_t shift_value = static_cast<int32_t>(mright.right().Value());
829 Emit(kMips64Lsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()), 829 Emit(kMips64Lsa, g.DefineAsRegister(node), g.UseRegister(m.left().node()),
830 g.UseRegister(mright.left().node()), g.TempImmediate(shift_value)); 830 g.UseRegister(mright.left().node()), g.TempImmediate(shift_value));
831 return; 831 return;
832 } 832 }
833 } 833 }
834 834
835 // Select Lsa for ((left_of_left << imm) + right). 835 // Select Lsa for ((left_of_left << imm) + right).
836 if (m.left().opcode() == IrOpcode::kWord32Shl && 836 if (m.left().opcode() == IrOpcode::kWord32Shl &&
837 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) { 837 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) {
838 Int32BinopMatcher mleft(m.left().node()); 838 Int32BinopMatcher mleft(m.left().node());
839 if (mleft.right().HasValue()) { 839 if (mleft.right().HasValue() && !m.right().HasValue()) {
840 int32_t shift_value = static_cast<int32_t>(mleft.right().Value()); 840 int32_t shift_value = static_cast<int32_t>(mleft.right().Value());
841 Emit(kMips64Lsa, g.DefineAsRegister(node), 841 Emit(kMips64Lsa, g.DefineAsRegister(node),
842 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), 842 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()),
843 g.TempImmediate(shift_value)); 843 g.TempImmediate(shift_value));
844 return; 844 return;
845 } 845 }
846 } 846 }
847 VisitBinop(this, node, kMips64Add, true, kMips64Add); 847 VisitBinop(this, node, kMips64Add, true, kMips64Add);
848 } 848 }
849 849
850 850
851 void InstructionSelector::VisitInt64Add(Node* node) { 851 void InstructionSelector::VisitInt64Add(Node* node) {
852 Mips64OperandGenerator g(this); 852 Mips64OperandGenerator g(this);
853 Int64BinopMatcher m(node); 853 Int64BinopMatcher m(node);
854 854
855 // Select Dlsa for (left + (left_of_right << imm)). 855 // Select Dlsa for (left + (left_of_right << imm)).
856 if (m.right().opcode() == IrOpcode::kWord64Shl && 856 if (m.right().opcode() == IrOpcode::kWord64Shl &&
857 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) { 857 CanCover(node, m.left().node()) && CanCover(node, m.right().node())) {
858 Int64BinopMatcher mright(m.right().node()); 858 Int64BinopMatcher mright(m.right().node());
859 if (mright.right().HasValue()) { 859 if (mright.right().HasValue() && !m.left().HasValue()) {
860 int32_t shift_value = static_cast<int32_t>(mright.right().Value()); 860 int32_t shift_value = static_cast<int32_t>(mright.right().Value());
861 Emit(kMips64Dlsa, g.DefineAsRegister(node), 861 Emit(kMips64Dlsa, g.DefineAsRegister(node),
862 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), 862 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()),
863 g.TempImmediate(shift_value)); 863 g.TempImmediate(shift_value));
864 return; 864 return;
865 } 865 }
866 } 866 }
867 867
868 // Select Dlsa for ((left_of_left << imm) + right). 868 // Select Dlsa for ((left_of_left << imm) + right).
869 if (m.left().opcode() == IrOpcode::kWord64Shl && 869 if (m.left().opcode() == IrOpcode::kWord64Shl &&
870 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) { 870 CanCover(node, m.right().node()) && CanCover(node, m.left().node())) {
871 Int64BinopMatcher mleft(m.left().node()); 871 Int64BinopMatcher mleft(m.left().node());
872 if (mleft.right().HasValue()) { 872 if (mleft.right().HasValue() && !m.right().HasValue()) {
873 int32_t shift_value = static_cast<int32_t>(mleft.right().Value()); 873 int32_t shift_value = static_cast<int32_t>(mleft.right().Value());
874 Emit(kMips64Dlsa, g.DefineAsRegister(node), 874 Emit(kMips64Dlsa, g.DefineAsRegister(node),
875 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), 875 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()),
876 g.TempImmediate(shift_value)); 876 g.TempImmediate(shift_value));
877 return; 877 return;
878 } 878 }
879 } 879 }
880 880
881 VisitBinop(this, node, kMips64Dadd, true, kMips64Dadd); 881 VisitBinop(this, node, kMips64Dadd, true, kMips64Dadd);
882 } 882 }
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 } else { 2599 } else {
2600 DCHECK(kArchVariant == kMips64r2); 2600 DCHECK(kArchVariant == kMips64r2);
2601 return MachineOperatorBuilder::AlignmentRequirements:: 2601 return MachineOperatorBuilder::AlignmentRequirements::
2602 NoUnalignedAccessSupport(); 2602 NoUnalignedAccessSupport();
2603 } 2603 }
2604 } 2604 }
2605 2605
2606 } // namespace compiler 2606 } // namespace compiler
2607 } // namespace internal 2607 } // namespace internal
2608 } // namespace v8 2608 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-selector-mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698