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 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 } | 1442 } |
1443 | 1443 |
1444 | 1444 |
1445 void InstructionSelector::VisitBitcastInt64ToFloat64(Node* node) { | 1445 void InstructionSelector::VisitBitcastInt64ToFloat64(Node* node) { |
1446 VisitRR(this, kMips64BitcastLD, node); | 1446 VisitRR(this, kMips64BitcastLD, node); |
1447 } | 1447 } |
1448 | 1448 |
1449 | 1449 |
1450 void InstructionSelector::VisitFloat32Add(Node* node) { | 1450 void InstructionSelector::VisitFloat32Add(Node* node) { |
1451 Mips64OperandGenerator g(this); | 1451 Mips64OperandGenerator g(this); |
1452 Float32BinopMatcher m(node); | 1452 if (kArchVariant == kMips64r2) { // Select Madd.S(z, x, y). |
1453 if (m.left().IsFloat32Mul() && CanCover(node, m.left().node())) { | 1453 Float32BinopMatcher m(node); |
1454 // For Add.S(Mul.S(x, y), z): | 1454 if (m.left().IsFloat32Mul() && CanCover(node, m.left().node())) { |
1455 Float32BinopMatcher mleft(m.left().node()); | 1455 // For Add.S(Mul.S(x, y), z): |
1456 if (kArchVariant == kMips64r2) { // Select Madd.S(z, x, y). | 1456 Float32BinopMatcher mleft(m.left().node()); |
1457 Emit(kMips64MaddS, g.DefineAsRegister(node), | 1457 Emit(kMips64MaddS, g.DefineAsRegister(node), |
1458 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | 1458 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), |
1459 g.UseRegister(mleft.right().node())); | 1459 g.UseRegister(mleft.right().node())); |
1460 return; | 1460 return; |
1461 } else if (kArchVariant == kMips64r6) { // Select Maddf.S(z, x, y). | |
1462 Emit(kMips64MaddfS, g.DefineSameAsFirst(node), | |
1463 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | |
1464 g.UseRegister(mleft.right().node())); | |
1465 return; | |
1466 } | 1461 } |
1467 } | 1462 if (m.right().IsFloat32Mul() && CanCover(node, m.right().node())) { |
1468 if (m.right().IsFloat32Mul() && CanCover(node, m.right().node())) { | 1463 // For Add.S(x, Mul.S(y, z)): |
1469 // For Add.S(x, Mul.S(y, z)): | 1464 Float32BinopMatcher mright(m.right().node()); |
1470 Float32BinopMatcher mright(m.right().node()); | |
1471 if (kArchVariant == kMips64r2) { // Select Madd.S(x, y, z). | |
1472 Emit(kMips64MaddS, g.DefineAsRegister(node), | 1465 Emit(kMips64MaddS, g.DefineAsRegister(node), |
1473 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | 1466 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), |
1474 g.UseRegister(mright.right().node())); | 1467 g.UseRegister(mright.right().node())); |
1475 return; | 1468 return; |
1476 } else if (kArchVariant == kMips64r6) { // Select Maddf.S(x, y, z). | |
1477 Emit(kMips64MaddfS, g.DefineSameAsFirst(node), | |
1478 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | |
1479 g.UseRegister(mright.right().node())); | |
1480 return; | |
1481 } | 1469 } |
1482 } | 1470 } |
1483 VisitRRR(this, kMips64AddS, node); | 1471 VisitRRR(this, kMips64AddS, node); |
1484 } | 1472 } |
1485 | 1473 |
1486 | 1474 |
1487 void InstructionSelector::VisitFloat64Add(Node* node) { | 1475 void InstructionSelector::VisitFloat64Add(Node* node) { |
1488 Mips64OperandGenerator g(this); | 1476 Mips64OperandGenerator g(this); |
1489 Float64BinopMatcher m(node); | 1477 if (kArchVariant == kMips64r2) { // Select Madd.S(z, x, y). |
1490 if (m.left().IsFloat64Mul() && CanCover(node, m.left().node())) { | 1478 Float64BinopMatcher m(node); |
1491 // For Add.D(Mul.D(x, y), z): | 1479 if (m.left().IsFloat64Mul() && CanCover(node, m.left().node())) { |
1492 Float64BinopMatcher mleft(m.left().node()); | 1480 // For Add.D(Mul.D(x, y), z): |
1493 if (kArchVariant == kMips64r2) { // Select Madd.D(z, x, y). | 1481 Float64BinopMatcher mleft(m.left().node()); |
1494 Emit(kMips64MaddD, g.DefineAsRegister(node), | 1482 Emit(kMips64MaddD, g.DefineAsRegister(node), |
1495 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | 1483 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), |
1496 g.UseRegister(mleft.right().node())); | 1484 g.UseRegister(mleft.right().node())); |
1497 return; | 1485 return; |
1498 } else if (kArchVariant == kMips64r6) { // Select Maddf.D(z, x, y). | |
1499 Emit(kMips64MaddfD, g.DefineSameAsFirst(node), | |
1500 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | |
1501 g.UseRegister(mleft.right().node())); | |
1502 return; | |
1503 } | 1486 } |
1504 } | 1487 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { |
1505 if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { | 1488 // For Add.D(x, Mul.D(y, z)): |
1506 // For Add.D(x, Mul.D(y, z)): | 1489 Float64BinopMatcher mright(m.right().node()); |
1507 Float64BinopMatcher mright(m.right().node()); | |
1508 if (kArchVariant == kMips64r2) { // Select Madd.D(x, y, z). | |
1509 Emit(kMips64MaddD, g.DefineAsRegister(node), | 1490 Emit(kMips64MaddD, g.DefineAsRegister(node), |
1510 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | 1491 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), |
1511 g.UseRegister(mright.right().node())); | 1492 g.UseRegister(mright.right().node())); |
1512 return; | 1493 return; |
1513 } else if (kArchVariant == kMips64r6) { // Select Maddf.D(x, y, z). | |
1514 Emit(kMips64MaddfD, g.DefineSameAsFirst(node), | |
1515 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | |
1516 g.UseRegister(mright.right().node())); | |
1517 return; | |
1518 } | 1494 } |
1519 } | 1495 } |
1520 VisitRRR(this, kMips64AddD, node); | 1496 VisitRRR(this, kMips64AddD, node); |
1521 } | 1497 } |
1522 | 1498 |
1523 | 1499 |
1524 void InstructionSelector::VisitFloat32Sub(Node* node) { | 1500 void InstructionSelector::VisitFloat32Sub(Node* node) { |
1525 Mips64OperandGenerator g(this); | 1501 Mips64OperandGenerator g(this); |
1526 Float32BinopMatcher m(node); | 1502 if (kArchVariant == kMips64r2) { // Select Madd.S(z, x, y). |
1527 if (m.left().IsFloat32Mul() && CanCover(node, m.left().node())) { | 1503 Float32BinopMatcher m(node); |
1528 if (kArchVariant == kMips64r2) { | 1504 if (m.left().IsFloat32Mul() && CanCover(node, m.left().node())) { |
1529 // For Sub.S(Mul.S(x,y), z) select Msub.S(z, x, y). | 1505 // For Sub.S(Mul.S(x,y), z) select Msub.S(z, x, y). |
1530 Float32BinopMatcher mleft(m.left().node()); | 1506 Float32BinopMatcher mleft(m.left().node()); |
1531 Emit(kMips64MsubS, g.DefineAsRegister(node), | 1507 Emit(kMips64MsubS, g.DefineAsRegister(node), |
1532 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | 1508 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), |
1533 g.UseRegister(mleft.right().node())); | 1509 g.UseRegister(mleft.right().node())); |
1534 return; | 1510 return; |
1535 } | 1511 } |
1536 } else if (m.right().IsFloat32Mul() && CanCover(node, m.right().node())) { | |
1537 if (kArchVariant == kMips64r6) { | |
1538 // For Sub.S(x,Mul.S(y,z)) select Msubf.S(x, y, z). | |
1539 Float32BinopMatcher mright(m.right().node()); | |
1540 Emit(kMips64MsubfS, g.DefineSameAsFirst(node), | |
1541 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | |
1542 g.UseRegister(mright.right().node())); | |
1543 return; | |
1544 } | |
1545 } | 1512 } |
1546 VisitRRR(this, kMips64SubS, node); | 1513 VisitRRR(this, kMips64SubS, node); |
1547 } | 1514 } |
1548 | 1515 |
1549 void InstructionSelector::VisitFloat64Sub(Node* node) { | 1516 void InstructionSelector::VisitFloat64Sub(Node* node) { |
1550 Mips64OperandGenerator g(this); | 1517 Mips64OperandGenerator g(this); |
1551 Float64BinopMatcher m(node); | 1518 if (kArchVariant == kMips64r2) { // Select Madd.S(z, x, y). |
1552 if (m.left().IsFloat64Mul() && CanCover(node, m.left().node())) { | 1519 Float64BinopMatcher m(node); |
1553 if (kArchVariant == kMips64r2) { | 1520 if (m.left().IsFloat64Mul() && CanCover(node, m.left().node())) { |
1554 // For Sub.D(Mul.S(x,y), z) select Msub.D(z, x, y). | 1521 // For Sub.D(Mul.S(x,y), z) select Msub.D(z, x, y). |
1555 Float64BinopMatcher mleft(m.left().node()); | 1522 Float64BinopMatcher mleft(m.left().node()); |
1556 Emit(kMips64MsubD, g.DefineAsRegister(node), | 1523 Emit(kMips64MsubD, g.DefineAsRegister(node), |
1557 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), | 1524 g.UseRegister(m.right().node()), g.UseRegister(mleft.left().node()), |
1558 g.UseRegister(mleft.right().node())); | 1525 g.UseRegister(mleft.right().node())); |
1559 return; | 1526 return; |
1560 } | 1527 } |
1561 } else if (m.right().IsFloat64Mul() && CanCover(node, m.right().node())) { | |
1562 if (kArchVariant == kMips64r6) { | |
1563 // For Sub.D(x,Mul.S(y,z)) select Msubf.D(x, y, z). | |
1564 Float64BinopMatcher mright(m.right().node()); | |
1565 Emit(kMips64MsubfD, g.DefineSameAsFirst(node), | |
1566 g.UseRegister(m.left().node()), g.UseRegister(mright.left().node()), | |
1567 g.UseRegister(mright.right().node())); | |
1568 return; | |
1569 } | |
1570 } | 1528 } |
1571 VisitRRR(this, kMips64SubD, node); | 1529 VisitRRR(this, kMips64SubD, node); |
1572 } | 1530 } |
1573 | 1531 |
1574 void InstructionSelector::VisitFloat32Mul(Node* node) { | 1532 void InstructionSelector::VisitFloat32Mul(Node* node) { |
1575 VisitRRR(this, kMips64MulS, node); | 1533 VisitRRR(this, kMips64MulS, node); |
1576 } | 1534 } |
1577 | 1535 |
1578 | 1536 |
1579 void InstructionSelector::VisitFloat64Mul(Node* node) { | 1537 void InstructionSelector::VisitFloat64Mul(Node* node) { |
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2644 } else { | 2602 } else { |
2645 DCHECK(kArchVariant == kMips64r2); | 2603 DCHECK(kArchVariant == kMips64r2); |
2646 return MachineOperatorBuilder::AlignmentRequirements:: | 2604 return MachineOperatorBuilder::AlignmentRequirements:: |
2647 NoUnalignedAccessSupport(); | 2605 NoUnalignedAccessSupport(); |
2648 } | 2606 } |
2649 } | 2607 } |
2650 | 2608 |
2651 } // namespace compiler | 2609 } // namespace compiler |
2652 } // namespace internal | 2610 } // namespace internal |
2653 } // namespace v8 | 2611 } // namespace v8 |
OLD | NEW |