aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/sp_simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/math-emu/sp_simple.c')
-rw-r--r--arch/mips/math-emu/sp_simple.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index c809830dffb4..770f0f4677cd 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -48,16 +48,22 @@ ieee754sp ieee754sp_neg(ieee754sp x)
48 CLEARCX; 48 CLEARCX;
49 FLUSHXSP; 49 FLUSHXSP;
50 50
51 /*
52 * Invert the sign ALWAYS to prevent an endless recursion on
53 * pow() in libc.
54 */
55 /* quick fix up */
56 SPSIGN(x) ^= 1;
57
51 if (xc == IEEE754_CLASS_SNAN) { 58 if (xc == IEEE754_CLASS_SNAN) {
59 ieee754sp y = ieee754sp_indef();
52 SETCX(IEEE754_INVALID_OPERATION); 60 SETCX(IEEE754_INVALID_OPERATION);
53 return ieee754sp_nanxcpt(ieee754sp_indef(), "neg"); 61 SPSIGN(y) = SPSIGN(x);
62 return ieee754sp_nanxcpt(y, "neg");
54 } 63 }
55 64
56 if (ieee754sp_isnan(x)) /* but not infinity */ 65 if (ieee754sp_isnan(x)) /* but not infinity */
57 return ieee754sp_nanxcpt(x, "neg", x); 66 return ieee754sp_nanxcpt(x, "neg", x);
58
59 /* quick fix up */
60 SPSIGN(x) ^= 1;
61 return x; 67 return x;
62} 68}
63 69