Bug 1290812 - Part 37: Implement the 64bit variant of ToFloatingPoint on mips32. r=sunfish

---
 js/src/jit/mips32/CodeGenerator-mips32.cpp | 30 ++++++++++++++++++++++++++++++
 js/src/jit/mips32/CodeGenerator-mips32.h   |  1 +
 js/src/jit/mips32/LOpcodes-mips32.h        |  3 ++-
 js/src/jit/mips32/Simulator-mips32.cpp     |  7 +++++++
 4 files changed, 40 insertions(+), 1 deletion(-)
This commit is contained in:
Shi Dan 2016-10-10 17:08:36 +08:00
parent 9934941ceb
commit c922f6f49f
4 changed files with 40 additions and 1 deletions

View File

@ -544,6 +544,36 @@ CodeGeneratorMIPS::visitWasmTruncateToInt64(LWasmTruncateToInt64* lir)
MOZ_ASSERT(ReturnReg64 == output);
}
void
CodeGeneratorMIPS::visitInt64ToFloatingPoint(LInt64ToFloatingPoint* lir)
{
Register64 input = ToRegister64(lir->getInt64Operand(0));
FloatRegister output = ToFloatRegister(lir->output());
MInt64ToFloatingPoint* mir = lir->mir();
MIRType toType = mir->type();
AllocatableGeneralRegisterSet regs(GeneralRegisterSet::All());
regs.take(input.low);
regs.take(input.high);
Register temp = regs.takeAny();
masm.setupUnalignedABICall(temp);
masm.passABIArg(input.high);
masm.passABIArg(input.low);
if (lir->mir()->isUnsigned())
masm.callWithABI(wasm::SymbolicAddress::Uint64ToFloatingPoint, MoveOp::DOUBLE);
else
masm.callWithABI(wasm::SymbolicAddress::Int64ToFloatingPoint, MoveOp::DOUBLE);
MOZ_ASSERT_IF(toType == MIRType::Double, output == ReturnDoubleReg);
if (toType == MIRType::Float32) {
MOZ_ASSERT(output == ReturnFloat32Reg);
masm.convertDoubleToFloat32(ReturnDoubleReg, output);
}
}
void
CodeGeneratorMIPS::setReturnDoubleRegs(LiveRegisterSet* regs)
{

View File

@ -48,6 +48,7 @@ class CodeGeneratorMIPS : public CodeGeneratorMIPSShared
void visitCtzI64(LCtzI64* ins);
void visitNotI64(LNotI64* ins);
void visitWasmTruncateToInt64(LWasmTruncateToInt64* ins);
void visitInt64ToFloatingPoint(LInt64ToFloatingPoint* lir);
// Out of line visitors.
void visitOutOfLineBailout(OutOfLineBailout* ool);

View File

@ -15,6 +15,7 @@
_(UDivOrMod) \
_(DivOrModI64) \
_(UDivOrModI64) \
_(WasmTruncateToInt64)
_(WasmTruncateToInt64) \
_(Int64ToFloatingPoint)
#endif // jit_mips32_LOpcodes_mips32_h__

View File

@ -1826,6 +1826,7 @@ typedef int32_t (*Prototype_Int_IntDoubleIntInt)(int32_t arg0, double arg1, int3
typedef float (*Prototype_Float32_Float32)(float arg0);
typedef double (*Prototype_DoubleInt)(double arg0, int32_t arg1);
typedef double (*Prototype_Double_IntInt)(int32_t arg0, int32_t arg1);
typedef double (*Prototype_Double_IntDouble)(int32_t arg0, double arg1);
typedef double (*Prototype_Double_DoubleDouble)(double arg0, double arg1);
typedef int32_t (*Prototype_Int_IntDouble)(int32_t arg0, double arg1);
@ -1988,6 +1989,12 @@ Simulator::softwareInterrupt(SimInstruction* instr)
setCallResultDouble(dresult);
break;
}
case Args_Double_IntInt: {
Prototype_Double_IntInt target = reinterpret_cast<Prototype_Double_IntInt>(external);
double dresult = target(arg0, arg1);
setCallResultDouble(dresult);
break;
}
case Args_Double_DoubleInt: {
double dval0, dval1;
int32_t ival;