diff options
author | Nigel Stephens <nigel@mips.com> | 2009-10-12 14:57:18 -0700 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-11-02 12:00:05 +0100 |
commit | cea2be444380fc1bf665cd023ed84be7e0872d28 (patch) | |
tree | 9e477926a9c67f143a7d44ad89a2cdf2a37dc041 /arch/mips/math-emu/sp_simple.c | |
parent | a074f0e89faa8989bdbd6110785d2aafe7df5285 (diff) |
MIPS: Fix abs.[sd] and neg.[sd] emulation for NaN operands
This patch ensures that the sign bit is always updated for NaN operands.
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/math-emu/sp_simple.c')
-rw-r--r-- | arch/mips/math-emu/sp_simple.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c index 770f0f4677cd..3175477d36f6 100644 --- a/arch/mips/math-emu/sp_simple.c +++ b/arch/mips/math-emu/sp_simple.c @@ -62,8 +62,6 @@ ieee754sp ieee754sp_neg(ieee754sp x) return ieee754sp_nanxcpt(y, "neg"); } - if (ieee754sp_isnan(x)) /* but not infinity */ - return ieee754sp_nanxcpt(x, "neg", x); return x; } @@ -76,15 +74,12 @@ ieee754sp ieee754sp_abs(ieee754sp x) CLEARCX; FLUSHXSP; + /* Clear sign ALWAYS, irrespective of NaN */ + SPSIGN(x) = 0; + if (xc == IEEE754_CLASS_SNAN) { - SETCX(IEEE754_INVALID_OPERATION); return ieee754sp_nanxcpt(ieee754sp_indef(), "abs"); } - if (ieee754sp_isnan(x)) /* but not infinity */ - return ieee754sp_nanxcpt(x, "abs", x); - - /* quick fix up */ - SPSIGN(x) = 0; return x; } |