OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/instruction-selector-impl.h" | 6 #include "src/compiler/instruction-selector-impl.h" |
7 #include "src/compiler/node-matchers.h" | 7 #include "src/compiler/node-matchers.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/s390/frames-s390.h" | 9 #include "src/s390/frames-s390.h" |
10 | 10 |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 Int32BinopMatcher m(value); | 1618 Int32BinopMatcher m(value); |
1619 if (!m.right().Is(0)) break; | 1619 if (!m.right().Is(0)) break; |
1620 | 1620 |
1621 user = value; | 1621 user = value; |
1622 value = m.left().node(); | 1622 value = m.left().node(); |
1623 cont->Negate(); | 1623 cont->Negate(); |
1624 } | 1624 } |
1625 | 1625 |
1626 if (selector->CanCover(user, value)) { | 1626 if (selector->CanCover(user, value)) { |
1627 switch (value->opcode()) { | 1627 switch (value->opcode()) { |
1628 case IrOpcode::kWord32Equal: | 1628 case IrOpcode::kWord32Equal: { |
1629 cont->OverwriteAndNegateIfEqual(kEqual); | 1629 cont->OverwriteAndNegateIfEqual(kEqual); |
| 1630 Int32BinopMatcher m(value); |
| 1631 if (m.right().Is(0)) { |
| 1632 // Try to combine the branch with a comparison. |
| 1633 Node* const user = m.node(); |
| 1634 Node* const value = m.left().node(); |
| 1635 if (selector->CanCover(user, value)) { |
| 1636 switch (value->opcode()) { |
| 1637 case IrOpcode::kInt32Sub: |
| 1638 return VisitWord32Compare(selector, value, cont); |
| 1639 case IrOpcode::kWord32And: |
| 1640 return VisitWordCompare(selector, value, kS390_Tst64, cont, |
| 1641 true, kUint32Imm); |
| 1642 default: |
| 1643 break; |
| 1644 } |
| 1645 } |
| 1646 } |
1630 return VisitWord32Compare(selector, value, cont); | 1647 return VisitWord32Compare(selector, value, cont); |
| 1648 } |
1631 case IrOpcode::kInt32LessThan: | 1649 case IrOpcode::kInt32LessThan: |
1632 cont->OverwriteAndNegateIfEqual(kSignedLessThan); | 1650 cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
1633 return VisitWord32Compare(selector, value, cont); | 1651 return VisitWord32Compare(selector, value, cont); |
1634 case IrOpcode::kInt32LessThanOrEqual: | 1652 case IrOpcode::kInt32LessThanOrEqual: |
1635 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); | 1653 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); |
1636 return VisitWord32Compare(selector, value, cont); | 1654 return VisitWord32Compare(selector, value, cont); |
1637 case IrOpcode::kUint32LessThan: | 1655 case IrOpcode::kUint32LessThan: |
1638 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1656 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); |
1639 return VisitWord32Compare(selector, value, cont); | 1657 return VisitWord32Compare(selector, value, cont); |
1640 case IrOpcode::kUint32LessThanOrEqual: | 1658 case IrOpcode::kUint32LessThanOrEqual: |
1641 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); | 1659 cont->OverwriteAndNegateIfEqual(kUnsignedLessThanOrEqual); |
1642 return VisitWord32Compare(selector, value, cont); | 1660 return VisitWord32Compare(selector, value, cont); |
1643 #if V8_TARGET_ARCH_S390X | 1661 #if V8_TARGET_ARCH_S390X |
1644 case IrOpcode::kWord64Equal: | 1662 case IrOpcode::kWord64Equal: { |
1645 cont->OverwriteAndNegateIfEqual(kEqual); | 1663 cont->OverwriteAndNegateIfEqual(kEqual); |
| 1664 Int64BinopMatcher m(value); |
| 1665 if (m.right().Is(0)) { |
| 1666 // Try to combine the branch with a comparison. |
| 1667 Node* const user = m.node(); |
| 1668 Node* const value = m.left().node(); |
| 1669 if (selector->CanCover(user, value)) { |
| 1670 switch (value->opcode()) { |
| 1671 case IrOpcode::kInt64Sub: |
| 1672 return VisitWord64Compare(selector, value, cont); |
| 1673 case IrOpcode::kWord64And: |
| 1674 return VisitWordCompare(selector, value, kS390_Tst64, cont, |
| 1675 true, kUint32Imm); |
| 1676 default: |
| 1677 break; |
| 1678 } |
| 1679 } |
| 1680 } |
1646 return VisitWord64Compare(selector, value, cont); | 1681 return VisitWord64Compare(selector, value, cont); |
| 1682 } |
1647 case IrOpcode::kInt64LessThan: | 1683 case IrOpcode::kInt64LessThan: |
1648 cont->OverwriteAndNegateIfEqual(kSignedLessThan); | 1684 cont->OverwriteAndNegateIfEqual(kSignedLessThan); |
1649 return VisitWord64Compare(selector, value, cont); | 1685 return VisitWord64Compare(selector, value, cont); |
1650 case IrOpcode::kInt64LessThanOrEqual: | 1686 case IrOpcode::kInt64LessThanOrEqual: |
1651 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); | 1687 cont->OverwriteAndNegateIfEqual(kSignedLessThanOrEqual); |
1652 return VisitWord64Compare(selector, value, cont); | 1688 return VisitWord64Compare(selector, value, cont); |
1653 case IrOpcode::kUint64LessThan: | 1689 case IrOpcode::kUint64LessThan: |
1654 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); | 1690 cont->OverwriteAndNegateIfEqual(kUnsignedLessThan); |
1655 return VisitWord64Compare(selector, value, cont); | 1691 return VisitWord64Compare(selector, value, cont); |
1656 case IrOpcode::kUint64LessThanOrEqual: | 1692 case IrOpcode::kUint64LessThanOrEqual: |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 // static | 2113 // static |
2078 MachineOperatorBuilder::AlignmentRequirements | 2114 MachineOperatorBuilder::AlignmentRequirements |
2079 InstructionSelector::AlignmentRequirements() { | 2115 InstructionSelector::AlignmentRequirements() { |
2080 return MachineOperatorBuilder::AlignmentRequirements:: | 2116 return MachineOperatorBuilder::AlignmentRequirements:: |
2081 FullUnalignedAccessSupport(); | 2117 FullUnalignedAccessSupport(); |
2082 } | 2118 } |
2083 | 2119 |
2084 } // namespace compiler | 2120 } // namespace compiler |
2085 } // namespace internal | 2121 } // namespace internal |
2086 } // namespace v8 | 2122 } // namespace v8 |
OLD | NEW |