linux-mips
[Top] [All Lists]

[PATCH 02/15] Fix absd emulation

To: linux-mips@linux-mips.org
Subject: [PATCH 02/15] Fix absd emulation
From: Raghu Gandham <raghu@mips.com>
Date: Wed, 01 Jul 2009 19:40:09 -0700
Cc: chris@mips.com
In-reply-to: <20090702023938.23268.65453.stgit@linux-raghu>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20090702023938.23268.65453.stgit@linux-raghu>
Sender: linux-mips-bounce@linux-mips.org
User-agent: StGIT/0.14.3
From: Robin Randhawa <robin@mips.com>

Signed-off-by: Chris Dearman <chris@mips.com>
---

 arch/mips/math-emu/dp_simple.c |   11 ++++-------
 arch/mips/math-emu/sp_simple.c |    3 ---
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index 1c555e6..6ff4655 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -76,15 +76,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;
 }
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index 770f0f4..cdec1a2 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -61,9 +61,6 @@ ieee754sp ieee754sp_neg(ieee754sp x)
                SPSIGN(y) = SPSIGN(x);
                return ieee754sp_nanxcpt(y, "neg");
        }
-
-       if (ieee754sp_isnan(x)) /* but not infinity */
-               return ieee754sp_nanxcpt(x, "neg", x);
        return x;
 }
 


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