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 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 | 1698 |
1699 | 1699 |
1700 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, | 1700 void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, |
1701 FPURegister scratch, Register result) { | 1701 FPURegister scratch, Register result) { |
1702 DCHECK(!fd.is(scratch)); | 1702 DCHECK(!fd.is(scratch)); |
1703 DCHECK(!AreAliased(rs, result, at)); | 1703 DCHECK(!AreAliased(rs, result, at)); |
1704 | 1704 |
1705 Label simple_convert, done, fail; | 1705 Label simple_convert, done, fail; |
1706 if (result.is_valid()) { | 1706 if (result.is_valid()) { |
1707 mov(result, zero_reg); | 1707 mov(result, zero_reg); |
1708 Move(kDoubleRegZero, 0.0); | 1708 Move(scratch, -1.0); |
1709 // If fd < 0 or unordered, then the conversion fails. | 1709 // If fd =< -1 or unordered, then the conversion fails. |
1710 BranchF(&fail, &fail, lt, fd, kDoubleRegZero); | 1710 BranchF(&fail, &fail, le, fd, scratch); |
1711 } | 1711 } |
1712 | 1712 |
1713 // Load 2^63 into scratch as its double representation. | 1713 // Load 2^63 into scratch as its double representation. |
1714 li(at, 0x43e0000000000000); | 1714 li(at, 0x43e0000000000000); |
1715 dmtc1(at, scratch); | 1715 dmtc1(at, scratch); |
1716 | 1716 |
1717 // Test if scratch > fd. | 1717 // Test if scratch > fd. |
1718 // If fd < 2^63 we can convert it normally. | 1718 // If fd < 2^63 we can convert it normally. |
1719 BranchF(&simple_convert, nullptr, lt, fd, scratch); | 1719 BranchF(&simple_convert, nullptr, lt, fd, scratch); |
1720 | 1720 |
(...skipping 25 matching lines...) Expand all Loading... |
1746 | 1746 |
1747 | 1747 |
1748 void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs, | 1748 void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs, |
1749 FPURegister scratch, Register result) { | 1749 FPURegister scratch, Register result) { |
1750 DCHECK(!fd.is(scratch)); | 1750 DCHECK(!fd.is(scratch)); |
1751 DCHECK(!AreAliased(rs, result, at)); | 1751 DCHECK(!AreAliased(rs, result, at)); |
1752 | 1752 |
1753 Label simple_convert, done, fail; | 1753 Label simple_convert, done, fail; |
1754 if (result.is_valid()) { | 1754 if (result.is_valid()) { |
1755 mov(result, zero_reg); | 1755 mov(result, zero_reg); |
1756 Move(kDoubleRegZero, 0.0); | 1756 Move(scratch, -1.0f); |
1757 // If fd < 0 or unordered, then the conversion fails. | 1757 // If fd =< -1 or unordered, then the conversion fails. |
1758 BranchF32(&fail, &fail, lt, fd, kDoubleRegZero); | 1758 BranchF32(&fail, &fail, le, fd, scratch); |
1759 } | 1759 } |
1760 | 1760 |
1761 // Load 2^63 into scratch as its float representation. | 1761 // Load 2^63 into scratch as its float representation. |
1762 li(at, 0x5f000000); | 1762 li(at, 0x5f000000); |
1763 mtc1(at, scratch); | 1763 mtc1(at, scratch); |
1764 | 1764 |
1765 // Test if scratch > fd. | 1765 // Test if scratch > fd. |
1766 // If fd < 2^63 we can convert it normally. | 1766 // If fd < 2^63 we can convert it normally. |
1767 BranchF32(&simple_convert, nullptr, lt, fd, scratch); | 1767 BranchF32(&simple_convert, nullptr, lt, fd, scratch); |
1768 | 1768 |
(...skipping 4552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6321 if (mag.shift > 0) sra(result, result, mag.shift); | 6321 if (mag.shift > 0) sra(result, result, mag.shift); |
6322 srl(at, dividend, 31); | 6322 srl(at, dividend, 31); |
6323 Addu(result, result, Operand(at)); | 6323 Addu(result, result, Operand(at)); |
6324 } | 6324 } |
6325 | 6325 |
6326 | 6326 |
6327 } // namespace internal | 6327 } // namespace internal |
6328 } // namespace v8 | 6328 } // namespace v8 |
6329 | 6329 |
6330 #endif // V8_TARGET_ARCH_MIPS64 | 6330 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |