2 * IEEE754 floating point
3 * common internal header file
6 * MIPS floating point support
7 * Copyright (C) 1994-2000 Algorithmics Ltd.
9 * ########################################################################
11 * This program is free software; you can distribute it and/or modify it
12 * under the terms of the GNU General Public License (Version 2) as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
24 * ########################################################################
31 #define DP_EMIN (-1022)
36 #define SP_EMIN (-126)
40 #define DP_MBIT(x) ((u64)1 << (x))
41 #define DP_HIDDEN_BIT DP_MBIT(DP_MBITS)
42 #define DP_SIGN_BIT DP_MBIT(63)
44 #define SP_MBIT(x) ((u32)1 << (x))
45 #define SP_HIDDEN_BIT SP_MBIT(SP_MBITS)
46 #define SP_SIGN_BIT SP_MBIT(31)
49 #define SPSIGN(sp) (sp.parts.sign)
50 #define SPBEXP(sp) (sp.parts.bexp)
51 #define SPMANT(sp) (sp.parts.mant)
53 #define DPSIGN(dp) (dp.parts.sign)
54 #define DPBEXP(dp) (dp.parts.bexp)
55 #define DPMANT(dp) (dp.parts.mant)
57 #define CLPAIR(x, y) ((x)*6+(y))
63 (ieee754_csr.cx |= (x), ieee754_csr.sx |= (x))
65 #define SETANDTESTCX(x) \
66 (SETCX(x), ieee754_csr.mx & (x))
69 (ieee754_csr.cx & ieee754_csr.mx)
73 unsigned xm; int xe; int xs __maybe_unused; int xc
76 unsigned ym; int ye; int ys; int yc
78 #define EXPLODESP(v, vc, vs, ve, vm) \
83 if(ve == SP_EMAX+1+SP_EBIAS){\
85 vc = IEEE754_CLASS_INF;\
86 else if(vm & SP_MBIT(SP_MBITS-1)) \
87 vc = IEEE754_CLASS_SNAN;\
89 vc = IEEE754_CLASS_QNAN;\
90 } else if(ve == SP_EMIN-1+SP_EBIAS) {\
93 vc = IEEE754_CLASS_DNORM;\
95 vc = IEEE754_CLASS_ZERO;\
99 vc = IEEE754_CLASS_NORM;\
102 #define EXPLODEXSP EXPLODESP(x, xc, xs, xe, xm)
103 #define EXPLODEYSP EXPLODESP(y, yc, ys, ye, ym)
107 u64 xm; int xe; int xs __maybe_unused; int xc
110 u64 ym; int ye; int ys; int yc
112 #define EXPLODEDP(v, vc, vs, ve, vm) \
117 if(ve == DP_EMAX+1+DP_EBIAS){\
119 vc = IEEE754_CLASS_INF;\
120 else if(vm & DP_MBIT(DP_MBITS-1)) \
121 vc = IEEE754_CLASS_SNAN;\
123 vc = IEEE754_CLASS_QNAN;\
124 } else if(ve == DP_EMIN-1+DP_EBIAS) {\
127 vc = IEEE754_CLASS_DNORM;\
129 vc = IEEE754_CLASS_ZERO;\
132 vm |= DP_HIDDEN_BIT;\
133 vc = IEEE754_CLASS_NORM;\
136 #define EXPLODEXDP EXPLODEDP(x, xc, xs, xe, xm)
137 #define EXPLODEYDP EXPLODEDP(y, yc, ys, ye, ym)
139 #define FLUSHDP(v, vc, vs, ve, vm) \
140 if(vc==IEEE754_CLASS_DNORM) {\
141 if(ieee754_csr.nod) {\
142 SETCX(IEEE754_INEXACT);\
143 vc = IEEE754_CLASS_ZERO;\
144 ve = DP_EMIN-1+DP_EBIAS;\
146 v = ieee754dp_zero(vs);\
150 #define FLUSHSP(v, vc, vs, ve, vm) \
151 if(vc==IEEE754_CLASS_DNORM) {\
152 if(ieee754_csr.nod) {\
153 SETCX(IEEE754_INEXACT);\
154 vc = IEEE754_CLASS_ZERO;\
155 ve = SP_EMIN-1+SP_EBIAS;\
157 v = ieee754sp_zero(vs);\
161 #define FLUSHXDP FLUSHDP(x, xc, xs, xe, xm)
162 #define FLUSHYDP FLUSHDP(y, yc, ys, ye, ym)
163 #define FLUSHXSP FLUSHSP(x, xc, xs, xe, xm)
164 #define FLUSHYSP FLUSHSP(y, yc, ys, ye, ym)
This page took 0.033368 seconds and 5 git commands to generate.