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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 } | 807 } |
808 | 808 |
809 | 809 |
810 void InstructionSelector::VisitFloat64Mod(Node* node) { | 810 void InstructionSelector::VisitFloat64Mod(Node* node) { |
811 MipsOperandGenerator g(this); | 811 MipsOperandGenerator g(this); |
812 Emit(kMipsModD, g.DefineAsFixed(node, f0), g.UseFixed(node->InputAt(0), f12), | 812 Emit(kMipsModD, g.DefineAsFixed(node, f0), g.UseFixed(node->InputAt(0), f12), |
813 g.UseFixed(node->InputAt(1), f14))->MarkAsCall(); | 813 g.UseFixed(node->InputAt(1), f14))->MarkAsCall(); |
814 } | 814 } |
815 | 815 |
816 | 816 |
817 void InstructionSelector::VisitFloat32Max(Node* node) { | |
818 MipsOperandGenerator g(this); | |
819 if (IsMipsArchVariant(kMips32r6)) { | |
820 Emit(kMipsFloat32Max, g.DefineAsRegister(node), | |
821 g.UseUniqueRegister(node->InputAt(0)), | |
822 g.UseUniqueRegister(node->InputAt(1))); | |
823 | |
824 } else { | |
825 // Reverse operands, and use same reg. for result and right operand. | |
826 Emit(kMipsFloat32Max, g.DefineSameAsFirst(node), | |
827 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(0))); | |
828 } | |
829 } | |
830 | |
831 | |
832 void InstructionSelector::VisitFloat64Max(Node* node) { | 817 void InstructionSelector::VisitFloat64Max(Node* node) { |
833 MipsOperandGenerator g(this); | 818 MipsOperandGenerator g(this); |
834 if (IsMipsArchVariant(kMips32r6)) { | 819 Emit(kMipsFloat64Max, g.DefineAsRegister(node), |
835 Emit(kMipsFloat64Max, g.DefineAsRegister(node), | 820 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); |
836 g.UseUniqueRegister(node->InputAt(0)), | |
837 g.UseUniqueRegister(node->InputAt(1))); | |
838 | |
839 } else { | |
840 // Reverse operands, and use same reg. for result and right operand. | |
841 Emit(kMipsFloat64Max, g.DefineSameAsFirst(node), | |
842 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(0))); | |
843 } | |
844 } | |
845 | |
846 | |
847 void InstructionSelector::VisitFloat32Min(Node* node) { | |
848 MipsOperandGenerator g(this); | |
849 if (IsMipsArchVariant(kMips32r6)) { | |
850 Emit(kMipsFloat32Min, g.DefineAsRegister(node), | |
851 g.UseUniqueRegister(node->InputAt(0)), | |
852 g.UseUniqueRegister(node->InputAt(1))); | |
853 | |
854 } else { | |
855 // Reverse operands, and use same reg. for result and right operand. | |
856 Emit(kMipsFloat32Min, g.DefineSameAsFirst(node), | |
857 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(0))); | |
858 } | |
859 } | 821 } |
860 | 822 |
861 | 823 |
862 void InstructionSelector::VisitFloat64Min(Node* node) { | 824 void InstructionSelector::VisitFloat64Min(Node* node) { |
863 MipsOperandGenerator g(this); | 825 MipsOperandGenerator g(this); |
864 if (IsMipsArchVariant(kMips32r6)) { | 826 Emit(kMipsFloat64Min, g.DefineAsRegister(node), |
865 Emit(kMipsFloat64Min, g.DefineAsRegister(node), | 827 g.UseRegister(node->InputAt(0)), g.UseRegister(node->InputAt(1))); |
866 g.UseUniqueRegister(node->InputAt(0)), | |
867 g.UseUniqueRegister(node->InputAt(1))); | |
868 | |
869 } else { | |
870 // Reverse operands, and use same reg. for result and right operand. | |
871 Emit(kMipsFloat64Min, g.DefineSameAsFirst(node), | |
872 g.UseRegister(node->InputAt(1)), g.UseRegister(node->InputAt(0))); | |
873 } | |
874 } | 828 } |
875 | 829 |
876 | 830 |
877 void InstructionSelector::VisitFloat32Abs(Node* node) { | 831 void InstructionSelector::VisitFloat32Abs(Node* node) { |
878 VisitRR(this, kMipsAbsS, node); | 832 VisitRR(this, kMipsAbsS, node); |
879 } | 833 } |
880 | 834 |
881 | 835 |
882 void InstructionSelector::VisitFloat64Abs(Node* node) { | 836 void InstructionSelector::VisitFloat64Abs(Node* node) { |
883 VisitRR(this, kMipsAbsD, node); | 837 VisitRR(this, kMipsAbsD, node); |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1575 flags |= MachineOperatorBuilder::kFloat64RoundDown | | 1529 flags |= MachineOperatorBuilder::kFloat64RoundDown | |
1576 MachineOperatorBuilder::kFloat64RoundUp | | 1530 MachineOperatorBuilder::kFloat64RoundUp | |
1577 MachineOperatorBuilder::kFloat64RoundTruncate | | 1531 MachineOperatorBuilder::kFloat64RoundTruncate | |
1578 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1532 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1579 } | 1533 } |
1580 return flags | MachineOperatorBuilder::kWord32Ctz | | 1534 return flags | MachineOperatorBuilder::kWord32Ctz | |
1581 MachineOperatorBuilder::kWord32Popcnt | | 1535 MachineOperatorBuilder::kWord32Popcnt | |
1582 MachineOperatorBuilder::kInt32DivIsSafe | | 1536 MachineOperatorBuilder::kInt32DivIsSafe | |
1583 MachineOperatorBuilder::kUint32DivIsSafe | | 1537 MachineOperatorBuilder::kUint32DivIsSafe | |
1584 MachineOperatorBuilder::kWord32ShiftIsSafe | | 1538 MachineOperatorBuilder::kWord32ShiftIsSafe | |
1585 MachineOperatorBuilder::kFloat64Min | | |
1586 MachineOperatorBuilder::kFloat64Max | | |
1587 MachineOperatorBuilder::kFloat32Min | | |
1588 MachineOperatorBuilder::kFloat32Max | | |
1589 MachineOperatorBuilder::kFloat32RoundDown | | 1539 MachineOperatorBuilder::kFloat32RoundDown | |
1590 MachineOperatorBuilder::kFloat32RoundUp | | 1540 MachineOperatorBuilder::kFloat32RoundUp | |
1591 MachineOperatorBuilder::kFloat32RoundTruncate | | 1541 MachineOperatorBuilder::kFloat32RoundTruncate | |
1592 MachineOperatorBuilder::kFloat32RoundTiesEven; | 1542 MachineOperatorBuilder::kFloat32RoundTiesEven; |
1593 } | 1543 } |
1594 | 1544 |
1595 // static | 1545 // static |
1596 MachineOperatorBuilder::AlignmentRequirements | 1546 MachineOperatorBuilder::AlignmentRequirements |
1597 InstructionSelector::AlignmentRequirements() { | 1547 InstructionSelector::AlignmentRequirements() { |
1598 if (IsMipsArchVariant(kMips32r6)) { | 1548 if (IsMipsArchVariant(kMips32r6)) { |
1599 return MachineOperatorBuilder::AlignmentRequirements:: | 1549 return MachineOperatorBuilder::AlignmentRequirements:: |
1600 FullUnalignedAccessSupport(); | 1550 FullUnalignedAccessSupport(); |
1601 } else { | 1551 } else { |
1602 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || | 1552 DCHECK(IsMipsArchVariant(kLoongson) || IsMipsArchVariant(kMips32r1) || |
1603 IsMipsArchVariant(kMips32r2)); | 1553 IsMipsArchVariant(kMips32r2)); |
1604 return MachineOperatorBuilder::AlignmentRequirements:: | 1554 return MachineOperatorBuilder::AlignmentRequirements:: |
1605 NoUnalignedAccessSupport(); | 1555 NoUnalignedAccessSupport(); |
1606 } | 1556 } |
1607 } | 1557 } |
1608 | 1558 |
1609 } // namespace compiler | 1559 } // namespace compiler |
1610 } // namespace internal | 1560 } // namespace internal |
1611 } // namespace v8 | 1561 } // namespace v8 |
OLD | NEW |