linux-mips
[Top] [All Lists]

Re: [PATCH] Fix abs.[sd] and neg.[sd] emulation for NaN operands

To: chris@mips.com
Subject: Re: [PATCH] Fix abs.[sd] and neg.[sd] emulation for NaN operands
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 10 May 2010 23:49:46 +0900 (JST)
Cc: linux-mips@linux-mips.org
In-reply-to: <20091012215718.30362.67068.stgit@localhost.localdomain>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20091012215522.30362.49399.stgit@localhost.localdomain> <20091012215718.30362.67068.stgit@localhost.localdomain>
Sender: linux-mips-bounce@linux-mips.org
Excuse me for too late comment.

On Mon, 12 Oct 2009 14:57:18 -0700, Chris Dearman <chris@mips.com> wrote:
> From: Nigel Stephens <nigel@mips.com>
> 
> This patch ensures that the sign bit is always updated
> for NaN operands.
...
> @@ -76,15 +74,12 @@ ieee754dp ieee754dp_abs(ieee754dp x)
>       CLEARCX;
>       FLUSHXDP;
>  
> +     /* Clear sign ALWAYS, irrespective of NaN */
> +     DPSIGN(x) = 0;
> +
>       if (xc == IEEE754_CLASS_SNAN) {
> -             SETCX(IEEE754_INVALID_OPERATION);
> -             return ieee754dp_nanxcpt(ieee754dp_indef(), "neg");
> +             return ieee754dp_nanxcpt(ieee754dp_indef(), "abs");
>       }
>  
> -     if (ieee754dp_isnan(x)) /* but not infinity */
> -             return ieee754dp_nanxcpt(x, "abs", x);
> -
> -     /* quick fix up */
> -     DPSIGN(x) = 0;
>       return x;
>  }

Is there any reason for removal of SETCX(IEEE754_INVALID_OPERATION)
line here?

The older version of this fix ("Fix absd emulation" by Raghu Gandham)
did not remove the line.

Without this line, a signaling NaN will not raise a signal.  It seems
not expected behaviour.

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>