93 |
#define STATUS(field) status->field |
#define STATUS(field) status->field |
94 |
#define STATUS_VAR , status |
#define STATUS_VAR , status |
95 |
|
|
96 |
|
/*---------------------------------------------------------------------------- |
97 |
|
| Software IEC/IEEE floating-point ordering relations |
98 |
|
*----------------------------------------------------------------------------*/ |
99 |
|
enum { |
100 |
|
float_relation_less = -1, |
101 |
|
float_relation_equal = 0, |
102 |
|
float_relation_greater = 1, |
103 |
|
float_relation_unordered = 2 |
104 |
|
}; |
105 |
|
|
106 |
#ifdef CONFIG_SOFTFLOAT |
#ifdef CONFIG_SOFTFLOAT |
107 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
108 |
| Software IEC/IEEE floating-point types. |
| Software IEC/IEEE floating-point types. |
164 |
} float_status; |
} float_status; |
165 |
|
|
166 |
void set_float_rounding_mode(int val STATUS_PARAM); |
void set_float_rounding_mode(int val STATUS_PARAM); |
167 |
|
void set_float_exception_flags(int val STATUS_PARAM); |
168 |
|
INLINE int get_float_exception_flags(float_status *status) |
169 |
|
{ |
170 |
|
return STATUS(float_exception_flags); |
171 |
|
} |
172 |
#ifdef FLOATX80 |
#ifdef FLOATX80 |
173 |
void set_floatx80_rounding_precision(int val STATUS_PARAM); |
void set_floatx80_rounding_precision(int val STATUS_PARAM); |
174 |
#endif |
#endif |
184 |
*----------------------------------------------------------------------------*/ |
*----------------------------------------------------------------------------*/ |
185 |
float32 int32_to_float32( int STATUS_PARAM ); |
float32 int32_to_float32( int STATUS_PARAM ); |
186 |
float64 int32_to_float64( int STATUS_PARAM ); |
float64 int32_to_float64( int STATUS_PARAM ); |
187 |
|
float32 uint32_to_float32( unsigned int STATUS_PARAM ); |
188 |
|
float64 uint32_to_float64( unsigned int STATUS_PARAM ); |
189 |
#ifdef FLOATX80 |
#ifdef FLOATX80 |
190 |
floatx80 int32_to_floatx80( int STATUS_PARAM ); |
floatx80 int32_to_floatx80( int STATUS_PARAM ); |
191 |
#endif |
#endif |
206 |
*----------------------------------------------------------------------------*/ |
*----------------------------------------------------------------------------*/ |
207 |
int float32_to_int32( float32 STATUS_PARAM ); |
int float32_to_int32( float32 STATUS_PARAM ); |
208 |
int float32_to_int32_round_to_zero( float32 STATUS_PARAM ); |
int float32_to_int32_round_to_zero( float32 STATUS_PARAM ); |
209 |
|
unsigned int float32_to_uint32( float32 STATUS_PARAM ); |
210 |
|
unsigned int float32_to_uint32_round_to_zero( float32 STATUS_PARAM ); |
211 |
int64_t float32_to_int64( float32 STATUS_PARAM ); |
int64_t float32_to_int64( float32 STATUS_PARAM ); |
212 |
int64_t float32_to_int64_round_to_zero( float32 STATUS_PARAM ); |
int64_t float32_to_int64_round_to_zero( float32 STATUS_PARAM ); |
213 |
float64 float32_to_float64( float32 STATUS_PARAM ); |
float64 float32_to_float64( float32 STATUS_PARAM ); |
234 |
char float32_eq_signaling( float32, float32 STATUS_PARAM ); |
char float32_eq_signaling( float32, float32 STATUS_PARAM ); |
235 |
char float32_le_quiet( float32, float32 STATUS_PARAM ); |
char float32_le_quiet( float32, float32 STATUS_PARAM ); |
236 |
char float32_lt_quiet( float32, float32 STATUS_PARAM ); |
char float32_lt_quiet( float32, float32 STATUS_PARAM ); |
237 |
|
char float32_compare( float32, float32 STATUS_PARAM ); |
238 |
|
char float32_compare_quiet( float32, float32 STATUS_PARAM ); |
239 |
char float32_is_signaling_nan( float32 ); |
char float32_is_signaling_nan( float32 ); |
240 |
|
|
241 |
|
INLINE float32 float32_abs(float32 a) |
242 |
|
{ |
243 |
|
return a & 0x7fffffff; |
244 |
|
} |
245 |
|
|
246 |
|
INLINE float32 float32_chs(float32 a) |
247 |
|
{ |
248 |
|
return a ^ 0x80000000; |
249 |
|
} |
250 |
|
|
251 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
252 |
| Software IEC/IEEE double-precision conversion routines. |
| Software IEC/IEEE double-precision conversion routines. |
253 |
*----------------------------------------------------------------------------*/ |
*----------------------------------------------------------------------------*/ |
254 |
int float64_to_int32( float64 STATUS_PARAM ); |
int float64_to_int32( float64 STATUS_PARAM ); |
255 |
int float64_to_int32_round_to_zero( float64 STATUS_PARAM ); |
int float64_to_int32_round_to_zero( float64 STATUS_PARAM ); |
256 |
|
unsigned int float64_to_uint32( float64 STATUS_PARAM ); |
257 |
|
unsigned int float64_to_uint32_round_to_zero( float64 STATUS_PARAM ); |
258 |
int64_t float64_to_int64( float64 STATUS_PARAM ); |
int64_t float64_to_int64( float64 STATUS_PARAM ); |
259 |
int64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM ); |
int64_t float64_to_int64_round_to_zero( float64 STATUS_PARAM ); |
260 |
float32 float64_to_float32( float64 STATUS_PARAM ); |
float32 float64_to_float32( float64 STATUS_PARAM ); |
281 |
char float64_eq_signaling( float64, float64 STATUS_PARAM ); |
char float64_eq_signaling( float64, float64 STATUS_PARAM ); |
282 |
char float64_le_quiet( float64, float64 STATUS_PARAM ); |
char float64_le_quiet( float64, float64 STATUS_PARAM ); |
283 |
char float64_lt_quiet( float64, float64 STATUS_PARAM ); |
char float64_lt_quiet( float64, float64 STATUS_PARAM ); |
284 |
|
char float64_compare( float64, float64 STATUS_PARAM ); |
285 |
|
char float64_compare_quiet( float64, float64 STATUS_PARAM ); |
286 |
char float64_is_signaling_nan( float64 ); |
char float64_is_signaling_nan( float64 ); |
287 |
|
|
288 |
|
INLINE float64 float64_abs(float64 a) |
289 |
|
{ |
290 |
|
return a & 0x7fffffffffffffffLL; |
291 |
|
} |
292 |
|
|
293 |
|
INLINE float64 float64_chs(float64 a) |
294 |
|
{ |
295 |
|
return a ^ 0x8000000000000000LL; |
296 |
|
} |
297 |
|
|
298 |
#ifdef FLOATX80 |
#ifdef FLOATX80 |
299 |
|
|
300 |
/*---------------------------------------------------------------------------- |
/*---------------------------------------------------------------------------- |
328 |
char floatx80_lt_quiet( floatx80, floatx80 STATUS_PARAM ); |
char floatx80_lt_quiet( floatx80, floatx80 STATUS_PARAM ); |
329 |
char floatx80_is_signaling_nan( floatx80 ); |
char floatx80_is_signaling_nan( floatx80 ); |
330 |
|
|
331 |
|
INLINE floatx80 floatx80_abs(floatx80 a) |
332 |
|
{ |
333 |
|
a.high &= 0x7fff; |
334 |
|
return a; |
335 |
|
} |
336 |
|
|
337 |
|
INLINE floatx80 floatx80_chs(floatx80 a) |
338 |
|
{ |
339 |
|
a.high ^= 0x8000; |
340 |
|
return a; |
341 |
|
} |
342 |
|
|
343 |
#endif |
#endif |
344 |
|
|
345 |
#ifdef FLOAT128 |
#ifdef FLOAT128 |
375 |
char float128_lt_quiet( float128, float128 STATUS_PARAM ); |
char float128_lt_quiet( float128, float128 STATUS_PARAM ); |
376 |
char float128_is_signaling_nan( float128 ); |
char float128_is_signaling_nan( float128 ); |
377 |
|
|
378 |
|
INLINE float128 float128_abs(float128 a) |
379 |
|
{ |
380 |
|
a.high &= 0x7fffffffffffffffLL; |
381 |
|
return a; |
382 |
|
} |
383 |
|
|
384 |
|
INLINE float128 float128_chs(float128 a) |
385 |
|
{ |
386 |
|
a.high ^= 0x8000000000000000LL; |
387 |
|
return a; |
388 |
|
} |
389 |
|
|
390 |
#endif |
#endif |
391 |
|
|
392 |
#else /* CONFIG_SOFTFLOAT */ |
#else /* CONFIG_SOFTFLOAT */ |