mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
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:
parent
246c121179
commit
9aa36719a4
@ -1202,8 +1202,8 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||||||
|
|
||||||
Label bail, negative, end, skipCheck;
|
Label bail, negative, end, skipCheck;
|
||||||
|
|
||||||
// Load 0.5 in the temp register.
|
// Load biggest number less than 0.5 in the temp register.
|
||||||
masm.loadConstantDouble(0.5, temp);
|
masm.loadConstantDouble(GetBiggestNumberLessThan(0.5), temp);
|
||||||
|
|
||||||
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
||||||
masm.loadConstantDouble(0.0, scratch);
|
masm.loadConstantDouble(0.0, scratch);
|
||||||
@ -1221,8 +1221,7 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||||||
masm.ma_b(&end, ShortJump);
|
masm.ma_b(&end, ShortJump);
|
||||||
|
|
||||||
masm.bind(&skipCheck);
|
masm.bind(&skipCheck);
|
||||||
masm.loadConstantDouble(0.5, scratch);
|
masm.as_addd(scratch, input, temp);
|
||||||
masm.addDouble(input, scratch);
|
|
||||||
masm.as_floorwd(scratch, scratch);
|
masm.as_floorwd(scratch, scratch);
|
||||||
|
|
||||||
masm.moveFromDoubleLo(scratch, output);
|
masm.moveFromDoubleLo(scratch, output);
|
||||||
@ -1234,6 +1233,15 @@ CodeGeneratorMIPS::visitRound(LRound* lir)
|
|||||||
|
|
||||||
// Input is negative, but isn't -0.
|
// Input is negative, but isn't -0.
|
||||||
masm.bind(&negative);
|
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);
|
masm.addDouble(input, temp);
|
||||||
|
|
||||||
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
|
// 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;
|
Label bail, negative, end, skipCheck;
|
||||||
|
|
||||||
// Load 0.5 in the temp register.
|
// Load biggest number less than 0.5 in the temp register.
|
||||||
masm.loadConstantFloat32(0.5, temp);
|
masm.loadConstantFloat32(GetBiggestNumberLessThan(0.5f), temp);
|
||||||
|
|
||||||
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
// Branch to a slow path for negative inputs. Doesn't catch NaN or -0.
|
||||||
masm.loadConstantFloat32(0.0f, scratch);
|
masm.loadConstantFloat32(0.0f, scratch);
|
||||||
@ -1280,8 +1288,7 @@ CodeGeneratorMIPS::visitRoundF(LRoundF* lir)
|
|||||||
masm.ma_b(&end, ShortJump);
|
masm.ma_b(&end, ShortJump);
|
||||||
|
|
||||||
masm.bind(&skipCheck);
|
masm.bind(&skipCheck);
|
||||||
masm.loadConstantFloat32(0.5, scratch);
|
masm.as_adds(scratch, input, temp);
|
||||||
masm.as_adds(scratch, input, scratch);
|
|
||||||
masm.as_floorws(scratch, scratch);
|
masm.as_floorws(scratch, scratch);
|
||||||
|
|
||||||
masm.moveFromFloat32(scratch, output);
|
masm.moveFromFloat32(scratch, output);
|
||||||
@ -1293,6 +1300,15 @@ CodeGeneratorMIPS::visitRoundF(LRoundF* lir)
|
|||||||
|
|
||||||
// Input is negative, but isn't -0.
|
// Input is negative, but isn't -0.
|
||||||
masm.bind(&negative);
|
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);
|
masm.as_adds(temp, input, temp);
|
||||||
|
|
||||||
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
|
// If input + 0.5 >= 0, input is a negative number >= -0.5 and the
|
||||||
|
Loading…
Reference in New Issue
Block a user