lkml.org 
[lkml]   [2017]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 09/16] MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of both infinite inputs
On Fri, Jul 21, 2017 at 04:09:07PM +0200, Aleksandar Markovic wrote:
> From: Aleksandar Markovic <aleksandar.markovic@imgtec.com>
>
> Fix the value returned by <MAXA|MINA>.<D|S> fd,fs,ft, if both inputs
> are infinite. The previous implementation returned always the value
> contained in ft in such cases. The correct behavior is specified
> in Mips instruction set manual and is as follows:
>
> fs ft MAXA MINA
> ---------------------------------
> inf inf inf inf
> inf -inf inf -inf
> -inf inf inf -inf
> -inf -inf -inf -inf
>
> The relevant example:
>
> MAXA.S fd,fs,ft:
> If fs contains +inf, and ft contains -inf, fd is going to contain
> +inf (without this patch, it used to contain -inf).
>

Same Fixes/stable thing

> Signed-off-by: Miodrag Dinic <miodrag.dinic@imgtec.com>
> Signed-off-by: Goran Ferenc <goran.ferenc@imgtec.com>
> Signed-off-by: Aleksandar Markovic <aleksandar.markovic@imgtec.com>

Reviewed-by: James Hogan <james.hogan@imgtec.com>

Cheers
James

> ---
> arch/mips/math-emu/dp_fmax.c | 4 +++-
> arch/mips/math-emu/dp_fmin.c | 4 +++-
> arch/mips/math-emu/sp_fmax.c | 4 +++-
> arch/mips/math-emu/sp_fmin.c | 4 +++-
> 4 files changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/math-emu/dp_fmax.c b/arch/mips/math-emu/dp_fmax.c
> index 860b43f9..5459643 100644
> --- a/arch/mips/math-emu/dp_fmax.c
> +++ b/arch/mips/math-emu/dp_fmax.c
> @@ -183,6 +183,9 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, union ieee754dp y)
> /*
> * Infinity and zero handling
> */
> + case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> + return ieee754dp_inf(xs & ys);
> +
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
> @@ -190,7 +193,6 @@ union ieee754dp ieee754dp_fmaxa(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
> diff --git a/arch/mips/math-emu/dp_fmin.c b/arch/mips/math-emu/dp_fmin.c
> index 73d85e4..d4cd243 100644
> --- a/arch/mips/math-emu/dp_fmin.c
> +++ b/arch/mips/math-emu/dp_fmin.c
> @@ -183,6 +183,9 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, union ieee754dp y)
> /*
> * Infinity and zero handling
> */
> + case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> + return ieee754dp_inf(xs | ys);
> +
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
> @@ -190,7 +193,6 @@ union ieee754dp ieee754dp_fmina(union ieee754dp x, union ieee754dp y)
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
> diff --git a/arch/mips/math-emu/sp_fmax.c b/arch/mips/math-emu/sp_fmax.c
> index fec7f64..528a90b 100644
> --- a/arch/mips/math-emu/sp_fmax.c
> +++ b/arch/mips/math-emu/sp_fmax.c
> @@ -183,6 +183,9 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, union ieee754sp y)
> /*
> * Infinity and zero handling
> */
> + case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> + return ieee754sp_inf(xs & ys);
> +
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
> @@ -190,7 +193,6 @@ union ieee754sp ieee754sp_fmaxa(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
> diff --git a/arch/mips/math-emu/sp_fmin.c b/arch/mips/math-emu/sp_fmin.c
> index 74780bc..5f1d650 100644
> --- a/arch/mips/math-emu/sp_fmin.c
> +++ b/arch/mips/math-emu/sp_fmin.c
> @@ -184,6 +184,9 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, union ieee754sp y)
> /*
> * Infinity and zero handling
> */
> + case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> + return ieee754sp_inf(xs | ys);
> +
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_ZERO):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_NORM):
> case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_DNORM):
> @@ -191,7 +194,6 @@ union ieee754sp ieee754sp_fmina(union ieee754sp x, union ieee754sp y)
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_ZERO):
> return x;
>
> - case CLPAIR(IEEE754_CLASS_INF, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_NORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_DNORM, IEEE754_CLASS_INF):
> case CLPAIR(IEEE754_CLASS_ZERO, IEEE754_CLASS_INF):
> --
> 2.7.4
>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2017-07-21 17:49    [W:0.139 / U:17.088 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site