mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 15:30:54 +07:00
MIPS: math-emu: Remove unused code.
Shrinks the FPU emulator by 4528 bytes. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
1bc3320d95
commit
dfbf42b844
@ -2,12 +2,11 @@
|
||||
# Makefile for the Linux/MIPS kernel FPU emulation.
|
||||
#
|
||||
|
||||
obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
||||
ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \
|
||||
dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \
|
||||
dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \
|
||||
sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
|
||||
sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
|
||||
dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
|
||||
obj-y := cp1emu.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
|
||||
ieee754xcpt.o dp_div.o dp_mul.o dp_sub.o dp_add.o dp_fsp.o \
|
||||
dp_cmp.o dp_simple.o dp_tint.o dp_fint.o dp_tlong.o dp_flong.o \
|
||||
sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_simple.o \
|
||||
sp_tint.o sp_fint.o sp_tlong.o sp_flong.o dp_sqrt.o sp_sqrt.o \
|
||||
kernel_linkage.o dsemul.o
|
||||
|
||||
obj-$(CONFIG_DEBUG_FS) += me-debugfs.o
|
||||
|
@ -59,11 +59,3 @@ union ieee754dp ieee754dp_fint(int x)
|
||||
}
|
||||
return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
|
||||
}
|
||||
|
||||
union ieee754dp ieee754dp_funs(unsigned int u)
|
||||
{
|
||||
if ((int) u < 0)
|
||||
return ieee754dp_add(ieee754dp_1e31(),
|
||||
ieee754dp_fint(u & ~(1 << 31)));
|
||||
return ieee754dp_fint(u);
|
||||
}
|
||||
|
@ -67,11 +67,3 @@ union ieee754dp ieee754dp_flong(s64 x)
|
||||
}
|
||||
DPNORMRET1(xs, xe, xm, "dp_flong", x);
|
||||
}
|
||||
|
||||
union ieee754dp ieee754dp_fulong(u64 u)
|
||||
{
|
||||
if ((s64) u < 0)
|
||||
return ieee754dp_add(ieee754dp_1e63(),
|
||||
ieee754dp_flong(u & ~(1ULL << 63)));
|
||||
return ieee754dp_flong(u);
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* double precision: common utilities
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754dp.h"
|
||||
|
||||
/* close to ieeep754dp_logb
|
||||
*/
|
||||
union ieee754dp ieee754dp_frexp(union ieee754dp x, int *eptr)
|
||||
{
|
||||
COMPXDP;
|
||||
ieee754_clearcx();
|
||||
EXPLODEXDP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
*eptr = 0;
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
DPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
*eptr = xe + 1;
|
||||
return builddp(xs, -1 + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* double precision: common utilities
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754dp.h"
|
||||
|
||||
union ieee754dp ieee754dp_logb(union ieee754dp x)
|
||||
{
|
||||
COMPXDP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXDP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
return ieee754dp_nanxcpt(x, "logb", x);
|
||||
case IEEE754_CLASS_QNAN:
|
||||
return x;
|
||||
case IEEE754_CLASS_INF:
|
||||
return ieee754dp_inf(0);
|
||||
case IEEE754_CLASS_ZERO:
|
||||
return ieee754dp_inf(1);
|
||||
case IEEE754_CLASS_DNORM:
|
||||
DPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
return ieee754dp_fint(xe);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* double precision: common utilities
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754dp.h"
|
||||
|
||||
/* modf function is always exact for a finite number
|
||||
*/
|
||||
union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp *ip)
|
||||
{
|
||||
COMPXDP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXDP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
*ip = x;
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
/* far to small */
|
||||
*ip = ieee754dp_zero(xs);
|
||||
return x;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
if (xe < 0) {
|
||||
*ip = ieee754dp_zero(xs);
|
||||
return x;
|
||||
}
|
||||
if (xe >= DP_FBITS) {
|
||||
*ip = x;
|
||||
return ieee754dp_zero(xs);
|
||||
}
|
||||
/* generate ipart mantissa by clearing bottom bits
|
||||
*/
|
||||
*ip = builddp(xs, xe + DP_EBIAS,
|
||||
((xm >> (DP_FBITS - xe)) << (DP_FBITS - xe)) &
|
||||
~DP_HIDDEN_BIT);
|
||||
|
||||
/* generate fpart mantissa by clearing top bits
|
||||
* and normalizing (must be able to normalize)
|
||||
*/
|
||||
xm = (xm << (64 - (DP_FBITS - xe))) >> (64 - (DP_FBITS - xe));
|
||||
if (xm == 0)
|
||||
return ieee754dp_zero(xs);
|
||||
|
||||
while ((xm >> DP_FBITS) == 0) {
|
||||
xm <<= 1;
|
||||
xe--;
|
||||
}
|
||||
return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* double precision: common utilities
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754dp.h"
|
||||
|
||||
union ieee754dp ieee754dp_scalb(union ieee754dp x, int n)
|
||||
{
|
||||
COMPXDP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXDP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
return ieee754dp_nanxcpt(x, "scalb", x, n);
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
DPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
DPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
|
||||
}
|
||||
|
||||
|
||||
union ieee754dp ieee754dp_ldexp(union ieee754dp x, int n)
|
||||
{
|
||||
return ieee754dp_scalb(x, n);
|
||||
}
|
@ -26,14 +26,6 @@
|
||||
|
||||
#include "ieee754dp.h"
|
||||
|
||||
union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y)
|
||||
{
|
||||
ieee754_clearcx();
|
||||
DPSIGN(x) = DPSIGN(y);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
union ieee754dp ieee754dp_neg(union ieee754dp x)
|
||||
{
|
||||
COMPXDP;
|
||||
|
@ -106,16 +106,3 @@ int ieee754dp_tint(union ieee754dp x)
|
||||
else
|
||||
return xm;
|
||||
}
|
||||
|
||||
|
||||
unsigned int ieee754dp_tuns(union ieee754dp x)
|
||||
{
|
||||
union ieee754dp hb = ieee754dp_1e31();
|
||||
|
||||
/* what if x < 0 ?? */
|
||||
if (ieee754dp_lt(x, hb))
|
||||
return (unsigned) ieee754dp_tint(x);
|
||||
|
||||
return (unsigned) ieee754dp_tint(ieee754dp_sub(x, hb)) |
|
||||
((unsigned) 1 << 31);
|
||||
}
|
||||
|
@ -110,16 +110,3 @@ s64 ieee754dp_tlong(union ieee754dp x)
|
||||
else
|
||||
return xm;
|
||||
}
|
||||
|
||||
|
||||
u64 ieee754dp_tulong(union ieee754dp x)
|
||||
{
|
||||
union ieee754dp hb = ieee754dp_1e63();
|
||||
|
||||
/* what if x < 0 ?? */
|
||||
if (ieee754dp_lt(x, hb))
|
||||
return (u64) ieee754dp_tlong(x);
|
||||
|
||||
return (u64) ieee754dp_tlong(ieee754dp_sub(x, hb)) |
|
||||
(1ULL << 63);
|
||||
}
|
||||
|
@ -72,11 +72,6 @@ int ieee754sp_class(union ieee754sp x);
|
||||
|
||||
union ieee754sp ieee754sp_abs(union ieee754sp x);
|
||||
union ieee754sp ieee754sp_neg(union ieee754sp x);
|
||||
union ieee754sp ieee754sp_scalb(union ieee754sp x, int);
|
||||
union ieee754sp ieee754sp_logb(union ieee754sp x);
|
||||
|
||||
/* x with sign of y */
|
||||
union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y);
|
||||
|
||||
union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y);
|
||||
union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y);
|
||||
@ -84,27 +79,13 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y);
|
||||
union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y);
|
||||
|
||||
union ieee754sp ieee754sp_fint(int x);
|
||||
union ieee754sp ieee754sp_funs(unsigned x);
|
||||
union ieee754sp ieee754sp_flong(s64 x);
|
||||
union ieee754sp ieee754sp_fulong(u64 x);
|
||||
union ieee754sp ieee754sp_fdp(union ieee754dp x);
|
||||
|
||||
int ieee754sp_tint(union ieee754sp x);
|
||||
unsigned int ieee754sp_tuns(union ieee754sp x);
|
||||
s64 ieee754sp_tlong(union ieee754sp x);
|
||||
u64 ieee754sp_tulong(union ieee754sp x);
|
||||
|
||||
int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cop, int sig);
|
||||
/*
|
||||
* basic sp math
|
||||
*/
|
||||
union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp * ip);
|
||||
union ieee754sp ieee754sp_frexp(union ieee754sp x, int *exp);
|
||||
union ieee754sp ieee754sp_ldexp(union ieee754sp x, int exp);
|
||||
|
||||
union ieee754sp ieee754sp_ceil(union ieee754sp x);
|
||||
union ieee754sp ieee754sp_floor(union ieee754sp x);
|
||||
union ieee754sp ieee754sp_trunc(union ieee754sp x);
|
||||
|
||||
union ieee754sp ieee754sp_sqrt(union ieee754sp x);
|
||||
|
||||
@ -113,9 +94,6 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x);
|
||||
*/
|
||||
int ieee754dp_class(union ieee754dp x);
|
||||
|
||||
/* x with sign of y */
|
||||
union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y);
|
||||
|
||||
union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y);
|
||||
union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y);
|
||||
union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y);
|
||||
@ -123,38 +101,15 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y);
|
||||
|
||||
union ieee754dp ieee754dp_abs(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_neg(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_scalb(union ieee754dp x, int);
|
||||
|
||||
/* return exponent as integer in floating point format
|
||||
*/
|
||||
union ieee754dp ieee754dp_logb(union ieee754dp x);
|
||||
|
||||
union ieee754dp ieee754dp_fint(int x);
|
||||
union ieee754dp ieee754dp_funs(unsigned x);
|
||||
union ieee754dp ieee754dp_flong(s64 x);
|
||||
union ieee754dp ieee754dp_fulong(u64 x);
|
||||
union ieee754dp ieee754dp_fsp(union ieee754sp x);
|
||||
|
||||
union ieee754dp ieee754dp_ceil(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_floor(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_trunc(union ieee754dp x);
|
||||
|
||||
int ieee754dp_tint(union ieee754dp x);
|
||||
unsigned int ieee754dp_tuns(union ieee754dp x);
|
||||
s64 ieee754dp_tlong(union ieee754dp x);
|
||||
u64 ieee754dp_tulong(union ieee754dp x);
|
||||
|
||||
int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cop, int sig);
|
||||
/*
|
||||
* basic sp math
|
||||
*/
|
||||
union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp * ip);
|
||||
union ieee754dp ieee754dp_frexp(union ieee754dp x, int *exp);
|
||||
union ieee754dp ieee754dp_ldexp(union ieee754dp x, int exp);
|
||||
|
||||
union ieee754dp ieee754dp_ceil(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_floor(union ieee754dp x);
|
||||
union ieee754dp ieee754dp_trunc(union ieee754dp x);
|
||||
|
||||
union ieee754dp ieee754dp_sqrt(union ieee754dp x);
|
||||
|
||||
@ -261,14 +216,6 @@ static inline int ieee754dp_ge(union ieee754dp x, union ieee754dp y)
|
||||
return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Like strtod
|
||||
*/
|
||||
union ieee754dp ieee754dp_fstr(const char *s, char **endp);
|
||||
char *ieee754dp_tstr(union ieee754dp x, int prec, int fmt, int af);
|
||||
|
||||
|
||||
/*
|
||||
* The control status register
|
||||
*/
|
||||
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* floor, trunc, ceil
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754.h"
|
||||
|
||||
union ieee754dp ieee754dp_floor(union ieee754dp x)
|
||||
{
|
||||
union ieee754dp i;
|
||||
|
||||
if (ieee754dp_lt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
|
||||
return ieee754dp_sub(i, ieee754dp_one(0));
|
||||
else
|
||||
return i;
|
||||
}
|
||||
|
||||
union ieee754dp ieee754dp_ceil(union ieee754dp x)
|
||||
{
|
||||
union ieee754dp i;
|
||||
|
||||
if (ieee754dp_gt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
|
||||
return ieee754dp_add(i, ieee754dp_one(0));
|
||||
else
|
||||
return i;
|
||||
}
|
||||
|
||||
union ieee754dp ieee754dp_trunc(union ieee754dp x)
|
||||
{
|
||||
union ieee754dp i;
|
||||
|
||||
(void) ieee754dp_modf(x, &i);
|
||||
return i;
|
||||
}
|
@ -68,12 +68,3 @@ union ieee754sp ieee754sp_fint(int x)
|
||||
}
|
||||
SPNORMRET1(xs, xe, xm, "fint", x);
|
||||
}
|
||||
|
||||
|
||||
union ieee754sp ieee754sp_funs(unsigned int u)
|
||||
{
|
||||
if ((int) u < 0)
|
||||
return ieee754sp_add(ieee754sp_1e31(),
|
||||
ieee754sp_fint(u & ~(1 << 31)));
|
||||
return ieee754sp_fint(u);
|
||||
}
|
||||
|
@ -67,12 +67,3 @@ union ieee754sp ieee754sp_flong(s64 x)
|
||||
}
|
||||
SPNORMRET1(xs, xe, xm, "sp_flong", x);
|
||||
}
|
||||
|
||||
|
||||
union ieee754sp ieee754sp_fulong(u64 u)
|
||||
{
|
||||
if ((s64) u < 0)
|
||||
return ieee754sp_add(ieee754sp_1e63(),
|
||||
ieee754sp_flong(u & ~(1ULL << 63)));
|
||||
return ieee754sp_flong(u);
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* single precision
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754sp.h"
|
||||
|
||||
/* close to ieeep754sp_logb
|
||||
*/
|
||||
union ieee754sp ieee754sp_frexp(union ieee754sp x, int *eptr)
|
||||
{
|
||||
COMPXSP;
|
||||
ieee754_clearcx();
|
||||
EXPLODEXSP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
*eptr = 0;
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
SPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
*eptr = xe + 1;
|
||||
return buildsp(xs, -1 + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* single precision
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754sp.h"
|
||||
|
||||
union ieee754sp ieee754sp_logb(union ieee754sp x)
|
||||
{
|
||||
COMPXSP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXSP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
return ieee754sp_nanxcpt(x, "logb", x);
|
||||
case IEEE754_CLASS_QNAN:
|
||||
return x;
|
||||
case IEEE754_CLASS_INF:
|
||||
return ieee754sp_inf(0);
|
||||
case IEEE754_CLASS_ZERO:
|
||||
return ieee754sp_inf(1);
|
||||
case IEEE754_CLASS_DNORM:
|
||||
SPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
return ieee754sp_fint(xe);
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* single precision
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754sp.h"
|
||||
|
||||
/* modf function is always exact for a finite number
|
||||
*/
|
||||
union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp *ip)
|
||||
{
|
||||
COMPXSP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXSP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
*ip = x;
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
/* far to small */
|
||||
*ip = ieee754sp_zero(xs);
|
||||
return x;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
if (xe < 0) {
|
||||
*ip = ieee754sp_zero(xs);
|
||||
return x;
|
||||
}
|
||||
if (xe >= SP_FBITS) {
|
||||
*ip = x;
|
||||
return ieee754sp_zero(xs);
|
||||
}
|
||||
/* generate ipart mantissa by clearing bottom bits
|
||||
*/
|
||||
*ip = buildsp(xs, xe + SP_EBIAS,
|
||||
((xm >> (SP_FBITS - xe)) << (SP_FBITS - xe)) &
|
||||
~SP_HIDDEN_BIT);
|
||||
|
||||
/* generate fpart mantissa by clearing top bits
|
||||
* and normalizing (must be able to normalize)
|
||||
*/
|
||||
xm = (xm << (32 - (SP_FBITS - xe))) >> (32 - (SP_FBITS - xe));
|
||||
if (xm == 0)
|
||||
return ieee754sp_zero(xs);
|
||||
|
||||
while ((xm >> SP_FBITS) == 0) {
|
||||
xm <<= 1;
|
||||
xe--;
|
||||
}
|
||||
return buildsp(xs, xe + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/* IEEE754 floating point arithmetic
|
||||
* single precision
|
||||
*/
|
||||
/*
|
||||
* MIPS floating point support
|
||||
* Copyright (C) 1994-2000 Algorithmics Ltd.
|
||||
*
|
||||
* ########################################################################
|
||||
*
|
||||
* This program is free software; you can distribute it and/or modify it
|
||||
* under the terms of the GNU General Public License (Version 2) as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
*
|
||||
* ########################################################################
|
||||
*/
|
||||
|
||||
|
||||
#include "ieee754sp.h"
|
||||
|
||||
union ieee754sp ieee754sp_scalb(union ieee754sp x, int n)
|
||||
{
|
||||
COMPXSP;
|
||||
|
||||
ieee754_clearcx();
|
||||
|
||||
EXPLODEXSP;
|
||||
|
||||
switch (xc) {
|
||||
case IEEE754_CLASS_SNAN:
|
||||
return ieee754sp_nanxcpt(x, "scalb", x, n);
|
||||
case IEEE754_CLASS_QNAN:
|
||||
case IEEE754_CLASS_INF:
|
||||
case IEEE754_CLASS_ZERO:
|
||||
return x;
|
||||
case IEEE754_CLASS_DNORM:
|
||||
SPDNORMX;
|
||||
break;
|
||||
case IEEE754_CLASS_NORM:
|
||||
break;
|
||||
}
|
||||
SPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
|
||||
}
|
||||
|
||||
|
||||
union ieee754sp ieee754sp_ldexp(union ieee754sp x, int n)
|
||||
{
|
||||
return ieee754sp_scalb(x, n);
|
||||
}
|
@ -26,14 +26,6 @@
|
||||
|
||||
#include "ieee754sp.h"
|
||||
|
||||
union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y)
|
||||
{
|
||||
ieee754_clearcx();
|
||||
SPSIGN(x) = SPSIGN(y);
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
union ieee754sp ieee754sp_neg(union ieee754sp x)
|
||||
{
|
||||
COMPXSP;
|
||||
|
@ -110,16 +110,3 @@ int ieee754sp_tint(union ieee754sp x)
|
||||
else
|
||||
return xm;
|
||||
}
|
||||
|
||||
|
||||
unsigned int ieee754sp_tuns(union ieee754sp x)
|
||||
{
|
||||
union ieee754sp hb = ieee754sp_1e31();
|
||||
|
||||
/* what if x < 0 ?? */
|
||||
if (ieee754sp_lt(x, hb))
|
||||
return (unsigned) ieee754sp_tint(x);
|
||||
|
||||
return (unsigned) ieee754sp_tint(ieee754sp_sub(x, hb)) |
|
||||
((unsigned) 1 << 31);
|
||||
}
|
||||
|
@ -107,16 +107,3 @@ s64 ieee754sp_tlong(union ieee754sp x)
|
||||
else
|
||||
return xm;
|
||||
}
|
||||
|
||||
|
||||
u64 ieee754sp_tulong(union ieee754sp x)
|
||||
{
|
||||
union ieee754sp hb = ieee754sp_1e63();
|
||||
|
||||
/* what if x < 0 ?? */
|
||||
if (ieee754sp_lt(x, hb))
|
||||
return (u64) ieee754sp_tlong(x);
|
||||
|
||||
return (u64) ieee754sp_tlong(ieee754sp_sub(x, hb)) |
|
||||
(1ULL << 63);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user