Go to the documentation of this file.
24 #ifndef __ARCH_MIPS_MATH_EMU_IEEE754_H
25 #define __ARCH_MIPS_MATH_EMU_IEEE754_H
27 #include <asm/byteorder.h>
28 #include <linux/types.h>
29 #include <linux/sched.h>
39 #ifdef __LITTLE_ENDIAN
40 struct ieee754dp_konst {
46 struct ieee754sp_konst {
52 typedef union _ieee754dp {
53 struct ieee754dp_konst oparts;
63 typedef union _ieee754sp {
64 struct ieee754sp_konst
parts;
71 struct ieee754dp_konst {
78 typedef union _ieee754dp {
79 struct ieee754dp_konst oparts;
89 struct ieee754sp_konst {
95 typedef union _ieee754sp {
96 struct ieee754sp_konst
parts;
201 #define IEEE754_CLASS_NORM 0x00
202 #define IEEE754_CLASS_ZERO 0x01
203 #define IEEE754_CLASS_DNORM 0x02
204 #define IEEE754_CLASS_INF 0x03
205 #define IEEE754_CLASS_SNAN 0x04
206 #define IEEE754_CLASS_QNAN 0x05
209 #define IEEE754_INEXACT 0x01
210 #define IEEE754_UNDERFLOW 0x02
211 #define IEEE754_OVERFLOW 0x04
212 #define IEEE754_ZERO_DIVIDE 0x08
213 #define IEEE754_INVALID_OPERATION 0x10
217 #define IEEE754_CLT 0x01
218 #define IEEE754_CEQ 0x02
219 #define IEEE754_CGT 0x04
220 #define IEEE754_CUN 0x08
230 #define IEEE754_RM IEEE754_RD
231 #define IEEE754_RP IEEE754_RU
235 static inline int ieee754sp_eq(ieee754sp
x, ieee754sp
y)
240 static inline int ieee754sp_ne(ieee754sp
x, ieee754sp
y)
246 static inline int ieee754sp_lt(ieee754sp
x, ieee754sp
y)
251 static inline int ieee754sp_le(ieee754sp
x, ieee754sp
y)
256 static inline int ieee754sp_gt(ieee754sp
x, ieee754sp
y)
262 static inline int ieee754sp_ge(ieee754sp
x, ieee754sp
y)
267 static inline int ieee754dp_eq(ieee754dp
x, ieee754dp
y)
272 static inline int ieee754dp_ne(ieee754dp
x, ieee754dp
y)
278 static inline int ieee754dp_lt(ieee754dp
x, ieee754dp
y)
283 static inline int ieee754dp_le(ieee754dp
x, ieee754dp
y)
288 static inline int ieee754dp_gt(ieee754dp
x, ieee754dp
y)
293 static inline int ieee754dp_ge(ieee754dp
x, ieee754dp
y)
320 #ifdef __LITTLE_ENDIAN
331 #define ieee754_csr (*(struct _ieee754_csr *)(¤t->thread.fpu.fcr31))
333 static inline unsigned ieee754_getrm(
void)
337 static inline unsigned ieee754_setrm(
unsigned rm)
345 static inline unsigned ieee754_getcx(
void)
352 static inline int ieee754_cxtest(
unsigned n)
360 static inline unsigned ieee754_getsx(
void)
367 static inline unsigned ieee754_clrsx(
void)
374 static inline int ieee754_sxtest(
unsigned n)
383 #define IEEE754_SPCVAL_PZERO 0
384 #define IEEE754_SPCVAL_NZERO 1
385 #define IEEE754_SPCVAL_PONE 2
386 #define IEEE754_SPCVAL_NONE 3
387 #define IEEE754_SPCVAL_PTEN 4
388 #define IEEE754_SPCVAL_NTEN 5
389 #define IEEE754_SPCVAL_PINFINITY 6
390 #define IEEE754_SPCVAL_NINFINITY 7
391 #define IEEE754_SPCVAL_INDEF 8
392 #define IEEE754_SPCVAL_PMAX 9
393 #define IEEE754_SPCVAL_NMAX 10
394 #define IEEE754_SPCVAL_PMIN 11
395 #define IEEE754_SPCVAL_NMIN 12
396 #define IEEE754_SPCVAL_PMIND 13
397 #define IEEE754_SPCVAL_NMIND 14
398 #define IEEE754_SPCVAL_P1E31 15
399 #define IEEE754_SPCVAL_P1E63 16
403 #define ieee754dp_spcvals ((const ieee754dp *)__ieee754dp_spcvals)
404 #define ieee754sp_spcvals ((const ieee754sp *)__ieee754sp_spcvals)
409 #define ieee754dp_inf(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)])
410 #define ieee754dp_zero(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PZERO+(sn)])
411 #define ieee754dp_one(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PONE+(sn)])
412 #define ieee754dp_ten(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PTEN+(sn)])
413 #define ieee754dp_indef() (ieee754dp_spcvals[IEEE754_SPCVAL_INDEF])
414 #define ieee754dp_max(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMAX+(sn)])
415 #define ieee754dp_min(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMIN+(sn)])
416 #define ieee754dp_mind(sn) (ieee754dp_spcvals[IEEE754_SPCVAL_PMIND+(sn)])
417 #define ieee754dp_1e31() (ieee754dp_spcvals[IEEE754_SPCVAL_P1E31])
418 #define ieee754dp_1e63() (ieee754dp_spcvals[IEEE754_SPCVAL_P1E63])
420 #define ieee754sp_inf(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PINFINITY+(sn)])
421 #define ieee754sp_zero(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PZERO+(sn)])
422 #define ieee754sp_one(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PONE+(sn)])
423 #define ieee754sp_ten(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PTEN+(sn)])
424 #define ieee754sp_indef() (ieee754sp_spcvals[IEEE754_SPCVAL_INDEF])
425 #define ieee754sp_max(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMAX+(sn)])
426 #define ieee754sp_min(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMIN+(sn)])
427 #define ieee754sp_mind(sn) (ieee754sp_spcvals[IEEE754_SPCVAL_PMIND+(sn)])
428 #define ieee754sp_1e31() (ieee754sp_spcvals[IEEE754_SPCVAL_P1E31])
429 #define ieee754sp_1e63() (ieee754sp_spcvals[IEEE754_SPCVAL_P1E63])
434 #define ieee754si_indef() INT_MAX
436 #define ieee754di_indef() LONG_LONG_MAX
438 #define ieee754di_indef() ((s64)(~0ULL>>1))
458 #define IEEE754_RT_SP 0
459 #define IEEE754_RT_DP 1
460 #define IEEE754_RT_XP 2
461 #define IEEE754_RT_SI 3
462 #define IEEE754_RT_DI 4
467 #define ieee754dp_fix(x) ieee754dp_tint(x)
468 #define ieee754sp_fix(x) ieee754sp_tint(x)