Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index c8ae983d502fa04f3723dc6dc195a960fdc68bd5..6307e526c83865d30cacfe6fd4248e48ad7337c0 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -1623,6 +1623,12 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, |
mtc1(t8, fd); |
} |
+void MacroAssembler::Trunc_ul_d(FPURegister fd, FPURegister fs, |
+ FPURegister scratch) { |
+ Trunc_ul_d(fs, t8, scratch); |
+ dmtc1(t8, fd); |
+} |
+ |
void MacroAssembler::Trunc_w_d(FPURegister fd, FPURegister fs) { |
trunc_w_d(fd, fs); |
@@ -1677,6 +1683,37 @@ void MacroAssembler::Trunc_uw_d(FPURegister fd, |
} |
+void MacroAssembler::Trunc_ul_d(FPURegister fd, Register rs, |
+ FPURegister scratch) { |
+ DCHECK(!fd.is(scratch)); |
+ DCHECK(!rs.is(at)); |
+ |
+ // Load 2^63 into scratch as its float representation. |
+ li(at, 0x43e0000000000000); |
+ dmtc1(at, scratch); |
+ |
+ // Test if scratch > fd. |
+ // If fd < 2^63 we can convert it normally. |
+ Label simple_convert, done; |
+ BranchF(&simple_convert, NULL, lt, fd, scratch); |
+ |
+ // First we subtract 2^63 from fd, then trunc it to rs |
+ // and add 2^63 to rs. |
+ sub_d(scratch, fd, scratch); |
+ trunc_l_d(scratch, scratch); |
+ dmfc1(rs, scratch); |
+ Or(rs, rs, Operand(1UL << 63)); |
Alan Li
2015/11/20 13:35:22
maybe splitting the Or into LI and ORI, and put OR
|
+ Branch(&done); |
+ |
+ // Simple conversion. |
+ bind(&simple_convert); |
+ trunc_l_d(scratch, fd); |
+ dmfc1(rs, scratch); |
+ |
+ bind(&done); |
+} |
+ |
+ |
void MacroAssembler::Madd_d(FPURegister fd, FPURegister fr, FPURegister fs, |
FPURegister ft, FPURegister scratch) { |
if (0) { // TODO(plind): find reasonable arch-variant symbol names. |