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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 Int64BinopMatcher rightInput(right), leftInput(left); | 664 Int64BinopMatcher rightInput(right), leftInput(left); |
665 if (rightInput.right().Is(32) && leftInput.right().Is(32)) { | 665 if (rightInput.right().Is(32) && leftInput.right().Is(32)) { |
666 // Combine both shifted operands with Ddiv. | 666 // Combine both shifted operands with Ddiv. |
667 Emit(kMips64Ddiv, g.DefineSameAsFirst(node), | 667 Emit(kMips64Ddiv, g.DefineSameAsFirst(node), |
668 g.UseRegister(leftInput.left().node()), | 668 g.UseRegister(leftInput.left().node()), |
669 g.UseRegister(rightInput.left().node())); | 669 g.UseRegister(rightInput.left().node())); |
670 return; | 670 return; |
671 } | 671 } |
672 } | 672 } |
673 } | 673 } |
674 Emit(kMips64Div, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 674 Emit(kMips64Div, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
675 g.UseRegister(m.right().node())); | 675 g.UseRegister(m.right().node())); |
676 } | 676 } |
677 | 677 |
678 | 678 |
679 void InstructionSelector::VisitUint32Div(Node* node) { | 679 void InstructionSelector::VisitUint32Div(Node* node) { |
680 Mips64OperandGenerator g(this); | 680 Mips64OperandGenerator g(this); |
681 Int32BinopMatcher m(node); | 681 Int32BinopMatcher m(node); |
682 Emit(kMips64DivU, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 682 Emit(kMips64DivU, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
683 g.UseRegister(m.right().node())); | 683 g.UseRegister(m.right().node())); |
684 } | 684 } |
685 | 685 |
686 | 686 |
687 void InstructionSelector::VisitInt32Mod(Node* node) { | 687 void InstructionSelector::VisitInt32Mod(Node* node) { |
688 Mips64OperandGenerator g(this); | 688 Mips64OperandGenerator g(this); |
689 Int32BinopMatcher m(node); | 689 Int32BinopMatcher m(node); |
690 Node* left = node->InputAt(0); | 690 Node* left = node->InputAt(0); |
691 Node* right = node->InputAt(1); | 691 Node* right = node->InputAt(1); |
692 if (CanCover(node, left) && CanCover(node, right)) { | 692 if (CanCover(node, left) && CanCover(node, right)) { |
(...skipping 18 matching lines...) Expand all Loading... |
711 Mips64OperandGenerator g(this); | 711 Mips64OperandGenerator g(this); |
712 Int32BinopMatcher m(node); | 712 Int32BinopMatcher m(node); |
713 Emit(kMips64ModU, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 713 Emit(kMips64ModU, g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
714 g.UseRegister(m.right().node())); | 714 g.UseRegister(m.right().node())); |
715 } | 715 } |
716 | 716 |
717 | 717 |
718 void InstructionSelector::VisitInt64Div(Node* node) { | 718 void InstructionSelector::VisitInt64Div(Node* node) { |
719 Mips64OperandGenerator g(this); | 719 Mips64OperandGenerator g(this); |
720 Int64BinopMatcher m(node); | 720 Int64BinopMatcher m(node); |
721 Emit(kMips64Ddiv, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 721 Emit(kMips64Ddiv, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
722 g.UseRegister(m.right().node())); | 722 g.UseRegister(m.right().node())); |
723 } | 723 } |
724 | 724 |
725 | 725 |
726 void InstructionSelector::VisitUint64Div(Node* node) { | 726 void InstructionSelector::VisitUint64Div(Node* node) { |
727 Mips64OperandGenerator g(this); | 727 Mips64OperandGenerator g(this); |
728 Int64BinopMatcher m(node); | 728 Int64BinopMatcher m(node); |
729 Emit(kMips64DdivU, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 729 Emit(kMips64DdivU, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
730 g.UseRegister(m.right().node())); | 730 g.UseRegister(m.right().node())); |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 void InstructionSelector::VisitInt64Mod(Node* node) { | 734 void InstructionSelector::VisitInt64Mod(Node* node) { |
735 Mips64OperandGenerator g(this); | 735 Mips64OperandGenerator g(this); |
736 Int64BinopMatcher m(node); | 736 Int64BinopMatcher m(node); |
737 Emit(kMips64Dmod, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 737 Emit(kMips64Dmod, g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
738 g.UseRegister(m.right().node())); | 738 g.UseRegister(m.right().node())); |
739 } | 739 } |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1646 Node* right = node->InputAt(1); | 1646 Node* right = node->InputAt(1); |
1647 Emit(kMips64Float64InsertHighWord32, g.DefineSameAsFirst(node), | 1647 Emit(kMips64Float64InsertHighWord32, g.DefineSameAsFirst(node), |
1648 g.UseRegister(left), g.UseRegister(right)); | 1648 g.UseRegister(left), g.UseRegister(right)); |
1649 } | 1649 } |
1650 | 1650 |
1651 | 1651 |
1652 // static | 1652 // static |
1653 MachineOperatorBuilder::Flags | 1653 MachineOperatorBuilder::Flags |
1654 InstructionSelector::SupportedMachineOperatorFlags() { | 1654 InstructionSelector::SupportedMachineOperatorFlags() { |
1655 return MachineOperatorBuilder::kWord32ShiftIsSafe | | 1655 return MachineOperatorBuilder::kWord32ShiftIsSafe | |
| 1656 MachineOperatorBuilder::kInt32DivIsSafe | |
| 1657 MachineOperatorBuilder::kUint32DivIsSafe | |
1656 MachineOperatorBuilder::kFloat64Min | | 1658 MachineOperatorBuilder::kFloat64Min | |
1657 MachineOperatorBuilder::kFloat64Max | | 1659 MachineOperatorBuilder::kFloat64Max | |
1658 MachineOperatorBuilder::kFloat32Min | | 1660 MachineOperatorBuilder::kFloat32Min | |
1659 MachineOperatorBuilder::kFloat32Max | | 1661 MachineOperatorBuilder::kFloat32Max | |
1660 MachineOperatorBuilder::kFloat64RoundDown | | 1662 MachineOperatorBuilder::kFloat64RoundDown | |
1661 MachineOperatorBuilder::kFloat32RoundDown | | 1663 MachineOperatorBuilder::kFloat32RoundDown | |
1662 MachineOperatorBuilder::kFloat64RoundUp | | 1664 MachineOperatorBuilder::kFloat64RoundUp | |
1663 MachineOperatorBuilder::kFloat32RoundUp | | 1665 MachineOperatorBuilder::kFloat32RoundUp | |
1664 MachineOperatorBuilder::kFloat64RoundTruncate | | 1666 MachineOperatorBuilder::kFloat64RoundTruncate | |
1665 MachineOperatorBuilder::kFloat32RoundTruncate | | 1667 MachineOperatorBuilder::kFloat32RoundTruncate | |
1666 MachineOperatorBuilder::kFloat64RoundTiesEven | | 1668 MachineOperatorBuilder::kFloat64RoundTiesEven | |
1667 MachineOperatorBuilder::kFloat32RoundTiesEven; | 1669 MachineOperatorBuilder::kFloat32RoundTiesEven; |
1668 } | 1670 } |
1669 | 1671 |
1670 } // namespace compiler | 1672 } // namespace compiler |
1671 } // namespace internal | 1673 } // namespace internal |
1672 } // namespace v8 | 1674 } // namespace v8 |
OLD | NEW |