зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1205232 - IonMonkey: MIPS32: Fix rounding of big negative float32 values in Ion. r=bbouvier
--- js/src/jit/mips32/CodeGenerator-mips32.cpp | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
This commit is contained in:
Родитель
80b101df19
Коммит
b64039b81e
|
@ -1202,8 +1202,8 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||
|
||||
Label bail, negative, end, skipCheck;
|
||||
|
||||
// Load 0.5 in the temp register.
|
||||
masm.loadConstantDouble(0.5, temp);
|
||||
// Load biggest number less than 0.5 in the temp register.
|
||||
masm.loadConstantDouble(GetBiggestNumberLessThan(0.5), temp);
|
||||
|
||||
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
||||
masm.loadConstantDouble(0.0, scratch);
|
||||
|
@ -1221,8 +1221,7 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||
masm.ma_b(&end, ShortJump);
|
||||
|
||||
masm.bind(&skipCheck);
|
||||
masm.loadConstantDouble(0.5, scratch);
|
||||
masm.addDouble(input, scratch);
|
||||
masm.as_addd(scratch, input, temp);
|
||||
masm.as_floorwd(scratch, scratch);
|
||||
|
||||
masm.moveFromDoubleLo(scratch, output);
|
||||
|
@ -1234,6 +1233,15 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||
|
||||
// Input is negative, but isn't -0.
|
||||
masm.bind(&negative);
|
||||
|
||||
// Inputs in ]-0.5; 0] need to be added 0.5, other negative inputs need to
|
||||
// be added the biggest double less than 0.5.
|
||||
Label loadJoin;
|
||||
masm.loadConstantDouble(-0.5, scratch);
|
||||
masm.branchDouble(Assembler::DoubleLessThan, input, scratch, &loadJoin);
|
||||
masm.loadConstantDouble(0.5, temp);
|
||||
masm.bind(&loadJoin);
|
||||
|
||||
masm.addDouble(input, temp);
|
||||
|
||||
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
|
||||
|
@ -1261,8 +1269,8 @@ CodeGeneratorMIPS::visitRoundF(LRoundF* lir)
|
|||
|
||||
Label bail, negative, end, skipCheck;
|
||||
|
||||
// Load 0.5 in the temp register.
|
||||
masm.loadConstantFloat32(0.5, temp);
|
||||
// Load biggest number less than 0.5 in the temp register.
|
||||
masm.loadConstantFloat32(GetBiggestNumberLessThan(0.5f), temp);
|
||||
|
||||
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
||||
masm.loadConstantFloat32(0.0f, scratch);
|
||||
|
@ -1280,8 +1288,7 @@ CodeGeneratorMIPS::visitRoundF(LRoundF* lir)
|
|||
masm.ma_b(&end, ShortJump);
|
||||
|
||||
masm.bind(&skipCheck);
|
||||
masm.loadConstantFloat32(0.5, scratch);
|
||||
masm.as_adds(scratch, input, scratch);
|
||||
masm.as_adds(scratch, input, temp);
|
||||
masm.as_floorws(scratch, scratch);
|
||||
|
||||
masm.moveFromFloat32(scratch, output);
|
||||
|
@ -1293,6 +1300,15 @@ CodeGeneratorMIPS::visitRoundF(LRoundF* lir)
|
|||
|
||||
// Input is negative, but isn't -0.
|
||||
masm.bind(&negative);
|
||||
|
||||
// Inputs in ]-0.5; 0] need to be added 0.5, other negative inputs need to
|
||||
// be added the biggest double less than 0.5.
|
||||
Label loadJoin;
|
||||
masm.loadConstantFloat32(-0.5f, scratch);
|
||||
masm.branchFloat(Assembler::DoubleLessThan, input, scratch, &loadJoin);
|
||||
masm.loadConstantFloat32(0.5f, temp);
|
||||
masm.bind(&loadJoin);
|
||||
|
||||
masm.as_adds(temp, input, temp);
|
||||
|
||||
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
|
||||
|
|
Загрузка…
Ссылка в новой задаче