Go to the documentation of this file.
24 #ifndef __MATH_EMU_SOFT_FP_H__
25 #define __MATH_EMU_SOFT_FP_H__
27 #include <asm/sfp-machine.h>
34 #define _FP_WORKBITS 3
35 #define _FP_WORK_LSB ((_FP_W_TYPE)1 << 3)
36 #define _FP_WORK_ROUND ((_FP_W_TYPE)1 << 2)
37 #define _FP_WORK_GUARD ((_FP_W_TYPE)1 << 1)
38 #define _FP_WORK_STICKY ((_FP_W_TYPE)1 << 0)
40 #ifndef FP_RND_NEAREST
41 # define FP_RND_NEAREST 0
42 # define FP_RND_ZERO 1
43 # define FP_RND_PINF 2
44 # define FP_RND_MINF 3
46 # define FP_ROUNDMODE FP_RND_NEAREST
52 #define FP_EX_INVALID 0
54 #ifndef FP_EX_INVALID_SNAN
55 #define FP_EX_INVALID_SNAN 0
58 #ifndef FP_EX_INVALID_ISI
59 #define FP_EX_INVALID_ISI 0
62 #ifndef FP_EX_INVALID_IDI
63 #define FP_EX_INVALID_IDI 0
66 #ifndef FP_EX_INVALID_ZDZ
67 #define FP_EX_INVALID_ZDZ 0
70 #ifndef FP_EX_INVALID_IMZ
71 #define FP_EX_INVALID_IMZ 0
73 #ifndef FP_EX_OVERFLOW
74 #define FP_EX_OVERFLOW 0
76 #ifndef FP_EX_UNDERFLOW
77 #define FP_EX_UNDERFLOW
80 #define FP_EX_DIVZERO 0
83 #define FP_EX_INEXACT 0
86 #define FP_EX_DENORM 0
94 #define FP_DECL_EX int _fex = 0
97 #ifndef FP_INIT_ROUNDMODE
98 #define FP_INIT_ROUNDMODE do {} while (0)
101 #ifndef FP_HANDLE_EXCEPTIONS
102 #define FP_HANDLE_EXCEPTIONS do {} while (0)
106 #ifndef FP_DENORM_ZERO
107 #define FP_DENORM_ZERO 0
110 #ifndef FP_INHIBIT_RESULTS
116 #define FP_INHIBIT_RESULTS 0
119 #ifndef FP_TRAPPING_EXCEPTIONS
120 #define FP_TRAPPING_EXCEPTIONS 0
123 #define FP_SET_EXCEPTION(ex) \
126 #define FP_UNSET_EXCEPTION(ex) \
129 #define FP_CUR_EXCEPTIONS \
132 #define FP_CLEAR_EXCEPTIONS \
135 #define _FP_ROUND_NEAREST(wc, X) \
137 if ((_FP_FRAC_LOW_##wc(X) & 15) != _FP_WORK_ROUND) \
138 _FP_FRAC_ADDI_##wc(X, _FP_WORK_ROUND); \
141 #define _FP_ROUND_ZERO(wc, X) 0
143 #define _FP_ROUND_PINF(wc, X) \
145 if (!X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
146 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
149 #define _FP_ROUND_MINF(wc, X) \
151 if (X##_s && (_FP_FRAC_LOW_##wc(X) & 7)) \
152 _FP_FRAC_ADDI_##wc(X, _FP_WORK_LSB); \
155 #define _FP_ROUND(wc, X) \
157 if (_FP_FRAC_LOW_##wc(X) & 7) \
158 FP_SET_EXCEPTION(FP_EX_INEXACT); \
159 switch (FP_ROUNDMODE) \
161 case FP_RND_NEAREST: \
162 _FP_ROUND_NEAREST(wc,X); \
165 _FP_ROUND_ZERO(wc,X); \
168 _FP_ROUND_PINF(wc,X); \
171 _FP_ROUND_MINF(wc,X); \
176 #define FP_CLS_NORMAL 0
177 #define FP_CLS_ZERO 1
181 #define _FP_CLS_COMBINE(x,y) (((x) << 2) | (y))
190 #define UWtype _FP_W_TYPE
191 #define W_TYPE_SIZE _FP_W_TYPE_SIZE
197 #if _FP_W_TYPE_SIZE == 32
199 #elif _FP_W_TYPE_SIZE == 64
204 #include <stdlib/longlong.h>