| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "src/base/adapters.h" | 7 #include "src/base/adapters.h" |
| 8 #include "src/compiler/instruction-selector-impl.h" | 8 #include "src/compiler/instruction-selector-impl.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
| (...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 } | 1134 } |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 } // namespace | 1137 } // namespace |
| 1138 | 1138 |
| 1139 | 1139 |
| 1140 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { | 1140 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
| 1141 VisitRO(this, node, kSSEFloat64ToFloat32); | 1141 VisitRO(this, node, kSSEFloat64ToFloat32); |
| 1142 } | 1142 } |
| 1143 | 1143 |
| 1144 | 1144 void InstructionSelector::VisitTruncateFloat64ToWord32(Node* node) { |
| 1145 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { | 1145 VisitRR(this, node, kArchTruncateDoubleToI); |
| 1146 switch (TruncationModeOf(node->op())) { | |
| 1147 case TruncationMode::kJavaScript: | |
| 1148 return VisitRR(this, node, kArchTruncateDoubleToI); | |
| 1149 case TruncationMode::kRoundToZero: | |
| 1150 return VisitRO(this, node, kSSEFloat64ToInt32); | |
| 1151 } | |
| 1152 UNREACHABLE(); | |
| 1153 } | 1146 } |
| 1154 | 1147 |
| 1155 | 1148 |
| 1156 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { | 1149 void InstructionSelector::VisitTruncateInt64ToInt32(Node* node) { |
| 1157 X64OperandGenerator g(this); | 1150 X64OperandGenerator g(this); |
| 1158 Node* value = node->InputAt(0); | 1151 Node* value = node->InputAt(0); |
| 1159 if (CanCover(node, value)) { | 1152 if (CanCover(node, value)) { |
| 1160 switch (value->opcode()) { | 1153 switch (value->opcode()) { |
| 1161 case IrOpcode::kWord64Sar: | 1154 case IrOpcode::kWord64Sar: |
| 1162 case IrOpcode::kWord64Shr: { | 1155 case IrOpcode::kWord64Shr: { |
| 1163 Int64BinopMatcher m(value); | 1156 Int64BinopMatcher m(value); |
| 1164 if (m.right().Is(32)) { | 1157 if (m.right().Is(32)) { |
| 1165 Emit(kX64Shr, g.DefineSameAsFirst(node), | 1158 Emit(kX64Shr, g.DefineSameAsFirst(node), |
| 1166 g.UseRegister(m.left().node()), g.TempImmediate(32)); | 1159 g.UseRegister(m.left().node()), g.TempImmediate(32)); |
| 1167 return; | 1160 return; |
| 1168 } | 1161 } |
| 1169 break; | 1162 break; |
| 1170 } | 1163 } |
| 1171 default: | 1164 default: |
| 1172 break; | 1165 break; |
| 1173 } | 1166 } |
| 1174 } | 1167 } |
| 1175 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); | 1168 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); |
| 1176 } | 1169 } |
| 1177 | 1170 |
| 1171 void InstructionSelector::VisitRoundFloat64ToInt32(Node* node) { |
| 1172 VisitRO(this, node, kSSEFloat64ToInt32); |
| 1173 } |
| 1178 | 1174 |
| 1179 void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) { | 1175 void InstructionSelector::VisitRoundInt32ToFloat32(Node* node) { |
| 1180 X64OperandGenerator g(this); | 1176 X64OperandGenerator g(this); |
| 1181 Emit(kSSEInt32ToFloat32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 1177 Emit(kSSEInt32ToFloat32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
| 1182 } | 1178 } |
| 1183 | 1179 |
| 1184 | 1180 |
| 1185 void InstructionSelector::VisitRoundInt64ToFloat32(Node* node) { | 1181 void InstructionSelector::VisitRoundInt64ToFloat32(Node* node) { |
| 1186 X64OperandGenerator g(this); | 1182 X64OperandGenerator g(this); |
| 1187 Emit(kSSEInt64ToFloat32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 1183 Emit(kSSEInt64ToFloat32, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 MachineOperatorBuilder::kFloat64RoundTruncate | | 2052 MachineOperatorBuilder::kFloat64RoundTruncate | |
| 2057 MachineOperatorBuilder::kFloat32RoundTiesEven | | 2053 MachineOperatorBuilder::kFloat32RoundTiesEven | |
| 2058 MachineOperatorBuilder::kFloat64RoundTiesEven; | 2054 MachineOperatorBuilder::kFloat64RoundTiesEven; |
| 2059 } | 2055 } |
| 2060 return flags; | 2056 return flags; |
| 2061 } | 2057 } |
| 2062 | 2058 |
| 2063 } // namespace compiler | 2059 } // namespace compiler |
| 2064 } // namespace internal | 2060 } // namespace internal |
| 2065 } // namespace v8 | 2061 } // namespace v8 |
| OLD | NEW |