[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170721144504.GJ6973@jhogan-linux.le.imgtec.org>
Date: Fri, 21 Jul 2017 15:45:04 +0100
From: James Hogan <james.hogan@...tec.com>
To: Aleksandar Markovic <aleksandar.markovic@...rk.com>
CC: <linux-mips@...ux-mips.org>,
Aleksandar Markovic <aleksandar.markovic@...tec.com>,
Miodrag Dinic <miodrag.dinic@...tec.com>,
Goran Ferenc <goran.ferenc@...tec.com>,
Douglas Leung <douglas.leung@...tec.com>,
<linux-kernel@...r.kernel.org>,
Paul Burton <paul.burton@...tec.com>,
Petar Jovanovic <petar.jovanovic@...tec.com>,
Raghu Gandham <raghu.gandham@...tec.com>,
Ralf Baechle <ralf@...ux-mips.org>
Subject: Re: [PATCH v3 05/16] MIPS: math-emu: <MAX|MAXA|MIN|MINA>.<D|S>: Fix
quiet NaN propagation
On Fri, Jul 21, 2017 at 04:09:03PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@...tec.com>
>
> Fix the value returned by <MAX|MAXA|MIN|MINA>.<D|S>, if both inputs
> are quiet NaNs. The specifications of <MAX|MAXA|MIN|MINA>.<D|S> state
> that the returned value in such cases should be the quiet NaN
> contained in register fs.
>
> The relevant example:
>
> MAX.S fd,fs,ft:
> If fs contains qNaN1, and ft contains qNaN2, fd is going to contain
> qNaN1 (without this patch, it used to contain qNaN2).
>
Consider adding:
Fixes: a79f5f9ba508 ("MIPS: math-emu: Add support for the MIPS R6 MAX{, A} FPU instruction")
Fixes: 4e9561b20e2f ("MIPS: math-emu: Add support for the MIPS R6 MIN{, A} FPU instruction")
> Signed-off-by: Miodrag Dinic <miodrag.dinic@...tec.com>
> Signed-off-by: Goran Ferenc <goran.ferenc@...tec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@...tec.com>
Consider adding:
Cc: <stable@...r.kernel.org> # 4.3+
> ---
> arch/mips/math-emu/dp_fmax.c | 8 ++++++--
> arch/mips/math-emu/dp_fmin.c | 8 ++++++--
> arch/mips/math-emu/sp_fmax.c | 8 ++++++--
> arch/mips/math-emu/sp_fmin.c | 8 ++++++--
> 4 files changed, 24 insertions(+), 8 deletions(-)
>
> diff --git a/arch/mips/math-emu/dp_fmax.c b/arch/mips/math-emu/dp_fmax.c
> index fd71b8d..567fc33 100644
> --- a/arch/mips/math-emu/dp_fmax.c
> +++ b/arch/mips/math-emu/dp_fmax.c
> @@ -47,6 +47,9 @@ union ieee754dp ieee754dp_fmax(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754dp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
couldn't the above...
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -54,7 +57,6 @@ union ieee754dp ieee754dp_fmax(union ieee754dp x, union ieee754dp y)
... go somewhere around here and fall through to the existing return x
case?
and same below of course.
Otherwise:
Reviewed-by: James Hogan <james.hogan@...tec.com>
Cheers
James
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> @@ -147,6 +149,9 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754dp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -154,7 +159,6 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> diff --git a/arch/mips/math-emu/dp_fmin.c b/arch/mips/math-emu/dp_fmin.c
> index c1072b0..77f7ca9 100644
> --- a/arch/mips/math-emu/dp_fmin.c
> +++ b/arch/mips/math-emu/dp_fmin.c
> @@ -47,6 +47,9 @@ union ieee754dp ieee754dp_fmin(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754dp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -54,7 +57,6 @@ union ieee754dp ieee754dp_fmin(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> @@ -147,6 +149,9 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754dp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -154,7 +159,6 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> diff --git a/arch/mips/math-emu/sp_fmax.c b/arch/mips/math-emu/sp_fmax.c
> index 4d00084..d46e8e4 100644
> --- a/arch/mips/math-emu/sp_fmax.c
> +++ b/arch/mips/math-emu/sp_fmax.c
> @@ -47,6 +47,9 @@ union ieee754sp ieee754sp_fmax(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754sp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -54,7 +57,6 @@ union ieee754sp ieee754sp_fmax(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> @@ -147,6 +149,9 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754sp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -154,7 +159,6 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> diff --git a/arch/mips/math-emu/sp_fmin.c b/arch/mips/math-emu/sp_fmin.c
> index 4eb1bb9..b528c4b 100644
> --- a/arch/mips/math-emu/sp_fmin.c
> +++ b/arch/mips/math-emu/sp_fmin.c
> @@ -47,6 +47,9 @@ union ieee754sp ieee754sp_fmin(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754sp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -54,7 +57,6 @@ union ieee754sp ieee754sp_fmin(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> @@ -147,6 +149,9 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_SNAN, IEEE754_CLASS_INF):
> return ieee754sp_nanxcpt(x);
>
> + case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> + return x;
> +
> /* numbers are preferred to NaNs */
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_QNAN):
> @@ -154,7 +159,6 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_QNAN):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_QNAN):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_QNAN, IEEE754_CLASS_DNORM):
> --
> 2.7.4
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists