xref: /freebsd/sys/powerpc/include/ieeefp.h (revision adc9dcf3e39318e7e04676df0f6a07b5dcca7aa0)
160727d8bSWarner Losh /* -
2eeaa8979SBenno Rice  * Written by J.T. Conklin, Apr 6, 1995
3eeaa8979SBenno Rice  * Public domain.
4eeaa8979SBenno Rice  * $NetBSD: ieeefp.h,v 1.2 1999/07/07 01:52:26 danw Exp $
5eeaa8979SBenno Rice  * $FreeBSD$
6eeaa8979SBenno Rice  */
7eeaa8979SBenno Rice 
8eeaa8979SBenno Rice #ifndef _MACHINE_IEEEFP_H_
9eeaa8979SBenno Rice #define _MACHINE_IEEEFP_H_
10eeaa8979SBenno Rice 
11a50079b7SDavid Schultz /* Deprecated historical FPU control interface */
12a50079b7SDavid Schultz 
13eeaa8979SBenno Rice typedef int fp_except_t;
14*adc9dcf3SJustin Hibbits #ifdef __SPE__
15*adc9dcf3SJustin Hibbits #define FP_X_OFL	0x01	/* overflow exception */
16*adc9dcf3SJustin Hibbits #define FP_X_UFL	0x02	/* underflow exception */
17*adc9dcf3SJustin Hibbits #define FP_X_DZ		0x04	/* divide-by-zero exception */
18*adc9dcf3SJustin Hibbits #define FP_X_INV	0x08	/* invalid operation exception */
19*adc9dcf3SJustin Hibbits #define FP_X_IMP	0x10	/* imprecise (loss of precision) */
20*adc9dcf3SJustin Hibbits #else
21eeaa8979SBenno Rice #define FP_X_IMP	0x01	/* imprecise (loss of precision) */
22eeaa8979SBenno Rice #define FP_X_DZ		0x02	/* divide-by-zero exception */
23eeaa8979SBenno Rice #define FP_X_UFL	0x04	/* underflow exception */
24eeaa8979SBenno Rice #define FP_X_OFL	0x08	/* overflow exception */
25eeaa8979SBenno Rice #define FP_X_INV	0x10	/* invalid operation exception */
26*adc9dcf3SJustin Hibbits #endif
27eeaa8979SBenno Rice 
28eeaa8979SBenno Rice typedef enum {
29eeaa8979SBenno Rice     FP_RN=0,			/* round to nearest representable number */
30eeaa8979SBenno Rice     FP_RZ=1,			/* round to zero (truncate) */
31eeaa8979SBenno Rice     FP_RP=2,			/* round toward positive infinity */
32eeaa8979SBenno Rice     FP_RM=3			/* round toward negative infinity */
33eeaa8979SBenno Rice } fp_rnd_t;
34eeaa8979SBenno Rice 
35a50079b7SDavid Schultz __BEGIN_DECLS
36a50079b7SDavid Schultz extern fp_rnd_t    fpgetround(void);
37a50079b7SDavid Schultz extern fp_rnd_t    fpsetround(fp_rnd_t);
38a50079b7SDavid Schultz extern fp_except_t fpgetmask(void);
39a50079b7SDavid Schultz extern fp_except_t fpsetmask(fp_except_t);
40a50079b7SDavid Schultz extern fp_except_t fpgetsticky(void);
41a50079b7SDavid Schultz __END_DECLS
42a50079b7SDavid Schultz 
43eeaa8979SBenno Rice #endif /* _MACHINE_IEEEFP_H_ */
44