aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2015-04-03 18:25:18 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-07 19:09:23 -0400
commitec98f9a01ffb23ea72471ccbc8c390c8c2e4c0b3 (patch)
tree585632947155b10025a4beaa749c9fd7cc9c8f7e
parent1f6d2c29b08bbd29a3d3b8476e9a26546e03104e (diff)
MIPS: math-emu: Update sNaN quieting handlers
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>
-rw-r--r--arch/mips/math-emu/ieee754dp.c11
-rw-r--r--arch/mips/math-emu/ieee754sp.c11
2 files changed, 6 insertions, 16 deletions
diff --git a/arch/mips/math-emu/ieee754dp.c b/arch/mips/math-emu/ieee754dp.c
index 068f45a415fc..9723a518e5ad 100644
--- a/arch/mips/math-emu/ieee754dp.c
+++ b/arch/mips/math-emu/ieee754dp.c
@@ -49,14 +49,9 @@ union ieee754dp __cold ieee754dp_nanxcpt(union ieee754dp r)
49 if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */ 49 if (!ieee754dp_issnan(r)) /* QNAN does not cause invalid op !! */
50 return r; 50 return r;
51 51
52 if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) { 52 /* If not enabled convert to a quiet NaN. */
53 /* not enabled convert to a quiet NaN */ 53 if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
54 DPMANT(r) &= (~DP_MBIT(DP_FBITS-1)); 54 return ieee754dp_indef();
55 if (ieee754dp_isnan(r))
56 return r;
57 else
58 return ieee754dp_indef();
59 }
60 55
61 return r; 56 return r;
62} 57}
diff --git a/arch/mips/math-emu/ieee754sp.c b/arch/mips/math-emu/ieee754sp.c
index ba88301579c2..7bde3c204d02 100644
--- a/arch/mips/math-emu/ieee754sp.c
+++ b/arch/mips/math-emu/ieee754sp.c
@@ -49,14 +49,9 @@ union ieee754sp __cold ieee754sp_nanxcpt(union ieee754sp r)
49 if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */ 49 if (!ieee754sp_issnan(r)) /* QNAN does not cause invalid op !! */
50 return r; 50 return r;
51 51
52 if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION)) { 52 /* If not enabled convert to a quiet NaN. */
53 /* not enabled convert to a quiet NaN */ 53 if (!ieee754_setandtestcx(IEEE754_INVALID_OPERATION))
54 SPMANT(r) &= (~SP_MBIT(SP_FBITS-1)); 54 return ieee754sp_indef();
55 if (ieee754sp_isnan(r))
56 return r;
57 else
58 return ieee754sp_indef();
59 }
60 55
61 return r; 56 return r;
62} 57}