4 * MIPS floating point support
6 * Copyright (C) 1994-2000 Algorithmics Ltd.
8 * This program is free software; you can distribute it and/or modify it
9 * under the terms of the GNU General Public License (Version 2) as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Modified to build and operate in Linux kernel environment.
24 * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
25 * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved.
28 #include <linux/types.h>
29 #include <linux/printk.h>
31 #include "ieee754sp.h"
32 #include "ieee754dp.h"
34 union ieee754dp
ieee754dp_dump(char *m
, union ieee754dp x
)
39 printk("<%08x,%08x>\n", (unsigned) (x
.bits
>> 32),
42 switch (ieee754dp_class(x
)) {
43 case IEEE754_CLASS_QNAN
:
44 case IEEE754_CLASS_SNAN
:
45 printk("Nan %c", DPSIGN(x
) ? '-' : '+');
46 for (i
= DP_FBITS
- 1; i
>= 0; i
--)
47 printk("%c", DPMANT(x
) & DP_MBIT(i
) ? '1' : '0');
49 case IEEE754_CLASS_INF
:
50 printk("%cInfinity", DPSIGN(x
) ? '-' : '+');
52 case IEEE754_CLASS_ZERO
:
53 printk("%cZero", DPSIGN(x
) ? '-' : '+');
55 case IEEE754_CLASS_DNORM
:
56 printk("%c0.", DPSIGN(x
) ? '-' : '+');
57 for (i
= DP_FBITS
- 1; i
>= 0; i
--)
58 printk("%c", DPMANT(x
) & DP_MBIT(i
) ? '1' : '0');
59 printk("e%d", DPBEXP(x
) - DP_EBIAS
);
61 case IEEE754_CLASS_NORM
:
62 printk("%c1.", DPSIGN(x
) ? '-' : '+');
63 for (i
= DP_FBITS
- 1; i
>= 0; i
--)
64 printk("%c", DPMANT(x
) & DP_MBIT(i
) ? '1' : '0');
65 printk("e%d", DPBEXP(x
) - DP_EBIAS
);
68 printk("Illegal/Unknown IEEE754 value class");
74 union ieee754sp
ieee754sp_dump(char *m
, union ieee754sp x
)
79 printk("<%08x>\n", (unsigned) x
.bits
);
81 switch (ieee754sp_class(x
)) {
82 case IEEE754_CLASS_QNAN
:
83 case IEEE754_CLASS_SNAN
:
84 printk("Nan %c", SPSIGN(x
) ? '-' : '+');
85 for (i
= SP_FBITS
- 1; i
>= 0; i
--)
86 printk("%c", SPMANT(x
) & SP_MBIT(i
) ? '1' : '0');
88 case IEEE754_CLASS_INF
:
89 printk("%cInfinity", SPSIGN(x
) ? '-' : '+');
91 case IEEE754_CLASS_ZERO
:
92 printk("%cZero", SPSIGN(x
) ? '-' : '+');
94 case IEEE754_CLASS_DNORM
:
95 printk("%c0.", SPSIGN(x
) ? '-' : '+');
96 for (i
= SP_FBITS
- 1; i
>= 0; i
--)
97 printk("%c", SPMANT(x
) & SP_MBIT(i
) ? '1' : '0');
98 printk("e%d", SPBEXP(x
) - SP_EBIAS
);
100 case IEEE754_CLASS_NORM
:
101 printk("%c1.", SPSIGN(x
) ? '-' : '+');
102 for (i
= SP_FBITS
- 1; i
>= 0; i
--)
103 printk("%c", SPMANT(x
) & SP_MBIT(i
) ? '1' : '0');
104 printk("e%d", SPBEXP(x
) - SP_EBIAS
);
107 printk("Illegal/Unknown IEEE754 value class");