| 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 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 S390OperandGenerator g(this); | 912 S390OperandGenerator g(this); |
| 913 Int64BinopMatcher m(node); | 913 Int64BinopMatcher m(node); |
| 914 if (m.left().Is(0)) { | 914 if (m.left().Is(0)) { |
| 915 Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node())); | 915 Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node())); |
| 916 } else { | 916 } else { |
| 917 VisitBinop<Int64BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate); | 917 VisitBinop<Int64BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate); |
| 918 } | 918 } |
| 919 } | 919 } |
| 920 #endif | 920 #endif |
| 921 | 921 |
| 922 namespace { |
| 923 |
| 924 void VisitCompare(InstructionSelector* selector, InstructionCode opcode, |
| 925 InstructionOperand left, InstructionOperand right, |
| 926 FlagsContinuation* cont); |
| 927 void EmitInt32MulWithOverflow(InstructionSelector* selector, Node* node, |
| 928 FlagsContinuation* cont) { |
| 929 S390OperandGenerator g(selector); |
| 930 Int32BinopMatcher m(node); |
| 931 InstructionOperand result_operand = g.DefineAsRegister(node); |
| 932 InstructionOperand high32_operand = g.TempRegister(); |
| 933 InstructionOperand temp_operand = g.TempRegister(); |
| 934 { |
| 935 InstructionOperand outputs[] = {result_operand, high32_operand}; |
| 936 InstructionOperand inputs[] = {g.UseRegister(m.left().node()), |
| 937 g.UseRegister(m.right().node())}; |
| 938 selector->Emit(kS390_Mul32WithHigh32, 2, outputs, 2, inputs); |
| 939 } |
| 940 { |
| 941 InstructionOperand shift_31 = g.UseImmediate(31); |
| 942 InstructionOperand outputs[] = {temp_operand}; |
| 943 InstructionOperand inputs[] = {result_operand, shift_31}; |
| 944 selector->Emit(kS390_ShiftRightArith32, 1, outputs, 2, inputs); |
| 945 } |
| 946 |
| 947 VisitCompare(selector, kS390_Cmp32, high32_operand, temp_operand, cont); |
| 948 } |
| 949 |
| 950 } // namespace |
| 951 |
| 922 void InstructionSelector::VisitInt32Mul(Node* node) { | 952 void InstructionSelector::VisitInt32Mul(Node* node) { |
| 923 VisitRRR(this, kS390_Mul32, node); | 953 VisitRRR(this, kS390_Mul32, node); |
| 924 } | 954 } |
| 925 | 955 |
| 926 #if V8_TARGET_ARCH_S390X | 956 #if V8_TARGET_ARCH_S390X |
| 927 void InstructionSelector::VisitInt64Mul(Node* node) { | 957 void InstructionSelector::VisitInt64Mul(Node* node) { |
| 928 VisitRRR(this, kS390_Mul64, node); | 958 VisitRRR(this, kS390_Mul64, node); |
| 929 } | 959 } |
| 930 #endif | 960 #endif |
| 931 | 961 |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 switch (node->opcode()) { | 1510 switch (node->opcode()) { |
| 1481 case IrOpcode::kInt32AddWithOverflow: | 1511 case IrOpcode::kInt32AddWithOverflow: |
| 1482 cont->OverwriteAndNegateIfEqual(kOverflow); | 1512 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1483 return VisitBinop<Int32BinopMatcher>( | 1513 return VisitBinop<Int32BinopMatcher>( |
| 1484 selector, node, kS390_AddWithOverflow32, kInt16Imm, cont); | 1514 selector, node, kS390_AddWithOverflow32, kInt16Imm, cont); |
| 1485 case IrOpcode::kInt32SubWithOverflow: | 1515 case IrOpcode::kInt32SubWithOverflow: |
| 1486 cont->OverwriteAndNegateIfEqual(kOverflow); | 1516 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1487 return VisitBinop<Int32BinopMatcher>(selector, node, | 1517 return VisitBinop<Int32BinopMatcher>(selector, node, |
| 1488 kS390_SubWithOverflow32, | 1518 kS390_SubWithOverflow32, |
| 1489 kInt16Imm_Negate, cont); | 1519 kInt16Imm_Negate, cont); |
| 1520 case IrOpcode::kInt32MulWithOverflow: |
| 1521 cont->OverwriteAndNegateIfEqual(kNotEqual); |
| 1522 return EmitInt32MulWithOverflow(selector, node, cont); |
| 1490 #if V8_TARGET_ARCH_S390X | 1523 #if V8_TARGET_ARCH_S390X |
| 1491 case IrOpcode::kInt64AddWithOverflow: | 1524 case IrOpcode::kInt64AddWithOverflow: |
| 1492 cont->OverwriteAndNegateIfEqual(kOverflow); | 1525 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1493 return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Add, | 1526 return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Add, |
| 1494 kInt16Imm, cont); | 1527 kInt16Imm, cont); |
| 1495 case IrOpcode::kInt64SubWithOverflow: | 1528 case IrOpcode::kInt64SubWithOverflow: |
| 1496 cont->OverwriteAndNegateIfEqual(kOverflow); | 1529 cont->OverwriteAndNegateIfEqual(kOverflow); |
| 1497 return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Sub, | 1530 return VisitBinop<Int64BinopMatcher>(selector, node, kS390_Sub, |
| 1498 kInt16Imm_Negate, cont); | 1531 kInt16Imm_Negate, cont); |
| 1499 #endif | 1532 #endif |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 VisitWord64Compare(this, node, &cont); | 1692 VisitWord64Compare(this, node, &cont); |
| 1660 } | 1693 } |
| 1661 | 1694 |
| 1662 void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) { | 1695 void InstructionSelector::VisitUint64LessThanOrEqual(Node* node) { |
| 1663 FlagsContinuation cont = | 1696 FlagsContinuation cont = |
| 1664 FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); | 1697 FlagsContinuation::ForSet(kUnsignedLessThanOrEqual, node); |
| 1665 VisitWord64Compare(this, node, &cont); | 1698 VisitWord64Compare(this, node, &cont); |
| 1666 } | 1699 } |
| 1667 #endif | 1700 #endif |
| 1668 | 1701 |
| 1702 void InstructionSelector::VisitInt32MulWithOverflow(Node* node) { |
| 1703 if (Node* ovf = NodeProperties::FindProjection(node, 1)) { |
| 1704 FlagsContinuation cont = FlagsContinuation::ForSet(kNotEqual, ovf); |
| 1705 return EmitInt32MulWithOverflow(this, node, &cont); |
| 1706 } |
| 1707 FlagsContinuation cont; |
| 1708 EmitInt32MulWithOverflow(this, node, &cont); |
| 1709 } |
| 1710 |
| 1669 void InstructionSelector::VisitFloat32Equal(Node* node) { | 1711 void InstructionSelector::VisitFloat32Equal(Node* node) { |
| 1670 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); | 1712 FlagsContinuation cont = FlagsContinuation::ForSet(kEqual, node); |
| 1671 VisitFloat32Compare(this, node, &cont); | 1713 VisitFloat32Compare(this, node, &cont); |
| 1672 } | 1714 } |
| 1673 | 1715 |
| 1674 void InstructionSelector::VisitFloat32LessThan(Node* node) { | 1716 void InstructionSelector::VisitFloat32LessThan(Node* node) { |
| 1675 FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); | 1717 FlagsContinuation cont = FlagsContinuation::ForSet(kUnsignedLessThan, node); |
| 1676 VisitFloat32Compare(this, node, &cont); | 1718 VisitFloat32Compare(this, node, &cont); |
| 1677 } | 1719 } |
| 1678 | 1720 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 // static | 1897 // static |
| 1856 MachineOperatorBuilder::AlignmentRequirements | 1898 MachineOperatorBuilder::AlignmentRequirements |
| 1857 InstructionSelector::AlignmentRequirements() { | 1899 InstructionSelector::AlignmentRequirements() { |
| 1858 return MachineOperatorBuilder::AlignmentRequirements:: | 1900 return MachineOperatorBuilder::AlignmentRequirements:: |
| 1859 FullUnalignedAccessSupport(); | 1901 FullUnalignedAccessSupport(); |
| 1860 } | 1902 } |
| 1861 | 1903 |
| 1862 } // namespace compiler | 1904 } // namespace compiler |
| 1863 } // namespace internal | 1905 } // namespace internal |
| 1864 } // namespace v8 | 1906 } // namespace v8 |
| OLD | NEW |