Bug 921490 - Ionmonkey ARM: fix the negative zero check path in convertFloat32ToInt32. r=mjrosenb
authorDouglas Crosher <dtc-moz@scieneer.com>
Sat, 28 Sep 2013 00:36:51 +1000
changeset 149264 3e90742978ec6ed71b13fb263ad8d2b672217c52
parent 149263 3f5260dff279ea34445969a0a6cb92ec3bac98f0
child 149265 ea609cf06b4e4f3db464d64437e818b966590c9a
push id34512
push userryanvm@gmail.com
push dateMon, 30 Sep 2013 15:57:08 +0000
treeherdermozilla-inbound@ea609cf06b4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmjrosenb
bugs921490
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 921490 - Ionmonkey ARM: fix the negative zero check path in convertFloat32ToInt32. r=mjrosenb
js/src/jit/arm/MacroAssembler-arm.cpp
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -87,17 +87,18 @@ MacroAssemblerARM::branchTruncateDouble(
     ma_cmp(dest, Imm32(0x80000000), Assembler::NotEqual);
     ma_b(fail, Assembler::Equal);
 }
 
 // Checks whether a double 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
-MacroAssemblerARM::convertDoubleToInt32(const FloatRegister &src, const Register &dest, Label *fail, bool negativeZeroCheck)
+MacroAssemblerARM::convertDoubleToInt32(const FloatRegister &src, const Register &dest,
+                                        Label *fail, bool negativeZeroCheck)
 {
     // convert the floating point value to an integer, if it did not fit,
     //     then when we convert it *back* to  a float, it will have a
     //     different value, which we can test.
     ma_vcvt_F64_I32(src, ScratchFloatReg);
     // move the value into the dest register.
     ma_vxfer(ScratchFloatReg, dest);
     ma_vcvt_I32_F64(ScratchFloatReg, ScratchFloatReg);
@@ -115,35 +116,36 @@ MacroAssemblerARM::convertDoubleToInt32(
         ma_b(fail, Assembler::Equal);
     }
 }
 
 // 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
-MacroAssemblerARM::convertFloat32ToInt32(const FloatRegister &src, const Register &dest, Label *fail, bool negativeZeroCheck)
+MacroAssemblerARM::convertFloat32ToInt32(const FloatRegister &src, const Register &dest,
+                                         Label *fail, bool negativeZeroCheck)
 {
     // convert the floating point value to an integer, if it did not fit,
     //     then when we convert it *back* to  a float, it will have a
     //     different value, which we can test.
     ma_vcvt_F32_I32(src, ScratchFloatReg);
     // move the value into the dest register.
     ma_vxfer(ScratchFloatReg, dest);
     ma_vcvt_I32_F32(ScratchFloatReg, ScratchFloatReg);
     ma_vcmp_f32(src, ScratchFloatReg);
     as_vmrs(pc);
     ma_b(fail, Assembler::VFP_NotEqualOrUnordered);
 
     if (negativeZeroCheck) {
         ma_cmp(dest, Imm32(0));
         // Test and bail for -0.0, when integer result is 0
-        // Move the top word of the double into the output reg, if it is non-zero,
-        // then the original value was -0.0
-        as_vxfer(dest, InvalidReg, src, FloatToCore, Assembler::Equal, 0);
+        // Move the float into the output reg, and if it is non-zero then
+        // the original value was -0.0
+        as_vxfer(dest, InvalidReg, VFPRegister(src).singleOverlay(), FloatToCore, Assembler::Equal, 0);
         ma_cmp(dest, Imm32(0x80000000), Assembler::Equal);
         ma_b(fail, Assembler::Equal);
     }
 }
 
 void
 MacroAssemblerARM::convertFloatToDouble(const FloatRegister &src, const FloatRegister &dest) {
     as_vcvt(VFPRegister(dest), VFPRegister(src).singleOverlay());