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/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 return; | 950 return; |
951 } | 951 } |
952 } | 952 } |
953 } | 953 } |
954 VisitShift(this, node, TryMatchASR); | 954 VisitShift(this, node, TryMatchASR); |
955 } | 955 } |
956 | 956 |
957 void InstructionSelector::VisitInt32PairAdd(Node* node) { | 957 void InstructionSelector::VisitInt32PairAdd(Node* node) { |
958 ArmOperandGenerator g(this); | 958 ArmOperandGenerator g(this); |
959 | 959 |
960 // We use UseUniqueRegister here to avoid register sharing with the output | 960 Node* projection1 = NodeProperties::FindProjection(node, 1); |
961 // registers. | 961 if (projection1) { |
962 InstructionOperand inputs[] = { | 962 // We use UseUniqueRegister here to avoid register sharing with the output |
963 g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), | 963 // registers. |
964 g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; | 964 InstructionOperand inputs[] = { |
| 965 g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| 966 g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
965 | 967 |
966 InstructionOperand outputs[] = { | 968 InstructionOperand outputs[] = { |
967 g.DefineAsRegister(node), | 969 g.DefineAsRegister(node), |
968 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 970 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
969 | 971 |
970 Emit(kArmAddPair, 2, outputs, 4, inputs); | 972 Emit(kArmAddPair, 2, outputs, 4, inputs); |
| 973 } else { |
| 974 // The high word of the result is not used, so we emit the standard 32 bit |
| 975 // instruction. |
| 976 Emit(kArmAdd | AddressingModeField::encode(kMode_Operand2_R), |
| 977 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| 978 g.UseRegister(node->InputAt(2))); |
| 979 } |
971 } | 980 } |
972 | 981 |
973 void InstructionSelector::VisitInt32PairSub(Node* node) { | 982 void InstructionSelector::VisitInt32PairSub(Node* node) { |
974 ArmOperandGenerator g(this); | 983 ArmOperandGenerator g(this); |
975 | 984 |
976 // We use UseUniqueRegister here to avoid register sharing with the output | 985 Node* projection1 = NodeProperties::FindProjection(node, 1); |
977 // register. | 986 if (projection1) { |
978 InstructionOperand inputs[] = { | 987 // We use UseUniqueRegister here to avoid register sharing with the output |
979 g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), | 988 // register. |
980 g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; | 989 InstructionOperand inputs[] = { |
| 990 g.UseRegister(node->InputAt(0)), g.UseUniqueRegister(node->InputAt(1)), |
| 991 g.UseRegister(node->InputAt(2)), g.UseUniqueRegister(node->InputAt(3))}; |
981 | 992 |
982 InstructionOperand outputs[] = { | 993 InstructionOperand outputs[] = { |
983 g.DefineAsRegister(node), | 994 g.DefineAsRegister(node), |
984 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 995 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
985 | 996 |
986 Emit(kArmSubPair, 2, outputs, 4, inputs); | 997 Emit(kArmSubPair, 2, outputs, 4, inputs); |
| 998 } else { |
| 999 // The high word of the result is not used, so we emit the standard 32 bit |
| 1000 // instruction. |
| 1001 Emit(kArmSub | AddressingModeField::encode(kMode_Operand2_R), |
| 1002 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| 1003 g.UseRegister(node->InputAt(2))); |
| 1004 } |
987 } | 1005 } |
988 | 1006 |
989 void InstructionSelector::VisitInt32PairMul(Node* node) { | 1007 void InstructionSelector::VisitInt32PairMul(Node* node) { |
990 ArmOperandGenerator g(this); | 1008 ArmOperandGenerator g(this); |
991 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)), | 1009 Node* projection1 = NodeProperties::FindProjection(node, 1); |
992 g.UseUniqueRegister(node->InputAt(1)), | 1010 if (projection1) { |
993 g.UseUniqueRegister(node->InputAt(2)), | 1011 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)), |
994 g.UseUniqueRegister(node->InputAt(3))}; | 1012 g.UseUniqueRegister(node->InputAt(1)), |
| 1013 g.UseUniqueRegister(node->InputAt(2)), |
| 1014 g.UseUniqueRegister(node->InputAt(3))}; |
995 | 1015 |
996 InstructionOperand outputs[] = { | 1016 InstructionOperand outputs[] = { |
997 g.DefineAsRegister(node), | 1017 g.DefineAsRegister(node), |
998 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 1018 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; |
999 | 1019 |
1000 Emit(kArmMulPair, 2, outputs, 4, inputs); | 1020 Emit(kArmMulPair, 2, outputs, 4, inputs); |
| 1021 } else { |
| 1022 // The high word of the result is not used, so we emit the standard 32 bit |
| 1023 // instruction. |
| 1024 Emit(kArmMul | AddressingModeField::encode(kMode_Operand2_R), |
| 1025 g.DefineSameAsFirst(node), g.UseRegister(node->InputAt(0)), |
| 1026 g.UseRegister(node->InputAt(2))); |
| 1027 } |
1001 } | 1028 } |
1002 | 1029 |
1003 void InstructionSelector::VisitWord32PairShl(Node* node) { | 1030 void InstructionSelector::VisitWord32PairShl(Node* node) { |
1004 ArmOperandGenerator g(this); | 1031 ArmOperandGenerator g(this); |
1005 // We use g.UseUniqueRegister here for InputAt(0) to guarantee that there is | 1032 // We use g.UseUniqueRegister here for InputAt(0) to guarantee that there is |
1006 // no register aliasing with output registers. | 1033 // no register aliasing with output registers. |
1007 Int32Matcher m(node->InputAt(2)); | 1034 Int32Matcher m(node->InputAt(2)); |
1008 InstructionOperand shift_operand; | 1035 InstructionOperand shift_operand; |
1009 if (m.HasValue()) { | 1036 if (m.HasValue()) { |
1010 shift_operand = g.UseImmediate(m.node()); | 1037 shift_operand = g.UseImmediate(m.node()); |
1011 } else { | 1038 } else { |
1012 shift_operand = g.UseUniqueRegister(m.node()); | 1039 shift_operand = g.UseUniqueRegister(m.node()); |
1013 } | 1040 } |
1014 | 1041 |
1015 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)), | 1042 InstructionOperand inputs[] = {g.UseUniqueRegister(node->InputAt(0)), |
1016 g.UseRegister(node->InputAt(1)), | 1043 g.UseRegister(node->InputAt(1)), |
1017 shift_operand}; | 1044 shift_operand}; |
1018 | 1045 |
| 1046 Node* projection1 = NodeProperties::FindProjection(node, 1); |
| 1047 |
1019 InstructionOperand outputs[] = { | 1048 InstructionOperand outputs[] = { |
1020 g.DefineAsRegister(node), | 1049 g.DefineAsRegister(node), |
1021 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 1050 projection1 ? g.DefineAsRegister(projection1) : g.TempRegister()}; |
1022 | 1051 |
1023 Emit(kArmLslPair, 2, outputs, 3, inputs); | 1052 Emit(kArmLslPair, 2, outputs, 3, inputs); |
1024 } | 1053 } |
1025 | 1054 |
1026 void InstructionSelector::VisitWord32PairShr(Node* node) { | 1055 void InstructionSelector::VisitWord32PairShr(Node* node) { |
1027 ArmOperandGenerator g(this); | 1056 ArmOperandGenerator g(this); |
1028 // We use g.UseUniqueRegister here for InputAt(1) and InputAt(2) to to | 1057 // We use g.UseUniqueRegister here for InputAt(1) and InputAt(2) to to |
1029 // guarantee that there is no register aliasing with output register. | 1058 // guarantee that there is no register aliasing with output register. |
1030 Int32Matcher m(node->InputAt(2)); | 1059 Int32Matcher m(node->InputAt(2)); |
1031 InstructionOperand shift_operand; | 1060 InstructionOperand shift_operand; |
1032 if (m.HasValue()) { | 1061 if (m.HasValue()) { |
1033 shift_operand = g.UseImmediate(m.node()); | 1062 shift_operand = g.UseImmediate(m.node()); |
1034 } else { | 1063 } else { |
1035 shift_operand = g.UseUniqueRegister(m.node()); | 1064 shift_operand = g.UseUniqueRegister(m.node()); |
1036 } | 1065 } |
1037 | 1066 |
1038 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)), | 1067 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)), |
1039 g.UseUniqueRegister(node->InputAt(1)), | 1068 g.UseUniqueRegister(node->InputAt(1)), |
1040 shift_operand}; | 1069 shift_operand}; |
1041 | 1070 |
| 1071 Node* projection1 = NodeProperties::FindProjection(node, 1); |
| 1072 |
1042 InstructionOperand outputs[] = { | 1073 InstructionOperand outputs[] = { |
1043 g.DefineAsRegister(node), | 1074 g.DefineAsRegister(node), |
1044 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 1075 projection1 ? g.DefineAsRegister(projection1) : g.TempRegister()}; |
1045 | 1076 |
1046 Emit(kArmLsrPair, 2, outputs, 3, inputs); | 1077 Emit(kArmLsrPair, 2, outputs, 3, inputs); |
1047 } | 1078 } |
1048 | 1079 |
1049 void InstructionSelector::VisitWord32PairSar(Node* node) { | 1080 void InstructionSelector::VisitWord32PairSar(Node* node) { |
1050 ArmOperandGenerator g(this); | 1081 ArmOperandGenerator g(this); |
1051 // We use g.UseUniqueRegister here for InputAt(1) and InputAt(2) to to | 1082 // We use g.UseUniqueRegister here for InputAt(1) and InputAt(2) to to |
1052 // guarantee that there is no register aliasing with output register. | 1083 // guarantee that there is no register aliasing with output register. |
1053 Int32Matcher m(node->InputAt(2)); | 1084 Int32Matcher m(node->InputAt(2)); |
1054 InstructionOperand shift_operand; | 1085 InstructionOperand shift_operand; |
1055 if (m.HasValue()) { | 1086 if (m.HasValue()) { |
1056 shift_operand = g.UseImmediate(m.node()); | 1087 shift_operand = g.UseImmediate(m.node()); |
1057 } else { | 1088 } else { |
1058 shift_operand = g.UseUniqueRegister(m.node()); | 1089 shift_operand = g.UseUniqueRegister(m.node()); |
1059 } | 1090 } |
1060 | 1091 |
1061 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)), | 1092 InstructionOperand inputs[] = {g.UseRegister(node->InputAt(0)), |
1062 g.UseUniqueRegister(node->InputAt(1)), | 1093 g.UseUniqueRegister(node->InputAt(1)), |
1063 shift_operand}; | 1094 shift_operand}; |
1064 | 1095 |
| 1096 Node* projection1 = NodeProperties::FindProjection(node, 1); |
| 1097 |
1065 InstructionOperand outputs[] = { | 1098 InstructionOperand outputs[] = { |
1066 g.DefineAsRegister(node), | 1099 g.DefineAsRegister(node), |
1067 g.DefineAsRegister(NodeProperties::FindProjection(node, 1))}; | 1100 projection1 ? g.DefineAsRegister(projection1) : g.TempRegister()}; |
1068 | 1101 |
1069 Emit(kArmAsrPair, 2, outputs, 3, inputs); | 1102 Emit(kArmAsrPair, 2, outputs, 3, inputs); |
1070 } | 1103 } |
1071 | 1104 |
1072 void InstructionSelector::VisitWord32Ror(Node* node) { | 1105 void InstructionSelector::VisitWord32Ror(Node* node) { |
1073 VisitShift(this, node, TryMatchROR); | 1106 VisitShift(this, node, TryMatchROR); |
1074 } | 1107 } |
1075 | 1108 |
1076 | 1109 |
1077 void InstructionSelector::VisitWord32Clz(Node* node) { | 1110 void InstructionSelector::VisitWord32Clz(Node* node) { |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2276 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); | 2309 Vector<MachineType> req_aligned = Vector<MachineType>::New(2); |
2277 req_aligned[0] = MachineType::Float32(); | 2310 req_aligned[0] = MachineType::Float32(); |
2278 req_aligned[1] = MachineType::Float64(); | 2311 req_aligned[1] = MachineType::Float64(); |
2279 return MachineOperatorBuilder::AlignmentRequirements:: | 2312 return MachineOperatorBuilder::AlignmentRequirements:: |
2280 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); | 2313 SomeUnalignedAccessUnsupported(req_aligned, req_aligned); |
2281 } | 2314 } |
2282 | 2315 |
2283 } // namespace compiler | 2316 } // namespace compiler |
2284 } // namespace internal | 2317 } // namespace internal |
2285 } // namespace v8 | 2318 } // namespace v8 |
OLD | NEW |