Bug 1199565 - IonMonkey: MIPS32: Clampped float32-to-int32 conversions should bailout on MIPS. r=nbp

This commit is contained in:
Heiher 2015-08-27 23:31:00 +02:00
Родитель 9bf32f2bda
Коммит ebafe2fbba
1 изменённых файлов: 8 добавлений и 3 удалений

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

@ -151,14 +151,19 @@ void
MacroAssemblerMIPS::convertFloat32ToInt32(FloatRegister src, Register dest, MacroAssemblerMIPS::convertFloat32ToInt32(FloatRegister src, Register dest,
Label* fail, bool negativeZeroCheck) Label* fail, bool negativeZeroCheck)
{ {
// convert the floating point value to an integer, if it did not fit, then // Converting the floating point value to an integer and then converting it
// when we convert it *back* to a float, it will have a different value, // back to a float32 would not work, as float to int32 conversions are
// which we can test. // clamping (e.g. float(INT32_MAX + 1) would get converted into INT32_MAX
// and then back to float(INT32_MAX + 1)). If this ever happens, we just
// bail out.
as_cvtws(ScratchFloat32Reg, src); as_cvtws(ScratchFloat32Reg, src);
as_mfc1(dest, ScratchFloat32Reg); as_mfc1(dest, ScratchFloat32Reg);
as_cvtsw(ScratchFloat32Reg, ScratchFloat32Reg); as_cvtsw(ScratchFloat32Reg, ScratchFloat32Reg);
ma_bc1s(src, ScratchFloat32Reg, fail, Assembler::DoubleNotEqualOrUnordered); ma_bc1s(src, ScratchFloat32Reg, fail, Assembler::DoubleNotEqualOrUnordered);
// Bail out in the clamped cases.
ma_b(dest, Imm32(INT32_MAX), fail, Assembler::Equal);
if (negativeZeroCheck) { if (negativeZeroCheck) {
Label notZero; Label notZero;
ma_b(dest, Imm32(0), &notZero, Assembler::NotEqual, ShortJump); ma_b(dest, Imm32(0), &notZero, Assembler::NotEqual, ShortJump);