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 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 } | 1721 } |
1722 | 1722 |
1723 | 1723 |
1724 void MacroAssembler::Trunc_uw_d(FPURegister fd, | 1724 void MacroAssembler::Trunc_uw_d(FPURegister fd, |
1725 FPURegister fs, | 1725 FPURegister fs, |
1726 FPURegister scratch) { | 1726 FPURegister scratch) { |
1727 Trunc_uw_d(fs, t8, scratch); | 1727 Trunc_uw_d(fs, t8, scratch); |
1728 mtc1(t8, fd); | 1728 mtc1(t8, fd); |
1729 } | 1729 } |
1730 | 1730 |
| 1731 void MacroAssembler::Trunc_uw_s(FPURegister fd, FPURegister fs, |
| 1732 FPURegister scratch) { |
| 1733 Trunc_uw_s(fs, t8, scratch); |
| 1734 mtc1(t8, fd); |
| 1735 } |
| 1736 |
1731 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, | 1737 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, |
1732 FPURegister scratch, Register result) { | 1738 FPURegister scratch, Register result) { |
1733 Trunc_ul_d(fs, t8, scratch, result); | 1739 Trunc_ul_d(fs, t8, scratch, result); |
1734 dmtc1(t8, fd); | 1740 dmtc1(t8, fd); |
1735 } | 1741 } |
1736 | 1742 |
1737 | 1743 |
1738 void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs, | 1744 void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs, |
1739 FPURegister scratch, Register result) { | 1745 FPURegister scratch, Register result) { |
1740 Trunc_ul_s(fs, t8, scratch, result); | 1746 Trunc_ul_s(fs, t8, scratch, result); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 Label done; | 1793 Label done; |
1788 Branch(&done); | 1794 Branch(&done); |
1789 // Simple conversion. | 1795 // Simple conversion. |
1790 bind(&simple_convert); | 1796 bind(&simple_convert); |
1791 trunc_w_d(scratch, fd); | 1797 trunc_w_d(scratch, fd); |
1792 mfc1(rs, scratch); | 1798 mfc1(rs, scratch); |
1793 | 1799 |
1794 bind(&done); | 1800 bind(&done); |
1795 } | 1801 } |
1796 | 1802 |
| 1803 void MacroAssembler::Trunc_uw_s(FPURegister fd, Register rs, |
| 1804 FPURegister scratch) { |
| 1805 DCHECK(!fd.is(scratch)); |
| 1806 DCHECK(!rs.is(at)); |
| 1807 |
| 1808 // Load 2^31 into scratch as its float representation. |
| 1809 li(at, 0x4F000000); |
| 1810 mtc1(at, scratch); |
| 1811 // Test if scratch > fd. |
| 1812 // If fd < 2^31 we can convert it normally. |
| 1813 Label simple_convert; |
| 1814 BranchF32(&simple_convert, NULL, lt, fd, scratch); |
| 1815 |
| 1816 // First we subtract 2^31 from fd, then trunc it to rs |
| 1817 // and add 2^31 to rs. |
| 1818 sub_s(scratch, fd, scratch); |
| 1819 trunc_w_s(scratch, scratch); |
| 1820 mfc1(rs, scratch); |
| 1821 Or(rs, rs, 1 << 31); |
| 1822 |
| 1823 Label done; |
| 1824 Branch(&done); |
| 1825 // Simple conversion. |
| 1826 bind(&simple_convert); |
| 1827 trunc_w_s(scratch, fd); |
| 1828 mfc1(rs, scratch); |
| 1829 |
| 1830 bind(&done); |
| 1831 } |
1797 | 1832 |
1798 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, | 1833 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, |
1799 FPURegister scratch, Register result) { | 1834 FPURegister scratch, Register result) { |
1800 DCHECK(!fd.is(scratch)); | 1835 DCHECK(!fd.is(scratch)); |
1801 DCHECK(!AreAliased(rs, result, at)); | 1836 DCHECK(!AreAliased(rs, result, at)); |
1802 | 1837 |
1803 Label simple_convert, done, fail; | 1838 Label simple_convert, done, fail; |
1804 if (result.is_valid()) { | 1839 if (result.is_valid()) { |
1805 mov(result, zero_reg); | 1840 mov(result, zero_reg); |
1806 Move(scratch, -1.0); | 1841 Move(scratch, -1.0); |
(...skipping 4740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6547 if (mag.shift > 0) sra(result, result, mag.shift); | 6582 if (mag.shift > 0) sra(result, result, mag.shift); |
6548 srl(at, dividend, 31); | 6583 srl(at, dividend, 31); |
6549 Addu(result, result, Operand(at)); | 6584 Addu(result, result, Operand(at)); |
6550 } | 6585 } |
6551 | 6586 |
6552 | 6587 |
6553 } // namespace internal | 6588 } // namespace internal |
6554 } // namespace v8 | 6589 } // namespace v8 |
6555 | 6590 |
6556 #endif // V8_TARGET_ARCH_MIPS64 | 6591 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |