OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |