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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/macro-assembler-mips64.cc
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc
index 9349781f9496dccb07d73abb0fd94bbc4e8d3db9..280edf3a2407238df2abda21cc0485a68cf2de29 100644
--- a/src/mips64/macro-assembler-mips64.cc
+++ b/src/mips64/macro-assembler-mips64.cc
@@ -1631,8 +1631,8 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd,
}
void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs,
- FPURegister scratch) {
- Trunc_ul_d(fs, t8, scratch);
+ FPURegister scratch, Register result) {
+ Trunc_ul_d(fs, t8, scratch, result);
dmtc1(t8, fd);
}
@@ -1698,9 +1698,14 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd,
void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
- FPURegister scratch) {
+ FPURegister scratch, Register result) {
DCHECK(!fd.is(scratch));
- DCHECK(!rs.is(at));
+ DCHECK(!AreAliased(rs, result, at));
+
+ if (result.is_valid()) {
+ mov(result, zero_reg);
+ Move(kDoubleRegZero, 0.0);
+ }
// Load 2^63 into scratch as its double representation.
li(at, 0x43e0000000000000);
@@ -1708,8 +1713,9 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
// Test if scratch > fd.
// If fd < 2^63 we can convert it normally.
- Label simple_convert, done;
- BranchF(&simple_convert, NULL, lt, fd, scratch);
+ // If fd is unordered the conversion fails.
+ Label simple_convert, done, fail;
+ BranchF(&simple_convert, &fail, lt, fd, scratch);
// First we subtract 2^63 from fd, then trunc it to rs
// and add 2^63 to rs.
@@ -1725,6 +1731,13 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
dmfc1(rs, scratch);
bind(&done);
+ if (result.is_valid()) {
+ // Conversion is failed if the result is negative or unordered.
+ BranchF(&fail, &fail, lt, scratch, kDoubleRegZero);
+ li(result, Operand(1));
+ }
+
+ bind(&fail);
}
« 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