Bug 1464366 : [MIPS] Provide implementation for CodeGenerator::visitTrunc{F}; r=jandem

--HG--
extra : rebase_source : 11facc1f91e4a3155be8067e2293ff6001ee41b7
This commit is contained in:
Dragan Mladjenovic 2018-05-25 12:31:12 +02:00
Родитель b669b4de9c
Коммит c2ed3aa9cb
1 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -1455,13 +1455,43 @@ CodeGenerator::visitRoundF(LRoundF* lir)
void
CodeGenerator::visitTrunc(LTrunc* lir)
{
MOZ_CRASH("visitTrunc");
FloatRegister input = ToFloatRegister(lir->input());
Register output = ToRegister(lir->output());
Label notZero;
masm.as_truncwd(ScratchFloat32Reg, input);
masm.as_cfc1(ScratchRegister, Assembler::FCSR);
masm.moveFromFloat32(ScratchFloat32Reg, output);
masm.ma_ext(ScratchRegister, ScratchRegister, Assembler::CauseV, 1);
masm.ma_b(output, Imm32(0), &notZero, Assembler::NotEqual, ShortJump);
masm.moveFromDoubleHi(input, ScratchRegister);
// Check if input is in ]-1; -0] range by checking the sign bit.
masm.as_slt(ScratchRegister, ScratchRegister, zero);
masm.bind(&notZero);
bailoutCmp32(Assembler::NotEqual, ScratchRegister, Imm32(0), lir->snapshot());
}
void
CodeGenerator::visitTruncF(LTruncF* lir)
{
MOZ_CRASH("visitTruncF");
FloatRegister input = ToFloatRegister(lir->input());
Register output = ToRegister(lir->output());
Label notZero;
masm.as_truncws(ScratchFloat32Reg, input);
masm.as_cfc1(ScratchRegister, Assembler::FCSR);
masm.moveFromFloat32(ScratchFloat32Reg, output);
masm.ma_ext(ScratchRegister, ScratchRegister, Assembler::CauseV, 1);
masm.ma_b(output, Imm32(0), &notZero, Assembler::NotEqual, ShortJump);
masm.moveFromFloat32(input, ScratchRegister);
// Check if input is in ]-1; -0] range by checking the sign bit.
masm.as_slt(ScratchRegister, ScratchRegister, zero);
masm.bind(&notZero);
bailoutCmp32(Assembler::NotEqual, ScratchRegister, Imm32(0), lir->snapshot());
}
void