MIPS64: [turbofan] Implemented the TruncateFloat64ToUint64 TurboFan operator.
Port f6e689cebb
BUG=
Review URL: https://codereview.chromium.org/1463193002
Cr-Commit-Position: refs/heads/master@{#32147}
This commit is contained in:
parent
9951a617d5
commit
05f01e69c3
@ -987,6 +987,12 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
||||
__ Trunc_uw_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch);
|
||||
break;
|
||||
}
|
||||
case kMips64TruncUlD: {
|
||||
FPURegister scratch = kScratchDoubleReg;
|
||||
// TODO(plind): Fix wrong param order of Trunc_ul_d() macro-asm function.
|
||||
__ Trunc_ul_d(i.InputDoubleRegister(0), i.OutputRegister(), scratch);
|
||||
break;
|
||||
}
|
||||
case kMips64BitcastDL:
|
||||
__ dmfc1(i.OutputRegister(), i.InputDoubleRegister(0));
|
||||
break;
|
||||
|
@ -76,6 +76,7 @@ namespace compiler {
|
||||
V(Mips64TruncWD) \
|
||||
V(Mips64TruncLD) \
|
||||
V(Mips64TruncUwD) \
|
||||
V(Mips64TruncUlD) \
|
||||
V(Mips64CvtDW) \
|
||||
V(Mips64CvtSL) \
|
||||
V(Mips64CvtSUl) \
|
||||
|
@ -713,7 +713,7 @@ void InstructionSelector::VisitTruncateFloat64ToInt64(Node* node) {
|
||||
|
||||
|
||||
void InstructionSelector::VisitTruncateFloat64ToUint64(Node* node) {
|
||||
UNIMPLEMENTED();
|
||||
VisitRR(this, kMips64TruncUlD, node);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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));
|
||||
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.
|
||||
|
@ -838,6 +838,10 @@ class MacroAssembler: public Assembler {
|
||||
void Trunc_uw_d(FPURegister fd, FPURegister fs, FPURegister scratch);
|
||||
void Trunc_uw_d(FPURegister fd, Register rs, FPURegister scratch);
|
||||
|
||||
// Convert double to unsigned long.
|
||||
void Trunc_ul_d(FPURegister fd, FPURegister fs, FPURegister scratch);
|
||||
void Trunc_ul_d(FPURegister fd, Register rs, FPURegister scratch);
|
||||
|
||||
void Trunc_w_d(FPURegister fd, FPURegister fs);
|
||||
void Round_w_d(FPURegister fd, FPURegister fs);
|
||||
void Floor_w_d(FPURegister fd, FPURegister fs);
|
||||
|
Loading…
Reference in New Issue
Block a user