Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1693805

Re: [PATCH v3 09/16] MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of both infinite inputs

From James Hogan <james.hogan@imgtec.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 09/16] MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of both infinite inputs
Date 2017-07-21 17:50 +0200
Message-ID <u5IlH-6Ek-9@gated-at.bofh.it> (permalink)
References <u5GWB-5Tl-3@gated-at.bofh.it> <u5GWC-5Tl-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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
> 

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH v3 09/16] MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of both infinite inputs Aleksandar Markovic <aleksandar.markovic@rt-rk.com> - 2017-07-21 16:20 +0200
  Re: [PATCH v3 09/16] MIPS: math-emu: <MAXA|MINA>.<D|S>: Fix cases of  both infinite inputs James Hogan <james.hogan@imgtec.com> - 2017-07-21 17:50 +0200

csiph-web