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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1230 return; | 1230 return; |
1231 } | 1231 } |
1232 default: | 1232 default: |
1233 break; | 1233 break; |
1234 } | 1234 } |
1235 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(value)); | 1235 Emit(kArm64Mov32, g.DefineAsRegister(node), g.UseRegister(value)); |
1236 } | 1236 } |
1237 | 1237 |
1238 | 1238 |
1239 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { | 1239 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
1240 Arm64OperandGenerator g(this); | 1240 VisitRR(this, kArm64Float64ToFloat32, node); |
1241 Emit(kArm64Float64ToFloat32, g.DefineAsRegister(node), | |
1242 g.UseRegister(node->InputAt(0))); | |
1243 } | 1241 } |
1244 | 1242 |
1245 | 1243 |
| 1244 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { |
| 1245 switch (TruncationModeOf(node->op())) { |
| 1246 case TruncationMode::kJavaScript: |
| 1247 return VisitRR(this, kArchTruncateDoubleToI, node); |
| 1248 case TruncationMode::kRoundToZero: |
| 1249 return VisitRR(this, kArm64Float64ToInt32, node); |
| 1250 } |
| 1251 UNREACHABLE(); |
| 1252 } |
| 1253 |
| 1254 |
1246 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { | 1255 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
1247 Arm64OperandGenerator g(this); | 1256 Arm64OperandGenerator g(this); |
1248 Node* value = node->InputAt(0); | 1257 Node* value = node->InputAt(0); |
1249 if (CanCover(node, value) && value->InputCount() >= 2) { | 1258 if (CanCover(node, value) && value->InputCount() >= 2) { |
1250 Int64BinopMatcher m(value); | 1259 Int64BinopMatcher m(value); |
1251 if ((m.IsWord64Sar() && m.right().HasValue() && | 1260 if ((m.IsWord64Sar() && m.right().HasValue() && |
1252 (m.right().Value() == 32)) || | 1261 (m.right().Value() == 32)) || |
1253 (m.IsWord64Shr() && m.right().IsInRange(32, 63))) { | 1262 (m.IsWord64Shr() && m.right().IsInRange(32, 63))) { |
1254 Emit(kArm64Lsr, g.DefineAsRegister(node), g.UseRegister(m.left().node()), | 1263 Emit(kArm64Lsr, g.DefineAsRegister(node), g.UseRegister(m.left().node()), |
1255 g.UseImmediate(m.right().node())); | 1264 g.UseImmediate(m.right().node())); |
(...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 MachineOperatorBuilder::kFloat64RoundTruncate | | 2069 MachineOperatorBuilder::kFloat64RoundTruncate | |
2061 MachineOperatorBuilder::kFloat64RoundTiesAway | | 2070 MachineOperatorBuilder::kFloat64RoundTiesAway | |
2062 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2071 MachineOperatorBuilder::kWord32ShiftIsSafe | |
2063 MachineOperatorBuilder::kInt32DivIsSafe | | 2072 MachineOperatorBuilder::kInt32DivIsSafe | |
2064 MachineOperatorBuilder::kUint32DivIsSafe; | 2073 MachineOperatorBuilder::kUint32DivIsSafe; |
2065 } | 2074 } |
2066 | 2075 |
2067 } // namespace compiler | 2076 } // namespace compiler |
2068 } // namespace internal | 2077 } // namespace internal |
2069 } // namespace v8 | 2078 } // namespace v8 |
OLD | NEW |