Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: src/mips64/macro-assembler-mips64.cc

Issue 1507703002: [turbofan] Change TruncateFloat64ToUint64 to TryTruncateFloatToUint64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added mips64 implementation, fixed nits. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 1624
1625 1625
1626 void MacroAssembler::Trunc_uw_d(FPURegister fd, 1626 void MacroAssembler::Trunc_uw_d(FPURegister fd,
1627 FPURegister fs, 1627 FPURegister fs,
1628 FPURegister scratch) { 1628 FPURegister scratch) {
1629 Trunc_uw_d(fs, t8, scratch); 1629 Trunc_uw_d(fs, t8, scratch);
1630 mtc1(t8, fd); 1630 mtc1(t8, fd);
1631 } 1631 }
1632 1632
1633 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, 1633 void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs,
1634 FPURegister scratch) { 1634 FPURegister scratch, Register result) {
1635 Trunc_ul_d(fs, t8, scratch); 1635 Trunc_ul_d(fs, t8, scratch, result);
1636 dmtc1(t8, fd); 1636 dmtc1(t8, fd);
1637 } 1637 }
1638 1638
1639 1639
1640 void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs, 1640 void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs,
1641 FPURegister scratch) { 1641 FPURegister scratch) {
1642 Trunc_ul_s(fs, t8, scratch); 1642 Trunc_ul_s(fs, t8, scratch);
1643 dmtc1(t8, fd); 1643 dmtc1(t8, fd);
1644 } 1644 }
1645 1645
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 // Simple conversion. 1691 // Simple conversion.
1692 bind(&simple_convert); 1692 bind(&simple_convert);
1693 trunc_w_d(scratch, fd); 1693 trunc_w_d(scratch, fd);
1694 mfc1(rs, scratch); 1694 mfc1(rs, scratch);
1695 1695
1696 bind(&done); 1696 bind(&done);
1697 } 1697 }
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) { 1701 FPURegister scratch, Register result) {
1702 DCHECK(!fd.is(scratch)); 1702 DCHECK(!fd.is(scratch));
1703 DCHECK(!rs.is(at)); 1703 DCHECK(!AreAliased(rs, result, at));
1704
1705 if (result.is_valid()) {
1706 mov(result, zero_reg);
1707 Move(kDoubleRegZero, 0.0);
1708 }
1704 1709
1705 // Load 2^63 into scratch as its double representation. 1710 // Load 2^63 into scratch as its double representation.
1706 li(at, 0x43e0000000000000); 1711 li(at, 0x43e0000000000000);
1707 dmtc1(at, scratch); 1712 dmtc1(at, scratch);
1708 1713
1709 // Test if scratch > fd. 1714 // Test if scratch > fd.
1710 // If fd < 2^63 we can convert it normally. 1715 // If fd < 2^63 we can convert it normally.
1711 Label simple_convert, done; 1716 // If fd is unordered the conversion fails.
1712 BranchF(&simple_convert, NULL, lt, fd, scratch); 1717 Label simple_convert, done, fail;
1718 BranchF(&simple_convert, &fail, lt, fd, scratch);
1713 1719
1714 // First we subtract 2^63 from fd, then trunc it to rs 1720 // First we subtract 2^63 from fd, then trunc it to rs
1715 // and add 2^63 to rs. 1721 // and add 2^63 to rs.
1716 sub_d(scratch, fd, scratch); 1722 sub_d(scratch, fd, scratch);
1717 trunc_l_d(scratch, scratch); 1723 trunc_l_d(scratch, scratch);
1718 dmfc1(rs, scratch); 1724 dmfc1(rs, scratch);
1719 Or(rs, rs, Operand(1UL << 63)); 1725 Or(rs, rs, Operand(1UL << 63));
1720 Branch(&done); 1726 Branch(&done);
1721 1727
1722 // Simple conversion. 1728 // Simple conversion.
1723 bind(&simple_convert); 1729 bind(&simple_convert);
1724 trunc_l_d(scratch, fd); 1730 trunc_l_d(scratch, fd);
1725 dmfc1(rs, scratch); 1731 dmfc1(rs, scratch);
1726 1732
1727 bind(&done); 1733 bind(&done);
1734 if (result.is_valid()) {
1735 // Conversion is failed if the result is negative or unordered.
1736 BranchF(&fail, &fail, lt, scratch, kDoubleRegZero);
1737 li(result, Operand(1));
1738 }
1739
1740 bind(&fail);
1728 } 1741 }
1729 1742
1730 1743
1731 void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs, 1744 void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs,
1732 FPURegister scratch) { 1745 FPURegister scratch) {
1733 DCHECK(!fd.is(scratch)); 1746 DCHECK(!fd.is(scratch));
1734 DCHECK(!rs.is(at)); 1747 DCHECK(!rs.is(at));
1735 1748
1736 // Load 2^63 into scratch as its float representation. 1749 // Load 2^63 into scratch as its float representation.
1737 li(at, 0x5f000000); 1750 li(at, 0x5f000000);
(...skipping 4548 matching lines...) Expand 10 before | Expand all | Expand 10 after
6286 if (mag.shift > 0) sra(result, result, mag.shift); 6299 if (mag.shift > 0) sra(result, result, mag.shift);
6287 srl(at, dividend, 31); 6300 srl(at, dividend, 31);
6288 Addu(result, result, Operand(at)); 6301 Addu(result, result, Operand(at));
6289 } 6302 }
6290 6303
6291 6304
6292 } // namespace internal 6305 } // namespace internal
6293 } // namespace v8 6306 } // namespace v8
6294 6307
6295 #endif // V8_TARGET_ARCH_MIPS64 6308 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/mips64/macro-assembler-mips64.h ('k') | test/cctest/compiler/test-run-machops.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698