diff --git a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp index 10d411bc132f..249872d0bb7b 100644 --- a/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp +++ b/js/src/jit/mips-shared/CodeGenerator-mips-shared.cpp @@ -1132,12 +1132,14 @@ void CodeGenerator::visitTruncateFToInt32(LTruncateFToInt32* ins) { void CodeGenerator::visitWasmBuiltinTruncateDToInt32( LWasmBuiltinTruncateDToInt32* lir) { - MOZ_CRASH("NYI"); + emitTruncateDouble(ToFloatRegister(lir->getOperand(0)), + ToRegister(lir->getDef(0)), lir->mir()); } void CodeGenerator::visitWasmBuiltinTruncateFToInt32( LWasmBuiltinTruncateFToInt32* lir) { - MOZ_CRASH("NYI"); + emitTruncateFloat32(ToFloatRegister(lir->getOperand(0)), + ToRegister(lir->getDef(0)), lir->mir()); } void CodeGenerator::visitWasmTruncateToInt32(LWasmTruncateToInt32* lir) { diff --git a/js/src/jit/mips-shared/Lowering-mips-shared.cpp b/js/src/jit/mips-shared/Lowering-mips-shared.cpp index a6f054d58ec3..9b3eec2abe74 100644 --- a/js/src/jit/mips-shared/Lowering-mips-shared.cpp +++ b/js/src/jit/mips-shared/Lowering-mips-shared.cpp @@ -182,7 +182,21 @@ void LIRGeneratorMIPSShared::lowerForBitAndAndBranch(LBitAndAndBranch* baab, void LIRGeneratorMIPSShared::lowerWasmBuiltinTruncateToInt32( MWasmBuiltinTruncateToInt32* ins) { - MOZ_CRASH("NYI"); + MDefinition* opd = ins->input(); + MOZ_ASSERT(opd->type() == MIRType::Double || opd->type() == MIRType::Float32); + + if (opd->type() == MIRType::Double) { + define(new (alloc()) LWasmBuiltinTruncateDToInt32( + useRegister(opd), useFixed(ins->tls(), WasmTlsReg), + LDefinition::BogusTemp()), + ins); + return; + } + + define(new (alloc()) LWasmBuiltinTruncateFToInt32( + useRegister(opd), useFixed(ins->tls(), WasmTlsReg), + LDefinition::BogusTemp()), + ins); } void LIRGeneratorMIPSShared::lowerForShift(LInstructionHelper<1, 2, 0>* ins,