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 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 Emit(kX64BitcastLD, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 1300 Emit(kX64BitcastLD, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
1301 } | 1301 } |
1302 | 1302 |
1303 | 1303 |
1304 void InstructionSelector::VisitFloat32Add(Node* node) { | 1304 void InstructionSelector::VisitFloat32Add(Node* node) { |
1305 VisitFloatBinop(this, node, kAVXFloat32Add, kSSEFloat32Add); | 1305 VisitFloatBinop(this, node, kAVXFloat32Add, kSSEFloat32Add); |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 void InstructionSelector::VisitFloat32Sub(Node* node) { | 1309 void InstructionSelector::VisitFloat32Sub(Node* node) { |
1310 X64OperandGenerator g(this); | |
1311 Float32BinopMatcher m(node); | |
1312 if (m.left().IsMinusZero()) { | |
1313 VisitFloatUnop(this, node, m.right().node(), kAVXFloat32Neg, | |
1314 kSSEFloat32Neg); | |
1315 return; | |
1316 } | |
1317 VisitFloatBinop(this, node, kAVXFloat32Sub, kSSEFloat32Sub); | 1310 VisitFloatBinop(this, node, kAVXFloat32Sub, kSSEFloat32Sub); |
1318 } | 1311 } |
1319 | 1312 |
1320 void InstructionSelector::VisitFloat32SubPreserveNan(Node* node) { | |
1321 VisitFloatBinop(this, node, kAVXFloat32Sub, kSSEFloat32Sub); | |
1322 } | |
1323 | |
1324 void InstructionSelector::VisitFloat32Mul(Node* node) { | 1313 void InstructionSelector::VisitFloat32Mul(Node* node) { |
1325 VisitFloatBinop(this, node, kAVXFloat32Mul, kSSEFloat32Mul); | 1314 VisitFloatBinop(this, node, kAVXFloat32Mul, kSSEFloat32Mul); |
1326 } | 1315 } |
1327 | 1316 |
1328 | 1317 |
1329 void InstructionSelector::VisitFloat32Div(Node* node) { | 1318 void InstructionSelector::VisitFloat32Div(Node* node) { |
1330 VisitFloatBinop(this, node, kAVXFloat32Div, kSSEFloat32Div); | 1319 VisitFloatBinop(this, node, kAVXFloat32Div, kSSEFloat32Div); |
1331 } | 1320 } |
1332 | 1321 |
1333 | 1322 |
1334 void InstructionSelector::VisitFloat32Abs(Node* node) { | 1323 void InstructionSelector::VisitFloat32Abs(Node* node) { |
1335 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat32Abs, kSSEFloat32Abs); | 1324 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat32Abs, kSSEFloat32Abs); |
1336 } | 1325 } |
1337 | 1326 |
1338 | 1327 |
1339 void InstructionSelector::VisitFloat32Sqrt(Node* node) { | 1328 void InstructionSelector::VisitFloat32Sqrt(Node* node) { |
1340 VisitRO(this, node, kSSEFloat32Sqrt); | 1329 VisitRO(this, node, kSSEFloat32Sqrt); |
1341 } | 1330 } |
1342 | 1331 |
1343 | 1332 |
1344 void InstructionSelector::VisitFloat64Add(Node* node) { | 1333 void InstructionSelector::VisitFloat64Add(Node* node) { |
1345 VisitFloatBinop(this, node, kAVXFloat64Add, kSSEFloat64Add); | 1334 VisitFloatBinop(this, node, kAVXFloat64Add, kSSEFloat64Add); |
1346 } | 1335 } |
1347 | 1336 |
1348 | 1337 |
1349 void InstructionSelector::VisitFloat64Sub(Node* node) { | 1338 void InstructionSelector::VisitFloat64Sub(Node* node) { |
1350 X64OperandGenerator g(this); | |
1351 Float64BinopMatcher m(node); | |
1352 if (m.left().IsMinusZero()) { | |
1353 if (m.right().IsFloat64RoundDown() && | |
1354 CanCover(m.node(), m.right().node())) { | |
1355 if (m.right().InputAt(0)->opcode() == IrOpcode::kFloat64Sub && | |
1356 CanCover(m.right().node(), m.right().InputAt(0))) { | |
1357 Float64BinopMatcher mright0(m.right().InputAt(0)); | |
1358 if (mright0.left().IsMinusZero()) { | |
1359 Emit(kSSEFloat64Round | MiscField::encode(kRoundUp), | |
1360 g.DefineAsRegister(node), g.UseRegister(mright0.right().node())); | |
1361 return; | |
1362 } | |
1363 } | |
1364 } | |
1365 VisitFloatUnop(this, node, m.right().node(), kAVXFloat64Neg, | |
1366 kSSEFloat64Neg); | |
1367 return; | |
1368 } | |
1369 VisitFloatBinop(this, node, kAVXFloat64Sub, kSSEFloat64Sub); | 1339 VisitFloatBinop(this, node, kAVXFloat64Sub, kSSEFloat64Sub); |
1370 } | 1340 } |
1371 | 1341 |
1372 void InstructionSelector::VisitFloat64SubPreserveNan(Node* node) { | |
1373 VisitFloatBinop(this, node, kAVXFloat64Sub, kSSEFloat64Sub); | |
1374 } | |
1375 | |
1376 void InstructionSelector::VisitFloat64Mul(Node* node) { | 1342 void InstructionSelector::VisitFloat64Mul(Node* node) { |
1377 VisitFloatBinop(this, node, kAVXFloat64Mul, kSSEFloat64Mul); | 1343 VisitFloatBinop(this, node, kAVXFloat64Mul, kSSEFloat64Mul); |
1378 } | 1344 } |
1379 | 1345 |
1380 | 1346 |
1381 void InstructionSelector::VisitFloat64Div(Node* node) { | 1347 void InstructionSelector::VisitFloat64Div(Node* node) { |
1382 VisitFloatBinop(this, node, kAVXFloat64Div, kSSEFloat64Div); | 1348 VisitFloatBinop(this, node, kAVXFloat64Div, kSSEFloat64Div); |
1383 } | 1349 } |
1384 | 1350 |
1385 | 1351 |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2207 // static | 2173 // static |
2208 MachineOperatorBuilder::AlignmentRequirements | 2174 MachineOperatorBuilder::AlignmentRequirements |
2209 InstructionSelector::AlignmentRequirements() { | 2175 InstructionSelector::AlignmentRequirements() { |
2210 return MachineOperatorBuilder::AlignmentRequirements:: | 2176 return MachineOperatorBuilder::AlignmentRequirements:: |
2211 FullUnalignedAccessSupport(); | 2177 FullUnalignedAccessSupport(); |
2212 } | 2178 } |
2213 | 2179 |
2214 } // namespace compiler | 2180 } // namespace compiler |
2215 } // namespace internal | 2181 } // namespace internal |
2216 } // namespace v8 | 2182 } // namespace v8 |
OLD | NEW |