| 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/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/ppc/frames-ppc.h" | 9 #include "src/ppc/frames-ppc.h" |
| 10 | 10 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 void VisitRRO(InstructionSelector* selector, ArchOpcode opcode, Node* node, | 89 void VisitRRO(InstructionSelector* selector, ArchOpcode opcode, Node* node, |
| 90 ImmediateMode operand_mode) { | 90 ImmediateMode operand_mode) { |
| 91 PPCOperandGenerator g(selector); | 91 PPCOperandGenerator g(selector); |
| 92 selector->Emit(opcode, g.DefineAsRegister(node), | 92 selector->Emit(opcode, g.DefineAsRegister(node), |
| 93 g.UseRegister(node->InputAt(0)), | 93 g.UseRegister(node->InputAt(0)), |
| 94 g.UseOperand(node->InputAt(1), operand_mode)); | 94 g.UseOperand(node->InputAt(1), operand_mode)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 | 97 |
| 98 #if V8_TARGET_ARCH_PPC64 |
| 99 void VisitTryTruncateDouble(InstructionSelector* selector, ArchOpcode opcode, |
| 100 Node* node) { |
| 101 PPCOperandGenerator g(selector); |
| 102 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; |
| 103 InstructionOperand outputs[2]; |
| 104 size_t output_count = 0; |
| 105 outputs[output_count++] = g.DefineAsRegister(node); |
| 106 |
| 107 Node* success_output = NodeProperties::FindProjection(node, 1); |
| 108 if (success_output) { |
| 109 outputs[output_count++] = g.DefineAsRegister(success_output); |
| 110 } |
| 111 |
| 112 selector->Emit(opcode, output_count, outputs, 1, inputs); |
| 113 } |
| 114 #endif |
| 115 |
| 116 |
| 98 // Shared routine for multiple binary operations. | 117 // Shared routine for multiple binary operations. |
| 99 template <typename Matcher> | 118 template <typename Matcher> |
| 100 void VisitBinop(InstructionSelector* selector, Node* node, | 119 void VisitBinop(InstructionSelector* selector, Node* node, |
| 101 InstructionCode opcode, ImmediateMode operand_mode, | 120 InstructionCode opcode, ImmediateMode operand_mode, |
| 102 FlagsContinuation* cont) { | 121 FlagsContinuation* cont) { |
| 103 PPCOperandGenerator g(selector); | 122 PPCOperandGenerator g(selector); |
| 104 Matcher m(node); | 123 Matcher m(node); |
| 105 InstructionOperand inputs[4]; | 124 InstructionOperand inputs[4]; |
| 106 size_t input_count = 0; | 125 size_t input_count = 0; |
| 107 InstructionOperand outputs[2]; | 126 InstructionOperand outputs[2]; |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 } | 940 } |
| 922 | 941 |
| 923 | 942 |
| 924 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { | 943 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { |
| 925 VisitRR(this, kPPC_DoubleToUint32, node); | 944 VisitRR(this, kPPC_DoubleToUint32, node); |
| 926 } | 945 } |
| 927 | 946 |
| 928 | 947 |
| 929 #if V8_TARGET_ARCH_PPC64 | 948 #if V8_TARGET_ARCH_PPC64 |
| 930 void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) { | 949 void InstructionSelector::VisitTryTruncateFloat32ToInt64(Node* node) { |
| 931 PPCOperandGenerator g(this); | 950 VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node); |
| 932 | |
| 933 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; | |
| 934 InstructionOperand outputs[2]; | |
| 935 size_t output_count = 0; | |
| 936 outputs[output_count++] = g.DefineAsRegister(node); | |
| 937 | |
| 938 Node* success_output = NodeProperties::FindProjection(node, 1); | |
| 939 if (success_output) { | |
| 940 outputs[output_count++] = g.DefineAsRegister(success_output); | |
| 941 } | |
| 942 | |
| 943 Emit(kPPC_DoubleToInt64, output_count, outputs, 1, inputs); | |
| 944 } | 951 } |
| 945 | 952 |
| 946 | 953 |
| 947 void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { | 954 void InstructionSelector::VisitTryTruncateFloat64ToInt64(Node* node) { |
| 948 PPCOperandGenerator g(this); | 955 VisitTryTruncateDouble(this, kPPC_DoubleToInt64, node); |
| 949 | |
| 950 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; | |
| 951 InstructionOperand outputs[2]; | |
| 952 size_t output_count = 0; | |
| 953 outputs[output_count++] = g.DefineAsRegister(node); | |
| 954 | |
| 955 Node* success_output = NodeProperties::FindProjection(node, 1); | |
| 956 if (success_output) { | |
| 957 outputs[output_count++] = g.DefineAsRegister(success_output); | |
| 958 } | |
| 959 | |
| 960 Emit(kPPC_DoubleToInt64, output_count, outputs, 1, inputs); | |
| 961 } | 956 } |
| 962 | 957 |
| 963 | 958 |
| 964 void InstructionSelector::VisitTryTruncateFloat32ToUint64(Node* node) { | 959 void InstructionSelector::VisitTryTruncateFloat32ToUint64(Node* node) { |
| 965 if (NodeProperties::FindProjection(node, 1)) { | 960 VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node); |
| 966 // TODO(ppc): implement the second return value. | |
| 967 UNIMPLEMENTED(); | |
| 968 } | |
| 969 VisitRR(this, kPPC_DoubleToUint64, node); | |
| 970 } | 961 } |
| 971 | 962 |
| 972 | 963 |
| 973 void InstructionSelector::VisitTryTruncateFloat64ToUint64(Node* node) { | 964 void InstructionSelector::VisitTryTruncateFloat64ToUint64(Node* node) { |
| 974 PPCOperandGenerator g(this); | 965 VisitTryTruncateDouble(this, kPPC_DoubleToUint64, node); |
| 975 | |
| 976 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0))}; | |
| 977 InstructionOperand outputs[2]; | |
| 978 size_t output_count = 0; | |
| 979 outputs[output_count++] = g.DefineAsRegister(node); | |
| 980 | |
| 981 Node* success_output = NodeProperties::FindProjection(node, 1); | |
| 982 if (success_output) { | |
| 983 outputs[output_count++] = g.DefineAsRegister(success_output); | |
| 984 } | |
| 985 | |
| 986 Emit(kPPC_DoubleToUint64, output_count, outputs, 1, inputs); | |
| 987 } | 966 } |
| 988 | 967 |
| 989 | 968 |
| 990 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { | 969 void InstructionSelector::VisitChangeInt32ToInt64(Node* node) { |
| 991 // TODO(mbrandy): inspect input to see if nop is appropriate. | 970 // TODO(mbrandy): inspect input to see if nop is appropriate. |
| 992 VisitRR(this, kPPC_ExtendSignWord32, node); | 971 VisitRR(this, kPPC_ExtendSignWord32, node); |
| 993 } | 972 } |
| 994 | 973 |
| 995 | 974 |
| 996 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { | 975 void InstructionSelector::VisitChangeUint32ToUint64(Node* node) { |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1735 MachineOperatorBuilder::kFloat64RoundTruncate | | 1714 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 1736 MachineOperatorBuilder::kFloat64RoundTiesAway | | 1715 MachineOperatorBuilder::kFloat64RoundTiesAway | |
| 1737 MachineOperatorBuilder::kWord32Popcnt | | 1716 MachineOperatorBuilder::kWord32Popcnt | |
| 1738 MachineOperatorBuilder::kWord64Popcnt; | 1717 MachineOperatorBuilder::kWord64Popcnt; |
| 1739 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. | 1718 // We omit kWord32ShiftIsSafe as s[rl]w use 0x3f as a mask rather than 0x1f. |
| 1740 } | 1719 } |
| 1741 | 1720 |
| 1742 } // namespace compiler | 1721 } // namespace compiler |
| 1743 } // namespace internal | 1722 } // namespace internal |
| 1744 } // namespace v8 | 1723 } // namespace v8 |
| OLD | NEW |