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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 VisitWordTest(selector, node, kArm64Tst32, cont); | 1664 VisitWordTest(selector, node, kArm64Tst32, cont); |
1665 } | 1665 } |
1666 | 1666 |
1667 | 1667 |
1668 void VisitWord64Test(InstructionSelector* selector, Node* node, | 1668 void VisitWord64Test(InstructionSelector* selector, Node* node, |
1669 FlagsContinuation* cont) { | 1669 FlagsContinuation* cont) { |
1670 VisitWordTest(selector, node, kArm64Tst, cont); | 1670 VisitWordTest(selector, node, kArm64Tst, cont); |
1671 } | 1671 } |
1672 | 1672 |
1673 | 1673 |
1674 // Shared routine for multiple float64 compare operations. | 1674 // Shared routine for multiple float32 compare operations. |
1675 void VisitFloat32Compare(InstructionSelector* selector, Node* node, | 1675 void VisitFloat32Compare(InstructionSelector* selector, Node* node, |
1676 FlagsContinuation* cont) { | 1676 FlagsContinuation* cont) { |
1677 Arm64OperandGenerator g(selector); | 1677 Arm64OperandGenerator g(selector); |
1678 Float32BinopMatcher m(node); | 1678 Float32BinopMatcher m(node); |
1679 if (m.right().Is(0.0f)) { | 1679 if (m.right().Is(0.0f)) { |
1680 VisitCompare(selector, kArm64Float32Cmp, g.UseRegister(m.left().node()), | 1680 VisitCompare(selector, kArm64Float32Cmp, g.UseRegister(m.left().node()), |
1681 g.UseImmediate(m.right().node()), cont); | 1681 g.UseImmediate(m.right().node()), cont); |
| 1682 } else if (m.left().Is(0.0f)) { |
| 1683 cont->Commute(); |
| 1684 VisitCompare(selector, kArm64Float32Cmp, g.UseRegister(m.right().node()), |
| 1685 g.UseImmediate(m.left().node()), cont); |
1682 } else { | 1686 } else { |
1683 VisitCompare(selector, kArm64Float32Cmp, g.UseRegister(m.left().node()), | 1687 VisitCompare(selector, kArm64Float32Cmp, g.UseRegister(m.left().node()), |
1684 g.UseRegister(m.right().node()), cont); | 1688 g.UseRegister(m.right().node()), cont); |
1685 } | 1689 } |
1686 } | 1690 } |
1687 | 1691 |
1688 | 1692 |
1689 // Shared routine for multiple float64 compare operations. | 1693 // Shared routine for multiple float64 compare operations. |
1690 void VisitFloat64Compare(InstructionSelector* selector, Node* node, | 1694 void VisitFloat64Compare(InstructionSelector* selector, Node* node, |
1691 FlagsContinuation* cont) { | 1695 FlagsContinuation* cont) { |
1692 Arm64OperandGenerator g(selector); | 1696 Arm64OperandGenerator g(selector); |
1693 Float64BinopMatcher m(node); | 1697 Float64BinopMatcher m(node); |
1694 if (m.right().Is(0.0)) { | 1698 if (m.right().Is(0.0)) { |
1695 VisitCompare(selector, kArm64Float64Cmp, g.UseRegister(m.left().node()), | 1699 VisitCompare(selector, kArm64Float64Cmp, g.UseRegister(m.left().node()), |
1696 g.UseImmediate(m.right().node()), cont); | 1700 g.UseImmediate(m.right().node()), cont); |
| 1701 } else if (m.left().Is(0.0)) { |
| 1702 cont->Commute(); |
| 1703 VisitCompare(selector, kArm64Float64Cmp, g.UseRegister(m.right().node()), |
| 1704 g.UseImmediate(m.left().node()), cont); |
1697 } else { | 1705 } else { |
1698 VisitCompare(selector, kArm64Float64Cmp, g.UseRegister(m.left().node()), | 1706 VisitCompare(selector, kArm64Float64Cmp, g.UseRegister(m.left().node()), |
1699 g.UseRegister(m.right().node()), cont); | 1707 g.UseRegister(m.right().node()), cont); |
1700 } | 1708 } |
1701 } | 1709 } |
1702 | 1710 |
1703 } // namespace | 1711 } // namespace |
1704 | 1712 |
1705 | 1713 |
1706 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, | 1714 void InstructionSelector::VisitBranch(Node* branch, BasicBlock* tbranch, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 return VisitWordCompare(this, value, kArm64Cmp, &cont, false, | 1766 return VisitWordCompare(this, value, kArm64Cmp, &cont, false, |
1759 kArithmeticImm); | 1767 kArithmeticImm); |
1760 case IrOpcode::kUint64LessThanOrEqual: | 1768 case IrOpcode::kUint64LessThanOrEqual: |
1761 cont.OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); | 1769 cont.OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); |
1762 return VisitWordCompare(this, value, kArm64Cmp, &cont, false, | 1770 return VisitWordCompare(this, value, kArm64Cmp, &cont, false, |
1763 kArithmeticImm); | 1771 kArithmeticImm); |
1764 case IrOpcode::kFloat32Equal: | 1772 case IrOpcode::kFloat32Equal: |
1765 cont.OverwriteAndNegateIfEqual(kEqual); | 1773 cont.OverwriteAndNegateIfEqual(kEqual); |
1766 return VisitFloat32Compare(this, value, &cont); | 1774 return VisitFloat32Compare(this, value, &cont); |
1767 case IrOpcode::kFloat32LessThan: | 1775 case IrOpcode::kFloat32LessThan: |
1768 cont.OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1776 cont.OverwriteAndNegateIfEqual(kFloatLessThan); |
1769 return VisitFloat32Compare(this, value, &cont); | 1777 return VisitFloat32Compare(this, value, &cont); |
1770 case IrOpcode::kFloat32LessThanOrEqual: | 1778 case IrOpcode::kFloat32LessThanOrEqual: |
1771 cont.OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); | 1779 cont.OverwriteAndNegateIfEqual(kFloatLessThanOrEqual); |
1772 return VisitFloat32Compare(this, value, &cont); | 1780 return VisitFloat32Compare(this, value, &cont); |
1773 case IrOpcode::kFloat64Equal: | 1781 case IrOpcode::kFloat64Equal: |
1774 cont.OverwriteAndNegateIfEqual(kEqual); | 1782 cont.OverwriteAndNegateIfEqual(kEqual); |
1775 return VisitFloat64Compare(this, value, &cont); | 1783 return VisitFloat64Compare(this, value, &cont); |
1776 case IrOpcode::kFloat64LessThan: | 1784 case IrOpcode::kFloat64LessThan: |
1777 cont.OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1785 cont.OverwriteAndNegateIfEqual(kFloatLessThan); |
1778 return VisitFloat64Compare(this, value, &cont); | 1786 return VisitFloat64Compare(this, value, &cont); |
1779 case IrOpcode::kFloat64LessThanOrEqual: | 1787 case IrOpcode::kFloat64LessThanOrEqual: |
1780 cont.OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); | 1788 cont.OverwriteAndNegateIfEqual(kFloatLessThanOrEqual); |
1781 return VisitFloat64Compare(this, value, &cont); | 1789 return VisitFloat64Compare(this, value, &cont); |
1782 case IrOpcode::kProjection: | 1790 case IrOpcode::kProjection: |
1783 // Check if this is the overflow output projection of an | 1791 // Check if this is the overflow output projection of an |
1784 // <Operation>WithOverflow node. | 1792 // <Operation>WithOverflow node. |
1785 if (ProjectionIndexOf(value->op()) == 1u) { | 1793 if (ProjectionIndexOf(value->op()) == 1u) { |
1786 // We cannot combine the <Operation>WithOverflow with this branch | 1794 // We cannot combine the <Operation>WithOverflow with this branch |
1787 // unless the 0th projection (the use of the actual value of the | 1795 // unless the 0th projection (the use of the actual value of the |
1788 // <Operation> is either NULL, which means there's no use of the | 1796 // <Operation> is either NULL, which means there's no use of the |
1789 // actual value, or was already defined, which means it is scheduled | 1797 // actual value, or was already defined, which means it is scheduled |
1790 // *AFTER* this branch). | 1798 // *AFTER* this branch). |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 } | 2019 } |
2012 | 2020 |
2013 | 2021 |
2014 void InstructionSelector::VisitFloat32Equal(Node* node) { | 2022 void InstructionSelector::VisitFloat32Equal(Node* node) { |
2015 FlagsContinuation cont(kEqual, node); | 2023 FlagsContinuation cont(kEqual, node); |
2016 VisitFloat32Compare(this, node, &cont); | 2024 VisitFloat32Compare(this, node, &cont); |
2017 } | 2025 } |
2018 | 2026 |
2019 | 2027 |
2020 void InstructionSelector::VisitFloat32LessThan(Node* node) { | 2028 void InstructionSelector::VisitFloat32LessThan(Node* node) { |
2021 FlagsContinuation cont(kUnsignedLessThan, node); | 2029 FlagsContinuation cont(kFloatLessThan, node); |
2022 VisitFloat32Compare(this, node, &cont); | 2030 VisitFloat32Compare(this, node, &cont); |
2023 } | 2031 } |
2024 | 2032 |
2025 | 2033 |
2026 void InstructionSelector::VisitFloat32LessThanOrEqual(Node* node) { | 2034 void InstructionSelector::VisitFloat32LessThanOrEqual(Node* node) { |
2027 FlagsContinuation cont(kUnsignedLessThanOrEqual, node); | 2035 FlagsContinuation cont(kFloatLessThanOrEqual, node); |
2028 VisitFloat32Compare(this, node, &cont); | 2036 VisitFloat32Compare(this, node, &cont); |
2029 } | 2037 } |
2030 | 2038 |
2031 | 2039 |
2032 void InstructionSelector::VisitFloat64Equal(Node* node) { | 2040 void InstructionSelector::VisitFloat64Equal(Node* node) { |
2033 FlagsContinuation cont(kEqual, node); | 2041 FlagsContinuation cont(kEqual, node); |
2034 VisitFloat64Compare(this, node, &cont); | 2042 VisitFloat64Compare(this, node, &cont); |
2035 } | 2043 } |
2036 | 2044 |
2037 | 2045 |
2038 void InstructionSelector::VisitFloat64LessThan(Node* node) { | 2046 void InstructionSelector::VisitFloat64LessThan(Node* node) { |
2039 FlagsContinuation cont(kUnsignedLessThan, node); | 2047 FlagsContinuation cont(kFloatLessThan, node); |
2040 VisitFloat64Compare(this, node, &cont); | 2048 VisitFloat64Compare(this, node, &cont); |
2041 } | 2049 } |
2042 | 2050 |
2043 | 2051 |
2044 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { | 2052 void InstructionSelector::VisitFloat64LessThanOrEqual(Node* node) { |
2045 FlagsContinuation cont(kUnsignedLessThanOrEqual, node); | 2053 FlagsContinuation cont(kFloatLessThanOrEqual, node); |
2046 VisitFloat64Compare(this, node, &cont); | 2054 VisitFloat64Compare(this, node, &cont); |
2047 } | 2055 } |
2048 | 2056 |
2049 | 2057 |
2050 void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { | 2058 void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { |
2051 Arm64OperandGenerator g(this); | 2059 Arm64OperandGenerator g(this); |
2052 Emit(kArm64Float64ExtractLowWord32, g.DefineAsRegister(node), | 2060 Emit(kArm64Float64ExtractLowWord32, g.DefineAsRegister(node), |
2053 g.UseRegister(node->InputAt(0))); | 2061 g.UseRegister(node->InputAt(0))); |
2054 } | 2062 } |
2055 | 2063 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2103 MachineOperatorBuilder::kFloat64RoundTruncate | | 2111 MachineOperatorBuilder::kFloat64RoundTruncate | |
2104 MachineOperatorBuilder::kFloat64RoundTiesAway | | 2112 MachineOperatorBuilder::kFloat64RoundTiesAway | |
2105 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2113 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2106 MachineOperatorBuilder::kInt32DivIsSafe | | 2114 MachineOperatorBuilder::kInt32DivIsSafe | |
2107 MachineOperatorBuilder::kUint32DivIsSafe; | 2115 MachineOperatorBuilder::kUint32DivIsSafe; |
2108 } | 2116 } |
2109 | 2117 |
2110 } // namespace compiler | 2118 } // namespace compiler |
2111 } // namespace internal | 2119 } // namespace internal |
2112 } // namespace v8 | 2120 } // namespace v8 |
OLD | NEW |