From: James S. <jsi...@us...> - 2001-10-11 21:57:58
|
Update of /cvsroot/linux-mips/linux/arch/mips/math-emu In directory usw-pr-cvs1:/tmp/cvs-serv6462 Modified Files: ieee754sp.c sp_fdp.c Log Message: A bunch of soft floating point fixes. Index: ieee754sp.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/math-emu/ieee754sp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ieee754sp.c 2001/10/04 16:22:33 1.1 +++ ieee754sp.c 2001/10/11 21:57:54 1.2 @@ -204,6 +204,24 @@ /* we underflow (tiny/zero) */ assert(xe == SP_EMIN); SETCX(IEEE754_UNDERFLOW); + if (!xm) { + switch(ieee754_csr.rm) { + case IEEE754_RN: + return ieee754sp_zero(sn); + case IEEE754_RZ: + return ieee754sp_zero(sn); + case IEEE754_RU: /* toward +Infinity */ + if(sn == 0) + return ieee754sp_mind(0); + else + return ieee754sp_zero(1); + case IEEE754_RD: /* toward -Infinity */ + if(sn == 0) + return ieee754sp_zero(0); + else + return ieee754sp_mind(1); + } + } return buildsp(sn, SP_EMIN - 1 + SP_EBIAS, xm); } else { assert((xm >> (SP_MBITS + 1)) == 0); /* no execess */ Index: sp_fdp.c =================================================================== RCS file: /cvsroot/linux-mips/linux/arch/mips/math-emu/sp_fdp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sp_fdp.c 2001/10/04 16:22:33 1.1 +++ sp_fdp.c 2001/10/11 21:57:54 1.2 @@ -30,6 +30,7 @@ ieee754sp ieee754sp_fdp(ieee754dp x) { COMPXDP; + ieee754sp nan; EXPLODEXDP; @@ -42,12 +43,11 @@ SETCX(IEEE754_INVALID_OPERATION); return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp"); case IEEE754_CLASS_QNAN: - return ieee754sp_nanxcpt(buildsp(xs, - SP_EMAX + 1 + SP_EBIAS, - (unsigned long) - (xm >> - (DP_MBITS - SP_MBITS))), - "fdp", x); + nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (unsigned long) + (xm >> (DP_MBITS - SP_MBITS))); + if (!ieee754sp_isnan(nan)) + nan = ieee754sp_indef(); + return ieee754sp_nanxcpt(nan, "fdp", x); case IEEE754_CLASS_INF: return ieee754sp_inf(xs); case IEEE754_CLASS_ZERO: |