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

Unified Diff: src/mips64/macro-assembler-mips64.cc

Issue 1512023002: [turbofan] Change TruncateFloat32ToUint64 to TryTruncateFloat32ToUint64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 280edf3a2407238df2abda21cc0485a68cf2de29..ea5f49bae3bc9213972becaf1e1688ea2bdbacf2 100644
--- a/src/mips64/macro-assembler-mips64.cc
+++ b/src/mips64/macro-assembler-mips64.cc
@@ -1638,8 +1638,8 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs,
void MacroAssembler::Trunc_ul_s(FPURegister fd, FPURegister fs,
- FPURegister scratch) {
- Trunc_ul_s(fs, t8, scratch);
+ FPURegister scratch, Register result) {
+ Trunc_ul_s(fs, t8, scratch, result);
dmtc1(t8, fd);
}
@@ -1702,9 +1702,11 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
DCHECK(!fd.is(scratch));
DCHECK(!AreAliased(rs, result, at));
+ Label simple_convert, done, fail;
if (result.is_valid()) {
mov(result, zero_reg);
Move(kDoubleRegZero, 0.0);
+ BranchF(&fail, &fail, lt, fd, kDoubleRegZero);
}
// Load 2^63 into scratch as its double representation.
@@ -1714,7 +1716,6 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
// Test if scratch > fd.
// If fd < 2^63 we can convert it normally.
// 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
@@ -1742,18 +1743,26 @@ void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs,
void MacroAssembler::Trunc_ul_s(FPURegister fd, Register rs,
- FPURegister scratch) {
+ FPURegister scratch, Register result) {
DCHECK(!fd.is(scratch));
- DCHECK(!rs.is(at));
+ DCHECK(!AreAliased(rs, result, at));
+
+ Label simple_convert, done, fail;
+ if (result.is_valid()) {
+ mov(result, zero_reg);
+ Move(kDoubleRegZero, 0.0);
+ // If fd < 0 or unordered, then the conversion fails.
+ BranchF32(&fail, &fail, lt, fd, kDoubleRegZero);
+ }
// Load 2^63 into scratch as its float representation.
li(at, 0x5f000000);
- dmtc1(at, scratch);
+ mtc1(at, scratch);
// Test if scratch > fd.
// If fd < 2^63 we can convert it normally.
- Label simple_convert, done;
- BranchF32(&simple_convert, NULL, lt, fd, scratch);
+ // // If fd is unordered the conversion fails.
+ BranchF32(&simple_convert, nullptr, lt, fd, scratch);
// First we subtract 2^63 from fd, then trunc it to rs
// and add 2^63 to rs.
@@ -1769,6 +1778,13 @@ void MacroAssembler::Trunc_ul_s(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);
ahaas 2015/12/09 17:10:01 @v8-mips-ports: originally I wanted to use BranchF
paul.l... 2015/12/10 06:51:57 This is clearly broken, but I could not spot the b
+ 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