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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 if (mleft.right().Is(16) && m.right().Is(16)) { | 743 if (mleft.right().Is(16) && m.right().Is(16)) { |
744 Emit(kS390_ExtendSignWord16, g.DefineAsRegister(node), | 744 Emit(kS390_ExtendSignWord16, g.DefineAsRegister(node), |
745 g.UseRegister(mleft.left().node())); | 745 g.UseRegister(mleft.left().node())); |
746 return; | 746 return; |
747 } else if (mleft.right().Is(24) && m.right().Is(24)) { | 747 } else if (mleft.right().Is(24) && m.right().Is(24)) { |
748 Emit(kS390_ExtendSignWord8, g.DefineAsRegister(node), | 748 Emit(kS390_ExtendSignWord8, g.DefineAsRegister(node), |
749 g.UseRegister(mleft.left().node())); | 749 g.UseRegister(mleft.left().node())); |
750 return; | 750 return; |
751 } | 751 } |
752 } | 752 } |
753 VisitRRO(this, kS390_ShiftRightAlg32, node, kShift32Imm); | 753 VisitRRO(this, kS390_ShiftRightArith32, node, kShift32Imm); |
754 } | 754 } |
755 | 755 |
| 756 #if !V8_TARGET_ARCH_S390X |
| 757 void VisitPairShift(InstructionSelector* selector, ArchOpcode opcode, |
| 758 Node* node) { |
| 759 S390OperandGenerator g(selector); |
| 760 Int32Matcher m(node->InputAt(2)); |
| 761 InstructionOperand shift_operand; |
| 762 if (m.HasValue()) { |
| 763 shift_operand = g.UseImmediate(m.node()); |
| 764 } else { |
| 765 shift_operand = g.UseUniqueRegister(m.node()); |
| 766 } |
| 767 |
| 768 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)), |
| 769 g.UseRegister(node->InputAt(1)), |
| 770 shift_operand}; |
| 771 |
| 772 InstructionOperand outputs[] = { |
| 773 g.DefineSameAsFirst(node), |
| 774 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
| 775 |
| 776 selector->Emit(opcode, 2, outputs, 3, inputs); |
| 777 } |
| 778 |
| 779 void InstructionSelector::VisitWord32PairShl(Node* node) { |
| 780 VisitPairShift(this, kS390_ShiftLeftPair, node); |
| 781 } |
| 782 |
| 783 void InstructionSelector::VisitWord32PairShr(Node* node) { |
| 784 VisitPairShift(this, kS390_ShiftRightPair, node); |
| 785 } |
| 786 |
| 787 void InstructionSelector::VisitWord32PairSar(Node* node) { |
| 788 VisitPairShift(this, kS390_ShiftRightArithPair, node); |
| 789 } |
| 790 #endif |
| 791 |
756 #if V8_TARGET_ARCH_S390X | 792 #if V8_TARGET_ARCH_S390X |
757 void InstructionSelector::VisitWord64Sar(Node* node) { | 793 void InstructionSelector::VisitWord64Sar(Node* node) { |
758 VisitRRO(this, kS390_ShiftRightAlg64, node, kShift64Imm); | 794 VisitRRO(this, kS390_ShiftRightArith64, node, kShift64Imm); |
759 } | 795 } |
760 #endif | 796 #endif |
761 | 797 |
762 void InstructionSelector::VisitWord32Ror(Node* node) { | 798 void InstructionSelector::VisitWord32Ror(Node* node) { |
763 VisitRRO(this, kS390_RotRight32, node, kShift32Imm); | 799 VisitRRO(this, kS390_RotRight32, node, kShift32Imm); |
764 } | 800 } |
765 | 801 |
766 #if V8_TARGET_ARCH_S390X | 802 #if V8_TARGET_ARCH_S390X |
767 void InstructionSelector::VisitWord64Ror(Node* node) { | 803 void InstructionSelector::VisitWord64Ror(Node* node) { |
768 VisitRRO(this, kS390_RotRight64, node, kShift64Imm); | 804 VisitRRO(this, kS390_RotRight64, node, kShift64Imm); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 void InstructionSelector::VisitInt32Add(Node* node) { | 848 void InstructionSelector::VisitInt32Add(Node* node) { |
813 VisitBinop<Int32BinopMatcher>(this, node, kS390_Add, kInt16Imm); | 849 VisitBinop<Int32BinopMatcher>(this, node, kS390_Add, kInt16Imm); |
814 } | 850 } |
815 | 851 |
816 #if V8_TARGET_ARCH_S390X | 852 #if V8_TARGET_ARCH_S390X |
817 void InstructionSelector::VisitInt64Add(Node* node) { | 853 void InstructionSelector::VisitInt64Add(Node* node) { |
818 VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm); | 854 VisitBinop<Int64BinopMatcher>(this, node, kS390_Add, kInt16Imm); |
819 } | 855 } |
820 #endif | 856 #endif |
821 | 857 |
| 858 #if !V8_TARGET_ARCH_S390X |
| 859 void InstructionSelector::VisitInt32PairAdd(Node* node) { UNIMPLEMENTED(); } |
| 860 #endif |
| 861 |
822 void InstructionSelector::VisitInt32Sub(Node* node) { | 862 void InstructionSelector::VisitInt32Sub(Node* node) { |
823 S390OperandGenerator g(this); | 863 S390OperandGenerator g(this); |
824 Int32BinopMatcher m(node); | 864 Int32BinopMatcher m(node); |
825 if (m.left().Is(0)) { | 865 if (m.left().Is(0)) { |
826 Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node())); | 866 Emit(kS390_Neg, g.DefineAsRegister(node), g.UseRegister(m.right().node())); |
827 } else { | 867 } else { |
828 VisitBinop<Int32BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate); | 868 VisitBinop<Int32BinopMatcher>(this, node, kS390_Sub, kInt16Imm_Negate); |
829 } | 869 } |
830 } | 870 } |
831 | 871 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 g.UseRegister(input.node()), g.TempImmediate(slot)); | 1660 g.UseRegister(input.node()), g.TempImmediate(slot)); |
1621 } | 1661 } |
1622 } | 1662 } |
1623 ++slot; | 1663 ++slot; |
1624 } | 1664 } |
1625 } | 1665 } |
1626 } | 1666 } |
1627 | 1667 |
1628 bool InstructionSelector::IsTailCallAddressImmediate() { return false; } | 1668 bool InstructionSelector::IsTailCallAddressImmediate() { return false; } |
1629 | 1669 |
| 1670 int InstructionSelector::GetTempsCountForTailCallFromJSFunction() { return 3; } |
| 1671 |
1630 void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { | 1672 void InstructionSelector::VisitFloat64ExtractLowWord32(Node* node) { |
1631 S390OperandGenerator g(this); | 1673 S390OperandGenerator g(this); |
1632 Emit(kS390_DoubleExtractLowWord32, g.DefineAsRegister(node), | 1674 Emit(kS390_DoubleExtractLowWord32, g.DefineAsRegister(node), |
1633 g.UseRegister(node->InputAt(0))); | 1675 g.UseRegister(node->InputAt(0))); |
1634 } | 1676 } |
1635 | 1677 |
1636 void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) { | 1678 void InstructionSelector::VisitFloat64ExtractHighWord32(Node* node) { |
1637 S390OperandGenerator g(this); | 1679 S390OperandGenerator g(this); |
1638 Emit(kS390_DoubleExtractHighWord32, g.DefineAsRegister(node), | 1680 Emit(kS390_DoubleExtractHighWord32, g.DefineAsRegister(node), |
1639 g.UseRegister(node->InputAt(0))); | 1681 g.UseRegister(node->InputAt(0))); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 MachineOperatorBuilder::kFloat32RoundTruncate | | 1721 MachineOperatorBuilder::kFloat32RoundTruncate | |
1680 MachineOperatorBuilder::kFloat64RoundTruncate | | 1722 MachineOperatorBuilder::kFloat64RoundTruncate | |
1681 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1723 MachineOperatorBuilder::kFloat64RoundTiesAway | |
1682 MachineOperatorBuilder::kWord32Popcnt | | 1724 MachineOperatorBuilder::kWord32Popcnt | |
1683 MachineOperatorBuilder::kWord64Popcnt; | 1725 MachineOperatorBuilder::kWord64Popcnt; |
1684 } | 1726 } |
1685 | 1727 |
1686 } // namespace compiler | 1728 } // namespace compiler |
1687 } // namespace internal | 1729 } // namespace internal |
1688 } // namespace v8 | 1730 } // namespace v8 |
OLD | NEW |