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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { | 1198 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { |
1199 Float64BinopMatcher mright(m.right().node()); | 1199 Float64BinopMatcher mright(m.right().node()); |
1200 Emit(kArmVmlaF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), | 1200 Emit(kArmVmlaF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), |
1201 g.UseRegister(mright.left().node()), | 1201 g.UseRegister(mright.left().node()), |
1202 g.UseRegister(mright.right().node())); | 1202 g.UseRegister(mright.right().node())); |
1203 return; | 1203 return; |
1204 } | 1204 } |
1205 VisitRRR(this, kArmVaddF64, node); | 1205 VisitRRR(this, kArmVaddF64, node); |
1206 } | 1206 } |
1207 | 1207 |
| 1208 namespace { |
| 1209 void VisitFloat32SubHelper(InstructionSelector* selector, Node* node) { |
| 1210 ArmOperandGenerator g(selector); |
| 1211 Float32BinopMatcher m(node); |
| 1212 if (m.right().IsFloat32Mul() && selector->CanCover(node, m.right().node())) { |
| 1213 Float32BinopMatcher mright(m.right().node()); |
| 1214 selector->Emit(kArmVmlsF32, g.DefineSameAsFirst(node), |
| 1215 g.UseRegister(m.left().node()), |
| 1216 g.UseRegister(mright.left().node()), |
| 1217 g.UseRegister(mright.right().node())); |
| 1218 return; |
| 1219 } |
| 1220 VisitRRR(selector, kArmVsubF32, node); |
| 1221 } |
| 1222 |
| 1223 void VisitFloat64SubHelper(InstructionSelector* selector, Node* node) { |
| 1224 ArmOperandGenerator g(selector); |
| 1225 Float64BinopMatcher m(node); |
| 1226 if (m.right().IsFloat64Mul() && selector->CanCover(node, m.right().node())) { |
| 1227 Float64BinopMatcher mright(m.right().node()); |
| 1228 selector->Emit(kArmVmlsF64, g.DefineSameAsFirst(node), |
| 1229 g.UseRegister(m.left().node()), |
| 1230 g.UseRegister(mright.left().node()), |
| 1231 g.UseRegister(mright.right().node())); |
| 1232 return; |
| 1233 } |
| 1234 VisitRRR(selector, kArmVsubF64, node); |
| 1235 } |
| 1236 } // namespace |
1208 | 1237 |
1209 void InstructionSelector::VisitFloat32Sub(Node* node) { | 1238 void InstructionSelector::VisitFloat32Sub(Node* node) { |
1210 ArmOperandGenerator g(this); | 1239 ArmOperandGenerator g(this); |
1211 Float32BinopMatcher m(node); | 1240 Float32BinopMatcher m(node); |
1212 if (m.left().IsMinusZero()) { | 1241 if (m.left().IsMinusZero()) { |
1213 Emit(kArmVnegF32, g.DefineAsRegister(node), | 1242 Emit(kArmVnegF32, g.DefineAsRegister(node), |
1214 g.UseRegister(m.right().node())); | 1243 g.UseRegister(m.right().node())); |
1215 return; | 1244 return; |
1216 } | 1245 } |
1217 if (m.right().IsFloat32Mul() && CanCover(node, m.right().node())) { | 1246 VisitFloat32SubHelper(this, node); |
1218 Float32BinopMatcher mright(m.right().node()); | |
1219 Emit(kArmVmlsF32, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), | |
1220 g.UseRegister(mright.left().node()), | |
1221 g.UseRegister(mright.right().node())); | |
1222 return; | |
1223 } | |
1224 VisitRRR(this, kArmVsubF32, node); | |
1225 } | 1247 } |
1226 | 1248 |
| 1249 void InstructionSelector::VisitFloat32SubPreserveNan(Node* node) { |
| 1250 VisitFloat32SubHelper(this, node); |
| 1251 } |
1227 | 1252 |
1228 void InstructionSelector::VisitFloat64Sub(Node* node) { | 1253 void InstructionSelector::VisitFloat64Sub(Node* node) { |
1229 ArmOperandGenerator g(this); | 1254 ArmOperandGenerator g(this); |
1230 Float64BinopMatcher m(node); | 1255 Float64BinopMatcher m(node); |
1231 if (m.left().IsMinusZero()) { | 1256 if (m.left().IsMinusZero()) { |
1232 if (m.right().IsFloat64RoundDown() && | 1257 if (m.right().IsFloat64RoundDown() && |
1233 CanCover(m.node(), m.right().node())) { | 1258 CanCover(m.node(), m.right().node())) { |
1234 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && | 1259 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && |
1235 CanCover(m.right().node(), m.right().InputAt(0))) { | 1260 CanCover(m.right().node(), m.right().InputAt(0))) { |
1236 Float64BinopMatcher mright0(m.right().InputAt(0)); | 1261 Float64BinopMatcher mright0(m.right().InputAt(0)); |
1237 if (mright0.left().IsMinusZero()) { | 1262 if (mright0.left().IsMinusZero()) { |
1238 Emit(kArmVrintpF64, g.DefineAsRegister(node), | 1263 Emit(kArmVrintpF64, g.DefineAsRegister(node), |
1239 g.UseRegister(mright0.right().node())); | 1264 g.UseRegister(mright0.right().node())); |
1240 return; | 1265 return; |
1241 } | 1266 } |
1242 } | 1267 } |
1243 } | 1268 } |
1244 Emit(kArmVnegF64, g.DefineAsRegister(node), | 1269 Emit(kArmVnegF64, g.DefineAsRegister(node), |
1245 g.UseRegister(m.right().node())); | 1270 g.UseRegister(m.right().node())); |
1246 return; | 1271 return; |
1247 } | 1272 } |
1248 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { | 1273 VisitFloat64SubHelper(this, node); |
1249 Float64BinopMatcher mright(m.right().node()); | |
1250 Emit(kArmVmlsF64, g.DefineSameAsFirst(node), g.UseRegister(m.left().node()), | |
1251 g.UseRegister(mright.left().node()), | |
1252 g.UseRegister(mright.right().node())); | |
1253 return; | |
1254 } | |
1255 VisitRRR(this, kArmVsubF64, node); | |
1256 } | 1274 } |
1257 | 1275 |
| 1276 void InstructionSelector::VisitFloat64SubPreserveNan(Node* node) { |
| 1277 VisitFloat64SubHelper(this, node); |
| 1278 } |
1258 | 1279 |
1259 void InstructionSelector::VisitFloat32Mul(Node* node) { | 1280 void InstructionSelector::VisitFloat32Mul(Node* node) { |
1260 VisitRRR(this, kArmVmulF32, node); | 1281 VisitRRR(this, kArmVmulF32, node); |
1261 } | 1282 } |
1262 | 1283 |
1263 | 1284 |
1264 void InstructionSelector::VisitFloat64Mul(Node* node) { | 1285 void InstructionSelector::VisitFloat64Mul(Node* node) { |
1265 VisitRRR(this, kArmVmulF64, node); | 1286 VisitRRR(this, kArmVmulF64, node); |
1266 } | 1287 } |
1267 | 1288 |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 MachineOperatorBuilder::kFloat32Max | | 1911 MachineOperatorBuilder::kFloat32Max | |
1891 MachineOperatorBuilder::kFloat64Min | | 1912 MachineOperatorBuilder::kFloat64Min | |
1892 MachineOperatorBuilder::kFloat64Max; | 1913 MachineOperatorBuilder::kFloat64Max; |
1893 } | 1914 } |
1894 return flags; | 1915 return flags; |
1895 } | 1916 } |
1896 | 1917 |
1897 } // namespace compiler | 1918 } // namespace compiler |
1898 } // namespace internal | 1919 } // namespace internal |
1899 } // namespace v8 | 1920 } // namespace v8 |
OLD | NEW |