OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
10 | 10 |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 madd_d(fd, fr, fs, ft); | 1622 madd_d(fd, fr, fs, ft); |
1623 } else { | 1623 } else { |
1624 // Can not change source regs's value. | 1624 // Can not change source regs's value. |
1625 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch)); | 1625 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch)); |
1626 mul_d(scratch, fs, ft); | 1626 mul_d(scratch, fs, ft); |
1627 add_d(fd, fr, scratch); | 1627 add_d(fd, fr, scratch); |
1628 } | 1628 } |
1629 } | 1629 } |
1630 | 1630 |
1631 | 1631 |
1632 void MacroAssembler::BranchF(Label* target, | 1632 void MacroAssembler::BranchFSize(SecondaryField sizeField, Label* target, |
1633 Label* nan, | 1633 Label* nan, Condition cc, FPURegister cmp1, |
1634 Condition cc, | 1634 FPURegister cmp2, BranchDelaySlot bd) { |
1635 FPURegister cmp1, | |
1636 FPURegister cmp2, | |
1637 BranchDelaySlot bd) { | |
1638 BlockTrampolinePoolScope block_trampoline_pool(this); | 1635 BlockTrampolinePoolScope block_trampoline_pool(this); |
1639 if (cc == al) { | 1636 if (cc == al) { |
1640 Branch(bd, target); | 1637 Branch(bd, target); |
1641 return; | 1638 return; |
1642 } | 1639 } |
1643 | 1640 |
| 1641 if (kArchVariant == kMips64r6) { |
| 1642 sizeField = sizeField == D ? L : W; |
| 1643 } |
1644 DCHECK(nan || target); | 1644 DCHECK(nan || target); |
1645 // Check for unordered (NaN) cases. | 1645 // Check for unordered (NaN) cases. |
1646 if (nan) { | 1646 if (nan) { |
1647 if (kArchVariant != kMips64r6) { | 1647 if (kArchVariant != kMips64r6) { |
1648 c(UN, D, cmp1, cmp2); | 1648 c(UN, D, cmp1, cmp2); |
1649 bc1t(nan); | 1649 bc1t(nan); |
1650 } else { | 1650 } else { |
1651 // Use f31 for comparison result. It has to be unavailable to lithium | 1651 // Use f31 for comparison result. It has to be unavailable to lithium |
1652 // register allocator. | 1652 // register allocator. |
1653 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); | 1653 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); |
1654 cmp(UN, L, f31, cmp1, cmp2); | 1654 cmp(UN, L, f31, cmp1, cmp2); |
1655 bc1nez(nan, f31); | 1655 bc1nez(nan, f31); |
1656 } | 1656 } |
1657 } | 1657 } |
1658 | 1658 |
1659 if (kArchVariant != kMips64r6) { | 1659 if (kArchVariant != kMips64r6) { |
1660 if (target) { | 1660 if (target) { |
1661 // Here NaN cases were either handled by this function or are assumed to | 1661 // Here NaN cases were either handled by this function or are assumed to |
1662 // have been handled by the caller. | 1662 // have been handled by the caller. |
1663 switch (cc) { | 1663 switch (cc) { |
1664 case lt: | 1664 case lt: |
1665 c(OLT, D, cmp1, cmp2); | 1665 c(OLT, sizeField, cmp1, cmp2); |
1666 bc1t(target); | 1666 bc1t(target); |
1667 break; | 1667 break; |
1668 case gt: | 1668 case gt: |
1669 c(ULE, D, cmp1, cmp2); | 1669 c(ULE, sizeField, cmp1, cmp2); |
1670 bc1f(target); | 1670 bc1f(target); |
1671 break; | 1671 break; |
1672 case ge: | 1672 case ge: |
1673 c(ULT, D, cmp1, cmp2); | 1673 c(ULT, sizeField, cmp1, cmp2); |
1674 bc1f(target); | 1674 bc1f(target); |
1675 break; | 1675 break; |
1676 case le: | 1676 case le: |
1677 c(OLE, D, cmp1, cmp2); | 1677 c(OLE, sizeField, cmp1, cmp2); |
1678 bc1t(target); | 1678 bc1t(target); |
1679 break; | 1679 break; |
1680 case eq: | 1680 case eq: |
1681 c(EQ, D, cmp1, cmp2); | 1681 c(EQ, sizeField, cmp1, cmp2); |
1682 bc1t(target); | 1682 bc1t(target); |
1683 break; | 1683 break; |
1684 case ueq: | 1684 case ueq: |
1685 c(UEQ, D, cmp1, cmp2); | 1685 c(UEQ, sizeField, cmp1, cmp2); |
1686 bc1t(target); | 1686 bc1t(target); |
1687 break; | 1687 break; |
1688 case ne: | 1688 case ne: |
1689 c(EQ, D, cmp1, cmp2); | 1689 c(EQ, sizeField, cmp1, cmp2); |
1690 bc1f(target); | 1690 bc1f(target); |
1691 break; | 1691 break; |
1692 case nue: | 1692 case nue: |
1693 c(UEQ, D, cmp1, cmp2); | 1693 c(UEQ, sizeField, cmp1, cmp2); |
1694 bc1f(target); | 1694 bc1f(target); |
1695 break; | 1695 break; |
1696 default: | 1696 default: |
1697 CHECK(0); | 1697 CHECK(0); |
1698 } | 1698 } |
1699 } | 1699 } |
1700 } else { | 1700 } else { |
1701 if (target) { | 1701 if (target) { |
1702 // Here NaN cases were either handled by this function or are assumed to | 1702 // Here NaN cases were either handled by this function or are assumed to |
1703 // have been handled by the caller. | 1703 // have been handled by the caller. |
1704 // Unsigned conditions are treated as their signed counterpart. | 1704 // Unsigned conditions are treated as their signed counterpart. |
1705 // Use f31 for comparison result, it is valid in fp64 (FR = 1) mode. | 1705 // Use f31 for comparison result, it is valid in fp64 (FR = 1) mode. |
1706 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); | 1706 DCHECK(!cmp1.is(f31) && !cmp2.is(f31)); |
1707 switch (cc) { | 1707 switch (cc) { |
1708 case lt: | 1708 case lt: |
1709 cmp(OLT, L, f31, cmp1, cmp2); | 1709 cmp(OLT, sizeField, f31, cmp1, cmp2); |
1710 bc1nez(target, f31); | 1710 bc1nez(target, f31); |
1711 break; | 1711 break; |
1712 case gt: | 1712 case gt: |
1713 cmp(ULE, L, f31, cmp1, cmp2); | 1713 cmp(ULE, sizeField, f31, cmp1, cmp2); |
1714 bc1eqz(target, f31); | 1714 bc1eqz(target, f31); |
1715 break; | 1715 break; |
1716 case ge: | 1716 case ge: |
1717 cmp(ULT, L, f31, cmp1, cmp2); | 1717 cmp(ULT, sizeField, f31, cmp1, cmp2); |
1718 bc1eqz(target, f31); | 1718 bc1eqz(target, f31); |
1719 break; | 1719 break; |
1720 case le: | 1720 case le: |
1721 cmp(OLE, L, f31, cmp1, cmp2); | 1721 cmp(OLE, sizeField, f31, cmp1, cmp2); |
1722 bc1nez(target, f31); | 1722 bc1nez(target, f31); |
1723 break; | 1723 break; |
1724 case eq: | 1724 case eq: |
1725 cmp(EQ, L, f31, cmp1, cmp2); | 1725 cmp(EQ, sizeField, f31, cmp1, cmp2); |
1726 bc1nez(target, f31); | 1726 bc1nez(target, f31); |
1727 break; | 1727 break; |
1728 case ueq: | 1728 case ueq: |
1729 cmp(UEQ, L, f31, cmp1, cmp2); | 1729 cmp(UEQ, sizeField, f31, cmp1, cmp2); |
1730 bc1nez(target, f31); | 1730 bc1nez(target, f31); |
1731 break; | 1731 break; |
1732 case ne: | 1732 case ne: |
1733 cmp(EQ, L, f31, cmp1, cmp2); | 1733 cmp(EQ, sizeField, f31, cmp1, cmp2); |
1734 bc1eqz(target, f31); | 1734 bc1eqz(target, f31); |
1735 break; | 1735 break; |
1736 case nue: | 1736 case nue: |
1737 cmp(UEQ, L, f31, cmp1, cmp2); | 1737 cmp(UEQ, sizeField, f31, cmp1, cmp2); |
1738 bc1eqz(target, f31); | 1738 bc1eqz(target, f31); |
1739 break; | 1739 break; |
1740 default: | 1740 default: |
1741 CHECK(0); | 1741 CHECK(0); |
1742 } | 1742 } |
1743 } | 1743 } |
1744 } | 1744 } |
1745 | 1745 |
1746 if (bd == PROTECT) { | 1746 if (bd == PROTECT) { |
1747 nop(); | 1747 nop(); |
1748 } | 1748 } |
1749 } | 1749 } |
1750 | 1750 |
1751 | 1751 |
| 1752 void MacroAssembler::BranchF(Label* target, Label* nan, Condition cc, |
| 1753 FPURegister cmp1, FPURegister cmp2, |
| 1754 BranchDelaySlot bd) { |
| 1755 BranchFSize(D, target, nan, cc, cmp1, cmp2, bd); |
| 1756 } |
| 1757 |
| 1758 |
| 1759 void MacroAssembler::BranchFS(Label* target, Label* nan, Condition cc, |
| 1760 FPURegister cmp1, FPURegister cmp2, |
| 1761 BranchDelaySlot bd) { |
| 1762 BranchFSize(S, target, nan, cc, cmp1, cmp2, bd); |
| 1763 } |
| 1764 |
| 1765 |
1752 void MacroAssembler::FmoveLow(FPURegister dst, Register src_low) { | 1766 void MacroAssembler::FmoveLow(FPURegister dst, Register src_low) { |
1753 DCHECK(!src_low.is(at)); | 1767 DCHECK(!src_low.is(at)); |
1754 mfhc1(at, dst); | 1768 mfhc1(at, dst); |
1755 mtc1(src_low, dst); | 1769 mtc1(src_low, dst); |
1756 mthc1(at, dst); | 1770 mthc1(at, dst); |
1757 } | 1771 } |
1758 | 1772 |
1759 | 1773 |
1760 void MacroAssembler::Move(FPURegister dst, float imm) { | 1774 void MacroAssembler::Move(FPURegister dst, float imm) { |
1761 li(at, Operand(bit_cast<int32_t>(imm))); | 1775 li(at, Operand(bit_cast<int32_t>(imm))); |
(...skipping 4368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6130 } | 6144 } |
6131 if (mag.shift > 0) sra(result, result, mag.shift); | 6145 if (mag.shift > 0) sra(result, result, mag.shift); |
6132 srl(at, dividend, 31); | 6146 srl(at, dividend, 31); |
6133 Addu(result, result, Operand(at)); | 6147 Addu(result, result, Operand(at)); |
6134 } | 6148 } |
6135 | 6149 |
6136 | 6150 |
6137 } } // namespace v8::internal | 6151 } } // namespace v8::internal |
6138 | 6152 |
6139 #endif // V8_TARGET_ARCH_MIPS64 | 6153 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |