Bug 1465770 - mips32: convertDoubleToInt32 cp1_fcsr error. r=dragan.mladjenovic, a=RyanVM DEVEDITION_61_0b12_BUILD1 DEVEDITION_61_0b12_RELEASE FENNEC_61_0b12_BUILD1 FENNEC_61_0b12_RELEASE FIREFOX_61_0b12_BUILD1 FIREFOX_61_0b12_RELEASE
authorqiaopengcheng <qiaopengcheng-hf@loongson.cn>
Fri, 01 Jun 2018 02:58:00 -0400
changeset 473651 873262bdac1b9da93249e77d53aefdf2f57d84de
parent 473650 05b0e87031530e7116669074028714e58dec721a
child 473652 d1d9943ef3f54aa6b3b7d216a521790c4bbdec31
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdragan, RyanVM
bugs1465770
milestone61.0
Bug 1465770 - mips32: convertDoubleToInt32 cp1_fcsr error. r=dragan.mladjenovic, a=RyanVM
js/src/jit/mips32/MacroAssembler-mips32.cpp
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -127,21 +127,26 @@ MacroAssemblerMIPSCompat::convertDoubleT
     if (negativeZeroCheck) {
         moveFromDoubleHi(src, dest);
         moveFromDoubleLo(src, SecondScratchReg);
         ma_xor(dest, Imm32(INT32_MIN));
         ma_or(dest, SecondScratchReg);
         ma_b(dest, Imm32(0), fail, Assembler::Equal);
     }
 
-    // Truncate double to int ; if result is inexact fail
+    // Truncate double to int ; if result is inexact or invalid fail.
     as_truncwd(ScratchFloat32Reg, src);
     as_cfc1(ScratchRegister, Assembler::FCSR);
     moveFromFloat32(ScratchFloat32Reg, dest);
-    ma_ext(ScratchRegister, ScratchRegister, Assembler::CauseI, 1);
+    ma_ext(ScratchRegister, ScratchRegister, Assembler::CauseI, 6);
+    // Here adding the masking andi instruction just for a precaution.
+    // For the instruction of trunc.*.*, the Floating Point Exceptions can be
+    // only Inexact, Invalid Operation, Unimplemented Operation.
+    // Leaving it maybe is also ok.
+    as_andi(ScratchRegister, ScratchRegister, 0x11);
     ma_b(ScratchRegister, Imm32(0), fail, Assembler::NotEqual);
 }
 
 // Checks whether a float32 is representable as a 32-bit integer. If so, the
 // integer is written to the output register. Otherwise, a bailout is taken to
 // the given snapshot. This function overwrites the scratch float register.
 void
 MacroAssemblerMIPSCompat::convertFloat32ToInt32(FloatRegister src, Register dest,