MIPS: math-emu: Update sNaN quieting handlers
authorMaciej W. Rozycki <macro@linux-mips.org>
Fri, 3 Apr 2015 22:25:18 +0000 (23:25 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 7 Apr 2015 23:09:23 +0000 (01:09 +0200)
Commit fdffbafb [Lots of FPU bug fixes from Kjeld Borch Egevang.]
replaced the two single `ieee754sp_nanxcpt' and `ieee754dp_nanxcpt'
places, where sNaN quieting used to happen for single and double
floating-point operations respectively, with individual qNaN
instantiations across all the call sites instead.  It also made most of
these two functions dead code as where called on a qNaN they return
right away.

To revert the damage and make sNaN quieting uniform again first rewrite
`ieee754sp_nanxcpt' and `ieee754dp_nanxcpt' to do the same quieting all
the call sites do, that is return the default qNaN encoding for all
input sNaN values; never propagate any sNaN payload bits from its
trailing significand field.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9685/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/math-emu/ieee754dp.c
arch/mips/math-emu/ieee754sp.c

index 068f45a415fc663fc6b917d6d79027c371042d87..9723a518e5ade80ccf6e61bf3194d67321d34815 100644 (file)
@@ -49,14 +49,9 @@ union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r)
        if (!ieee754dp_issnan(r))       /* QNAN does not cause invalid op !! */
                return r;
 
-       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) {
-               /* not enabled convert to a quiet NaN */
-               DPMANT(r) &= (~DP_MBIT(DP_FBITS-1));
-               if (ieee754dp_isnan(r))
-                       return r;
-               else
-                       return ieee754dp_indef();
-       }
+       /* If not enabled convert to a quiet NaN.  */
+       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
+               return ieee754dp_indef();
 
        return r;
 }
index ba88301579c2450cf4b647358cbdeea4978804a2..7bde3c204d02d30a8886f334c1d9a03629245ce0 100644 (file)
@@ -49,14 +49,9 @@ union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r)
        if (!ieee754sp_issnan(r))       /* QNAN does not cause invalid op !! */
                return r;
 
-       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) {
-               /* not enabled convert to a quiet NaN */
-               SPMANT(r) &= (~SP_MBIT(SP_FBITS-1));
-               if (ieee754sp_isnan(r))
-                       return r;
-               else
-                       return ieee754sp_indef();
-       }
+       /* If not enabled convert to a quiet NaN.  */
+       if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
+               return ieee754sp_indef();
 
        return r;
 }
This page took 0.025443 seconds and 5 git commands to generate.