aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2014-04-24 18:29:50 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-05-23 09:11:14 -0400
commitdfbf42b844a5f307bd66716da65f01be9107bc0b (patch)
tree99da96f3c2faeb7ec202c681fe98d3a1f8f8ce40 /arch/mips
parent1bc3320d954183031bd3dc1dac36858c3c96e0b3 (diff)
MIPS: math-emu: Remove unused code.
Shrinks the FPU emulator by 4528 bytes. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/math-emu/Makefile13
-rw-r--r--arch/mips/math-emu/dp_fint.c8
-rw-r--r--arch/mips/math-emu/dp_flong.c8
-rw-r--r--arch/mips/math-emu/dp_frexp.c52
-rw-r--r--arch/mips/math-emu/dp_logb.c53
-rw-r--r--arch/mips/math-emu/dp_modf.c79
-rw-r--r--arch/mips/math-emu/dp_scalb.c57
-rw-r--r--arch/mips/math-emu/dp_simple.c8
-rw-r--r--arch/mips/math-emu/dp_tint.c13
-rw-r--r--arch/mips/math-emu/dp_tlong.c13
-rw-r--r--arch/mips/math-emu/ieee754.h53
-rw-r--r--arch/mips/math-emu/ieee754m.c55
-rw-r--r--arch/mips/math-emu/sp_fint.c9
-rw-r--r--arch/mips/math-emu/sp_flong.c9
-rw-r--r--arch/mips/math-emu/sp_frexp.c52
-rw-r--r--arch/mips/math-emu/sp_logb.c53
-rw-r--r--arch/mips/math-emu/sp_modf.c79
-rw-r--r--arch/mips/math-emu/sp_scalb.c57
-rw-r--r--arch/mips/math-emu/sp_simple.c8
-rw-r--r--arch/mips/math-emu/sp_tint.c13
-rw-r--r--arch/mips/math-emu/sp_tlong.c13
21 files changed, 6 insertions, 699 deletions
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
index 0803970dfc16..363ce9bd82ea 100644
--- a/arch/mips/math-emu/Makefile
+++ b/arch/mips/math-emu/Makefile
@@ -2,12 +2,11 @@
2# Makefile for the Linux/MIPS kernel FPU emulation. 2# Makefile for the Linux/MIPS kernel FPU emulation.
3# 3#
4 4
5obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \ 5obj-y := cp1emu.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
6 ieee754xcpt.o dp_frexp.o dp_modf.o dp_div.o dp_mul.o dp_sub.o \ 6 ieee754xcpt.o dp_div.o dp_mul.o dp_sub.o dp_add.o dp_fsp.o \
7 dp_add.o dp_fsp.o dp_cmp.o dp_logb.o dp_scalb.o dp_simple.o \ 7 dp_cmp.o dp_simple.o dp_tint.o dp_fint.o dp_tlong.o dp_flong.o \
8 dp_tint.o dp_fint.o dp_tlong.o dp_flong.o sp_frexp.o sp_modf.o \ 8 sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_simple.o \
9 sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ 9 sp_tint.o sp_fint.o sp_tlong.o sp_flong.o dp_sqrt.o sp_sqrt.o \
10 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ 10 kernel_linkage.o dsemul.o
11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
12 11
13obj-$(CONFIG_DEBUG_FS) += me-debugfs.o 12obj-$(CONFIG_DEBUG_FS) += me-debugfs.o
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c
index 196a010ff09d..98b9d6a14027 100644
--- a/arch/mips/math-emu/dp_fint.c
+++ b/arch/mips/math-emu/dp_fint.c
@@ -59,11 +59,3 @@ union ieee754dp ieee754dp_fint(int x)
59 } 59 }
60 return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT); 60 return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
61} 61}
62
63union ieee754dp ieee754dp_funs(unsigned int u)
64{
65 if ((int) u < 0)
66 return ieee754dp_add(ieee754dp_1e31(),
67 ieee754dp_fint(u & ~(1 << 31)));
68 return ieee754dp_fint(u);
69}
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c
index 915072d82c20..fb5eeaadf253 100644
--- a/arch/mips/math-emu/dp_flong.c
+++ b/arch/mips/math-emu/dp_flong.c
@@ -67,11 +67,3 @@ union ieee754dp ieee754dp_flong(s64 x)
67 } 67 }
68 DPNORMRET1(xs, xe, xm, "dp_flong", x); 68 DPNORMRET1(xs, xe, xm, "dp_flong", x);
69} 69}
70
71union ieee754dp ieee754dp_fulong(u64 u)
72{
73 if ((s64) u < 0)
74 return ieee754dp_add(ieee754dp_1e63(),
75 ieee754dp_flong(u & ~(1ULL << 63)));
76 return ieee754dp_flong(u);
77}
diff --git a/arch/mips/math-emu/dp_frexp.c b/arch/mips/math-emu/dp_frexp.c
deleted file mode 100644
index 25ebce16143e..000000000000
--- a/arch/mips/math-emu/dp_frexp.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754dp.h"
28
29/* close to ieeep754dp_logb
30*/
31union ieee754dp ieee754dp_frexp(union ieee754dp x, int *eptr)
32{
33 COMPXDP;
34 ieee754_clearcx();
35 EXPLODEXDP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 case IEEE754_CLASS_QNAN:
40 case IEEE754_CLASS_INF:
41 case IEEE754_CLASS_ZERO:
42 *eptr = 0;
43 return x;
44 case IEEE754_CLASS_DNORM:
45 DPDNORMX;
46 break;
47 case IEEE754_CLASS_NORM:
48 break;
49 }
50 *eptr = xe + 1;
51 return builddp(xs, -1 + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
52}
diff --git a/arch/mips/math-emu/dp_logb.c b/arch/mips/math-emu/dp_logb.c
deleted file mode 100644
index b412c90355cd..000000000000
--- a/arch/mips/math-emu/dp_logb.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754dp.h"
28
29union ieee754dp ieee754dp_logb(union ieee754dp x)
30{
31 COMPXDP;
32
33 ieee754_clearcx();
34
35 EXPLODEXDP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 return ieee754dp_nanxcpt(x, "logb", x);
40 case IEEE754_CLASS_QNAN:
41 return x;
42 case IEEE754_CLASS_INF:
43 return ieee754dp_inf(0);
44 case IEEE754_CLASS_ZERO:
45 return ieee754dp_inf(1);
46 case IEEE754_CLASS_DNORM:
47 DPDNORMX;
48 break;
49 case IEEE754_CLASS_NORM:
50 break;
51 }
52 return ieee754dp_fint(xe);
53}
diff --git a/arch/mips/math-emu/dp_modf.c b/arch/mips/math-emu/dp_modf.c
deleted file mode 100644
index d83ec44f1a33..000000000000
--- a/arch/mips/math-emu/dp_modf.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754dp.h"
28
29/* modf function is always exact for a finite number
30*/
31union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp *ip)
32{
33 COMPXDP;
34
35 ieee754_clearcx();
36
37 EXPLODEXDP;
38
39 switch (xc) {
40 case IEEE754_CLASS_SNAN:
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 case IEEE754_CLASS_ZERO:
44 *ip = x;
45 return x;
46 case IEEE754_CLASS_DNORM:
47 /* far to small */
48 *ip = ieee754dp_zero(xs);
49 return x;
50 case IEEE754_CLASS_NORM:
51 break;
52 }
53 if (xe < 0) {
54 *ip = ieee754dp_zero(xs);
55 return x;
56 }
57 if (xe >= DP_FBITS) {
58 *ip = x;
59 return ieee754dp_zero(xs);
60 }
61 /* generate ipart mantissa by clearing bottom bits
62 */
63 *ip = builddp(xs, xe + DP_EBIAS,
64 ((xm >> (DP_FBITS - xe)) << (DP_FBITS - xe)) &
65 ~DP_HIDDEN_BIT);
66
67 /* generate fpart mantissa by clearing top bits
68 * and normalizing (must be able to normalize)
69 */
70 xm = (xm << (64 - (DP_FBITS - xe))) >> (64 - (DP_FBITS - xe));
71 if (xm == 0)
72 return ieee754dp_zero(xs);
73
74 while ((xm >> DP_FBITS) == 0) {
75 xm <<= 1;
76 xe--;
77 }
78 return builddp(xs, xe + DP_EBIAS, xm & ~DP_HIDDEN_BIT);
79}
diff --git a/arch/mips/math-emu/dp_scalb.c b/arch/mips/math-emu/dp_scalb.c
deleted file mode 100644
index dee37551fae1..000000000000
--- a/arch/mips/math-emu/dp_scalb.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * double precision: common utilities
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754dp.h"
28
29union ieee754dp ieee754dp_scalb(union ieee754dp x, int n)
30{
31 COMPXDP;
32
33 ieee754_clearcx();
34
35 EXPLODEXDP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 return ieee754dp_nanxcpt(x, "scalb", x, n);
40 case IEEE754_CLASS_QNAN:
41 case IEEE754_CLASS_INF:
42 case IEEE754_CLASS_ZERO:
43 return x;
44 case IEEE754_CLASS_DNORM:
45 DPDNORMX;
46 break;
47 case IEEE754_CLASS_NORM:
48 break;
49 }
50 DPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
51}
52
53
54union ieee754dp ieee754dp_ldexp(union ieee754dp x, int n)
55{
56 return ieee754dp_scalb(x, n);
57}
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index cae11b0454c6..fddeb33107dd 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -26,14 +26,6 @@
26 26
27#include "ieee754dp.h" 27#include "ieee754dp.h"
28 28
29union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y)
30{
31 ieee754_clearcx();
32 DPSIGN(x) = DPSIGN(y);
33 return x;
34}
35
36
37union ieee754dp ieee754dp_neg(union ieee754dp x) 29union ieee754dp ieee754dp_neg(union ieee754dp x)
38{ 30{
39 COMPXDP; 31 COMPXDP;
diff --git a/arch/mips/math-emu/dp_tint.c b/arch/mips/math-emu/dp_tint.c
index 8c39a40d7fe9..1270009aee9b 100644
--- a/arch/mips/math-emu/dp_tint.c
+++ b/arch/mips/math-emu/dp_tint.c
@@ -106,16 +106,3 @@ int ieee754dp_tint(union ieee754dp x)
106 else 106 else
107 return xm; 107 return xm;
108} 108}
109
110
111unsigned int ieee754dp_tuns(union ieee754dp x)
112{
113 union ieee754dp hb = ieee754dp_1e31();
114
115 /* what if x < 0 ?? */
116 if (ieee754dp_lt(x, hb))
117 return (unsigned) ieee754dp_tint(x);
118
119 return (unsigned) ieee754dp_tint(ieee754dp_sub(x, hb)) |
120 ((unsigned) 1 << 31);
121}
diff --git a/arch/mips/math-emu/dp_tlong.c b/arch/mips/math-emu/dp_tlong.c
index 2653b6eac689..b9a43a2d4b36 100644
--- a/arch/mips/math-emu/dp_tlong.c
+++ b/arch/mips/math-emu/dp_tlong.c
@@ -110,16 +110,3 @@ s64 ieee754dp_tlong(union ieee754dp x)
110 else 110 else
111 return xm; 111 return xm;
112} 112}
113
114
115u64 ieee754dp_tulong(union ieee754dp x)
116{
117 union ieee754dp hb = ieee754dp_1e63();
118
119 /* what if x < 0 ?? */
120 if (ieee754dp_lt(x, hb))
121 return (u64) ieee754dp_tlong(x);
122
123 return (u64) ieee754dp_tlong(ieee754dp_sub(x, hb)) |
124 (1ULL << 63);
125}
diff --git a/arch/mips/math-emu/ieee754.h b/arch/mips/math-emu/ieee754.h
index 7466230da5b8..a62aa5a40af9 100644
--- a/arch/mips/math-emu/ieee754.h
+++ b/arch/mips/math-emu/ieee754.h
@@ -72,11 +72,6 @@ int ieee754sp_class(union ieee754sp x);
72 72
73union ieee754sp ieee754sp_abs(union ieee754sp x); 73union ieee754sp ieee754sp_abs(union ieee754sp x);
74union ieee754sp ieee754sp_neg(union ieee754sp x); 74union ieee754sp ieee754sp_neg(union ieee754sp x);
75union ieee754sp ieee754sp_scalb(union ieee754sp x, int);
76union ieee754sp ieee754sp_logb(union ieee754sp x);
77
78/* x with sign of y */
79union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y);
80 75
81union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y); 76union ieee754sp ieee754sp_add(union ieee754sp x, union ieee754sp y);
82union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y); 77union ieee754sp ieee754sp_sub(union ieee754sp x, union ieee754sp y);
@@ -84,27 +79,13 @@ union ieee754sp ieee754sp_mul(union ieee754sp x, union ieee754sp y);
84union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y); 79union ieee754sp ieee754sp_div(union ieee754sp x, union ieee754sp y);
85 80
86union ieee754sp ieee754sp_fint(int x); 81union ieee754sp ieee754sp_fint(int x);
87union ieee754sp ieee754sp_funs(unsigned x);
88union ieee754sp ieee754sp_flong(s64 x); 82union ieee754sp ieee754sp_flong(s64 x);
89union ieee754sp ieee754sp_fulong(u64 x);
90union ieee754sp ieee754sp_fdp(union ieee754dp x); 83union ieee754sp ieee754sp_fdp(union ieee754dp x);
91 84
92int ieee754sp_tint(union ieee754sp x); 85int ieee754sp_tint(union ieee754sp x);
93unsigned int ieee754sp_tuns(union ieee754sp x);
94s64 ieee754sp_tlong(union ieee754sp x); 86s64 ieee754sp_tlong(union ieee754sp x);
95u64 ieee754sp_tulong(union ieee754sp x);
96 87
97int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cop, int sig); 88int ieee754sp_cmp(union ieee754sp x, union ieee754sp y, int cop, int sig);
98/*
99 * basic sp math
100 */
101union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp * ip);
102union ieee754sp ieee754sp_frexp(union ieee754sp x, int *exp);
103union ieee754sp ieee754sp_ldexp(union ieee754sp x, int exp);
104
105union ieee754sp ieee754sp_ceil(union ieee754sp x);
106union ieee754sp ieee754sp_floor(union ieee754sp x);
107union ieee754sp ieee754sp_trunc(union ieee754sp x);
108 89
109union ieee754sp ieee754sp_sqrt(union ieee754sp x); 90union ieee754sp ieee754sp_sqrt(union ieee754sp x);
110 91
@@ -113,9 +94,6 @@ union ieee754sp ieee754sp_sqrt(union ieee754sp x);
113*/ 94*/
114int ieee754dp_class(union ieee754dp x); 95int ieee754dp_class(union ieee754dp x);
115 96
116/* x with sign of y */
117union ieee754dp ieee754dp_copysign(union ieee754dp x, union ieee754dp y);
118
119union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y); 97union ieee754dp ieee754dp_add(union ieee754dp x, union ieee754dp y);
120union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y); 98union ieee754dp ieee754dp_sub(union ieee754dp x, union ieee754dp y);
121union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y); 99union ieee754dp ieee754dp_mul(union ieee754dp x, union ieee754dp y);
@@ -123,38 +101,15 @@ union ieee754dp ieee754dp_div(union ieee754dp x, union ieee754dp y);
123 101
124union ieee754dp ieee754dp_abs(union ieee754dp x); 102union ieee754dp ieee754dp_abs(union ieee754dp x);
125union ieee754dp ieee754dp_neg(union ieee754dp x); 103union ieee754dp ieee754dp_neg(union ieee754dp x);
126union ieee754dp ieee754dp_scalb(union ieee754dp x, int);
127
128/* return exponent as integer in floating point format
129 */
130union ieee754dp ieee754dp_logb(union ieee754dp x);
131 104
132union ieee754dp ieee754dp_fint(int x); 105union ieee754dp ieee754dp_fint(int x);
133union ieee754dp ieee754dp_funs(unsigned x);
134union ieee754dp ieee754dp_flong(s64 x); 106union ieee754dp ieee754dp_flong(s64 x);
135union ieee754dp ieee754dp_fulong(u64 x);
136union ieee754dp ieee754dp_fsp(union ieee754sp x); 107union ieee754dp ieee754dp_fsp(union ieee754sp x);
137 108
138union ieee754dp ieee754dp_ceil(union ieee754dp x);
139union ieee754dp ieee754dp_floor(union ieee754dp x);
140union ieee754dp ieee754dp_trunc(union ieee754dp x);
141
142int ieee754dp_tint(union ieee754dp x); 109int ieee754dp_tint(union ieee754dp x);
143unsigned int ieee754dp_tuns(union ieee754dp x);
144s64 ieee754dp_tlong(union ieee754dp x); 110s64 ieee754dp_tlong(union ieee754dp x);
145u64 ieee754dp_tulong(union ieee754dp x);
146 111
147int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cop, int sig); 112int ieee754dp_cmp(union ieee754dp x, union ieee754dp y, int cop, int sig);
148/*
149 * basic sp math
150 */
151union ieee754dp ieee754dp_modf(union ieee754dp x, union ieee754dp * ip);
152union ieee754dp ieee754dp_frexp(union ieee754dp x, int *exp);
153union ieee754dp ieee754dp_ldexp(union ieee754dp x, int exp);
154
155union ieee754dp ieee754dp_ceil(union ieee754dp x);
156union ieee754dp ieee754dp_floor(union ieee754dp x);
157union ieee754dp ieee754dp_trunc(union ieee754dp x);
158 113
159union ieee754dp ieee754dp_sqrt(union ieee754dp x); 114union ieee754dp ieee754dp_sqrt(union ieee754dp x);
160 115
@@ -261,14 +216,6 @@ static inline int ieee754dp_ge(union ieee754dp x, union ieee754dp y)
261 return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0); 216 return ieee754dp_cmp(x, y, IEEE754_CGT | IEEE754_CEQ, 0);
262} 217}
263 218
264
265/*
266 * Like strtod
267 */
268union ieee754dp ieee754dp_fstr(const char *s, char **endp);
269char *ieee754dp_tstr(union ieee754dp x, int prec, int fmt, int af);
270
271
272/* 219/*
273 * The control status register 220 * The control status register
274 */ 221 */
diff --git a/arch/mips/math-emu/ieee754m.c b/arch/mips/math-emu/ieee754m.c
deleted file mode 100644
index 06224064333b..000000000000
--- a/arch/mips/math-emu/ieee754m.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * floor, trunc, ceil
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754.h"
28
29union ieee754dp ieee754dp_floor(union ieee754dp x)
30{
31 union ieee754dp i;
32
33 if (ieee754dp_lt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
34 return ieee754dp_sub(i, ieee754dp_one(0));
35 else
36 return i;
37}
38
39union ieee754dp ieee754dp_ceil(union ieee754dp x)
40{
41 union ieee754dp i;
42
43 if (ieee754dp_gt(ieee754dp_modf(x, &i), ieee754dp_zero(0)))
44 return ieee754dp_add(i, ieee754dp_one(0));
45 else
46 return i;
47}
48
49union ieee754dp ieee754dp_trunc(union ieee754dp x)
50{
51 union ieee754dp i;
52
53 (void) ieee754dp_modf(x, &i);
54 return i;
55}
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c
index 9574d25f6122..0d01200793d1 100644
--- a/arch/mips/math-emu/sp_fint.c
+++ b/arch/mips/math-emu/sp_fint.c
@@ -68,12 +68,3 @@ union ieee754sp ieee754sp_fint(int x)
68 } 68 }
69 SPNORMRET1(xs, xe, xm, "fint", x); 69 SPNORMRET1(xs, xe, xm, "fint", x);
70} 70}
71
72
73union ieee754sp ieee754sp_funs(unsigned int u)
74{
75 if ((int) u < 0)
76 return ieee754sp_add(ieee754sp_1e31(),
77 ieee754sp_fint(u & ~(1 << 31)));
78 return ieee754sp_fint(u);
79}
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c
index 65c7e7e67b60..b26c155cc3e6 100644
--- a/arch/mips/math-emu/sp_flong.c
+++ b/arch/mips/math-emu/sp_flong.c
@@ -67,12 +67,3 @@ union ieee754sp ieee754sp_flong(s64 x)
67 } 67 }
68 SPNORMRET1(xs, xe, xm, "sp_flong", x); 68 SPNORMRET1(xs, xe, xm, "sp_flong", x);
69} 69}
70
71
72union ieee754sp ieee754sp_fulong(u64 u)
73{
74 if ((s64) u < 0)
75 return ieee754sp_add(ieee754sp_1e63(),
76 ieee754sp_flong(u & ~(1ULL << 63)));
77 return ieee754sp_flong(u);
78}
diff --git a/arch/mips/math-emu/sp_frexp.c b/arch/mips/math-emu/sp_frexp.c
deleted file mode 100644
index 72cedb088506..000000000000
--- a/arch/mips/math-emu/sp_frexp.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754sp.h"
28
29/* close to ieeep754sp_logb
30*/
31union ieee754sp ieee754sp_frexp(union ieee754sp x, int *eptr)
32{
33 COMPXSP;
34 ieee754_clearcx();
35 EXPLODEXSP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 case IEEE754_CLASS_QNAN:
40 case IEEE754_CLASS_INF:
41 case IEEE754_CLASS_ZERO:
42 *eptr = 0;
43 return x;
44 case IEEE754_CLASS_DNORM:
45 SPDNORMX;
46 break;
47 case IEEE754_CLASS_NORM:
48 break;
49 }
50 *eptr = xe + 1;
51 return buildsp(xs, -1 + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
52}
diff --git a/arch/mips/math-emu/sp_logb.c b/arch/mips/math-emu/sp_logb.c
deleted file mode 100644
index 82c122c9a447..000000000000
--- a/arch/mips/math-emu/sp_logb.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754sp.h"
28
29union ieee754sp ieee754sp_logb(union ieee754sp x)
30{
31 COMPXSP;
32
33 ieee754_clearcx();
34
35 EXPLODEXSP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 return ieee754sp_nanxcpt(x, "logb", x);
40 case IEEE754_CLASS_QNAN:
41 return x;
42 case IEEE754_CLASS_INF:
43 return ieee754sp_inf(0);
44 case IEEE754_CLASS_ZERO:
45 return ieee754sp_inf(1);
46 case IEEE754_CLASS_DNORM:
47 SPDNORMX;
48 break;
49 case IEEE754_CLASS_NORM:
50 break;
51 }
52 return ieee754sp_fint(xe);
53}
diff --git a/arch/mips/math-emu/sp_modf.c b/arch/mips/math-emu/sp_modf.c
deleted file mode 100644
index 5f361a7a10b6..000000000000
--- a/arch/mips/math-emu/sp_modf.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754sp.h"
28
29/* modf function is always exact for a finite number
30*/
31union ieee754sp ieee754sp_modf(union ieee754sp x, union ieee754sp *ip)
32{
33 COMPXSP;
34
35 ieee754_clearcx();
36
37 EXPLODEXSP;
38
39 switch (xc) {
40 case IEEE754_CLASS_SNAN:
41 case IEEE754_CLASS_QNAN:
42 case IEEE754_CLASS_INF:
43 case IEEE754_CLASS_ZERO:
44 *ip = x;
45 return x;
46 case IEEE754_CLASS_DNORM:
47 /* far to small */
48 *ip = ieee754sp_zero(xs);
49 return x;
50 case IEEE754_CLASS_NORM:
51 break;
52 }
53 if (xe < 0) {
54 *ip = ieee754sp_zero(xs);
55 return x;
56 }
57 if (xe >= SP_FBITS) {
58 *ip = x;
59 return ieee754sp_zero(xs);
60 }
61 /* generate ipart mantissa by clearing bottom bits
62 */
63 *ip = buildsp(xs, xe + SP_EBIAS,
64 ((xm >> (SP_FBITS - xe)) << (SP_FBITS - xe)) &
65 ~SP_HIDDEN_BIT);
66
67 /* generate fpart mantissa by clearing top bits
68 * and normalizing (must be able to normalize)
69 */
70 xm = (xm << (32 - (SP_FBITS - xe))) >> (32 - (SP_FBITS - xe));
71 if (xm == 0)
72 return ieee754sp_zero(xs);
73
74 while ((xm >> SP_FBITS) == 0) {
75 xm <<= 1;
76 xe--;
77 }
78 return buildsp(xs, xe + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
79}
diff --git a/arch/mips/math-emu/sp_scalb.c b/arch/mips/math-emu/sp_scalb.c
deleted file mode 100644
index cc8f1b82d2a9..000000000000
--- a/arch/mips/math-emu/sp_scalb.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/* IEEE754 floating point arithmetic
2 * single precision
3 */
4/*
5 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 */
25
26
27#include "ieee754sp.h"
28
29union ieee754sp ieee754sp_scalb(union ieee754sp x, int n)
30{
31 COMPXSP;
32
33 ieee754_clearcx();
34
35 EXPLODEXSP;
36
37 switch (xc) {
38 case IEEE754_CLASS_SNAN:
39 return ieee754sp_nanxcpt(x, "scalb", x, n);
40 case IEEE754_CLASS_QNAN:
41 case IEEE754_CLASS_INF:
42 case IEEE754_CLASS_ZERO:
43 return x;
44 case IEEE754_CLASS_DNORM:
45 SPDNORMX;
46 break;
47 case IEEE754_CLASS_NORM:
48 break;
49 }
50 SPNORMRET2(xs, xe + n, xm << 3, "scalb", x, n);
51}
52
53
54union ieee754sp ieee754sp_ldexp(union ieee754sp x, int n)
55{
56 return ieee754sp_scalb(x, n);
57}
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index b63e9fb7ef4e..0f5fd57e2cac 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -26,14 +26,6 @@
26 26
27#include "ieee754sp.h" 27#include "ieee754sp.h"
28 28
29union ieee754sp ieee754sp_copysign(union ieee754sp x, union ieee754sp y)
30{
31 ieee754_clearcx();
32 SPSIGN(x) = SPSIGN(y);
33 return x;
34}
35
36
37union ieee754sp ieee754sp_neg(union ieee754sp x) 29union ieee754sp ieee754sp_neg(union ieee754sp x)
38{ 30{
39 COMPXSP; 31 COMPXSP;
diff --git a/arch/mips/math-emu/sp_tint.c b/arch/mips/math-emu/sp_tint.c
index 709f6bcd490b..690cb5b4cfa8 100644
--- a/arch/mips/math-emu/sp_tint.c
+++ b/arch/mips/math-emu/sp_tint.c
@@ -110,16 +110,3 @@ int ieee754sp_tint(union ieee754sp x)
110 else 110 else
111 return xm; 111 return xm;
112} 112}
113
114
115unsigned int ieee754sp_tuns(union ieee754sp x)
116{
117 union ieee754sp hb = ieee754sp_1e31();
118
119 /* what if x < 0 ?? */
120 if (ieee754sp_lt(x, hb))
121 return (unsigned) ieee754sp_tint(x);
122
123 return (unsigned) ieee754sp_tint(ieee754sp_sub(x, hb)) |
124 ((unsigned) 1 << 31);
125}
diff --git a/arch/mips/math-emu/sp_tlong.c b/arch/mips/math-emu/sp_tlong.c
index e979aa757079..346cbad4a1ae 100644
--- a/arch/mips/math-emu/sp_tlong.c
+++ b/arch/mips/math-emu/sp_tlong.c
@@ -107,16 +107,3 @@ s64 ieee754sp_tlong(union ieee754sp x)
107 else 107 else
108 return xm; 108 return xm;
109} 109}
110
111
112u64 ieee754sp_tulong(union ieee754sp x)
113{
114 union ieee754sp hb = ieee754sp_1e63();
115
116 /* what if x < 0 ?? */
117 if (ieee754sp_lt(x, hb))
118 return (u64) ieee754sp_tlong(x);
119
120 return (u64) ieee754sp_tlong(ieee754sp_sub(x, hb)) |
121 (1ULL << 63);
122}