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 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 mtc1(t8, fd); | 1621 mtc1(t8, fd); |
1622 } | 1622 } |
1623 | 1623 |
1624 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, | 1624 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, |
1625 FPURegister scratch) { | 1625 FPURegister scratch) { |
1626 Trunc_ul_d(fs, t8, scratch); | 1626 Trunc_ul_d(fs, t8, scratch); |
1627 dmtc1(t8, fd); | 1627 dmtc1(t8, fd); |
1628 } | 1628 } |
1629 | 1629 |
1630 | 1630 |
| 1631 void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs, |
| 1632 FPURegister scratch) { |
| 1633 Trunc_ul_s(fs, t8, scratch); |
| 1634 dmtc1(t8, fd); |
| 1635 } |
| 1636 |
| 1637 |
1631 void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) { | 1638 void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) { |
1632 trunc_w_d(fd, fs); | 1639 trunc_w_d(fd, fs); |
1633 } | 1640 } |
1634 | 1641 |
1635 | 1642 |
1636 void MacroAssembler::Round_w_d(FPURegister fd, FPURegister fs) { | 1643 void MacroAssembler::Round_w_d(FPURegister fd, FPURegister fs) { |
1637 round_w_d(fd, fs); | 1644 round_w_d(fd, fs); |
1638 } | 1645 } |
1639 | 1646 |
1640 | 1647 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 | 1686 |
1680 bind(&done); | 1687 bind(&done); |
1681 } | 1688 } |
1682 | 1689 |
1683 | 1690 |
1684 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, | 1691 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, |
1685 FPURegister scratch) { | 1692 FPURegister scratch) { |
1686 DCHECK(!fd.is(scratch)); | 1693 DCHECK(!fd.is(scratch)); |
1687 DCHECK(!rs.is(at)); | 1694 DCHECK(!rs.is(at)); |
1688 | 1695 |
1689 // Load 2^63 into scratch as its float representation. | 1696 // Load 2^63 into scratch as its double representation. |
1690 li(at, 0x43e0000000000000); | 1697 li(at, 0x43e0000000000000); |
1691 dmtc1(at, scratch); | 1698 dmtc1(at, scratch); |
1692 | 1699 |
1693 // Test if scratch > fd. | 1700 // Test if scratch > fd. |
1694 // If fd < 2^63 we can convert it normally. | 1701 // If fd < 2^63 we can convert it normally. |
1695 Label simple_convert, done; | 1702 Label simple_convert, done; |
1696 BranchF(&simple_convert, NULL, lt, fd, scratch); | 1703 BranchF(&simple_convert, NULL, lt, fd, scratch); |
1697 | 1704 |
1698 // First we subtract 2^63 from fd, then trunc it to rs | 1705 // First we subtract 2^63 from fd, then trunc it to rs |
1699 // and add 2^63 to rs. | 1706 // and add 2^63 to rs. |
1700 sub_d(scratch, fd, scratch); | 1707 sub_d(scratch, fd, scratch); |
1701 trunc_l_d(scratch, scratch); | 1708 trunc_l_d(scratch, scratch); |
1702 dmfc1(rs, scratch); | 1709 dmfc1(rs, scratch); |
1703 Or(rs, rs, Operand(1UL << 63)); | 1710 Or(rs, rs, Operand(1UL << 63)); |
1704 Branch(&done); | 1711 Branch(&done); |
1705 | 1712 |
1706 // Simple conversion. | 1713 // Simple conversion. |
1707 bind(&simple_convert); | 1714 bind(&simple_convert); |
1708 trunc_l_d(scratch, fd); | 1715 trunc_l_d(scratch, fd); |
1709 dmfc1(rs, scratch); | 1716 dmfc1(rs, scratch); |
1710 | 1717 |
1711 bind(&done); | 1718 bind(&done); |
1712 } | 1719 } |
1713 | 1720 |
1714 | 1721 |
| 1722 void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs, |
| 1723 FPURegister scratch) { |
| 1724 DCHECK(!fd.is(scratch)); |
| 1725 DCHECK(!rs.is(at)); |
| 1726 |
| 1727 // Load 2^63 into scratch as its float representation. |
| 1728 li(at, 0x5f000000); |
| 1729 dmtc1(at, scratch); |
| 1730 |
| 1731 // Test if scratch > fd. |
| 1732 // If fd < 2^63 we can convert it normally. |
| 1733 Label simple_convert, done; |
| 1734 BranchF32(&simple_convert, NULL, lt, fd, scratch); |
| 1735 |
| 1736 // First we subtract 2^63 from fd, then trunc it to rs |
| 1737 // and add 2^63 to rs. |
| 1738 sub_s(scratch, fd, scratch); |
| 1739 trunc_l_s(scratch, scratch); |
| 1740 dmfc1(rs, scratch); |
| 1741 Or(rs, rs, Operand(1UL << 63)); |
| 1742 Branch(&done); |
| 1743 |
| 1744 // Simple conversion. |
| 1745 bind(&simple_convert); |
| 1746 trunc_l_s(scratch, fd); |
| 1747 dmfc1(rs, scratch); |
| 1748 |
| 1749 bind(&done); |
| 1750 } |
| 1751 |
| 1752 |
1715 void MacroAssembler::Madd_d(FPURegister fd, FPURegister fr, FPURegister fs, | 1753 void MacroAssembler::Madd_d(FPURegister fd, FPURegister fr, FPURegister fs, |
1716 FPURegister ft, FPURegister scratch) { | 1754 FPURegister ft, FPURegister scratch) { |
1717 if (0) { // TODO(plind): find reasonable arch-variant symbol names. | 1755 if (0) { // TODO(plind): find reasonable arch-variant symbol names. |
1718 madd_d(fd, fr, fs, ft); | 1756 madd_d(fd, fr, fs, ft); |
1719 } else { | 1757 } else { |
1720 // Can not change source regs's value. | 1758 // Can not change source regs's value. |
1721 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch)); | 1759 DCHECK(!fr.is(scratch) && !fs.is(scratch) && !ft.is(scratch)); |
1722 mul_d(scratch, fs, ft); | 1760 mul_d(scratch, fs, ft); |
1723 add_d(fd, fr, scratch); | 1761 add_d(fd, fr, scratch); |
1724 } | 1762 } |
(...skipping 4520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6245 if (mag.shift > 0) sra(result, result, mag.shift); | 6283 if (mag.shift > 0) sra(result, result, mag.shift); |
6246 srl(at, dividend, 31); | 6284 srl(at, dividend, 31); |
6247 Addu(result, result, Operand(at)); | 6285 Addu(result, result, Operand(at)); |
6248 } | 6286 } |
6249 | 6287 |
6250 | 6288 |
6251 } // namespace internal | 6289 } // namespace internal |
6252 } // namespace v8 | 6290 } // namespace v8 |
6253 | 6291 |
6254 #endif // V8_TARGET_ARCH_MIPS64 | 6292 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |