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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Atsushi Nemoto wrote:
Excuse me for too late comment.

On Mon, 12 Oct 2009 14:57:18 -0700, Chris Dearman <chris@xxxxxxxx> wrote:
From: Nigel Stephens <nigel@xxxxxxxx>

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.

ieee754dp/sp_nanxcpt also sets the invalid exception bit so I think this is duplicated code. I think the same fix should have been applied to ieee754sp_neg/ieee754dp_neg for consistency.

Chris

--
Chris Dearman               Desk: +1 408 530 5092  Cell: +1 408 398 5531
MIPS Technologies Inc            955 East Arques Ave, Sunnyvale CA 94085


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux