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 */ 6eeaa8979SBenno Rice 7eeaa8979SBenno Rice #ifndef _MACHINE_IEEEFP_H_ 8eeaa8979SBenno Rice #define _MACHINE_IEEEFP_H_ 9eeaa8979SBenno Rice 10a50079b7SDavid Schultz /* Deprecated historical FPU control interface */ 11a50079b7SDavid Schultz 12eeaa8979SBenno Rice typedef int fp_except_t; 13*adc9dcf3SJustin Hibbits #ifdef __SPE__ 14*adc9dcf3SJustin Hibbits #define FP_X_OFL 0x01 /* overflow exception */ 15*adc9dcf3SJustin Hibbits #define FP_X_UFL 0x02 /* underflow exception */ 16*adc9dcf3SJustin Hibbits #define FP_X_DZ 0x04 /* divide-by-zero exception */ 17*adc9dcf3SJustin Hibbits #define FP_X_INV 0x08 /* invalid operation exception */ 18*adc9dcf3SJustin Hibbits #define FP_X_IMP 0x10 /* imprecise (loss of precision) */ 19*adc9dcf3SJustin Hibbits #else 20eeaa8979SBenno Rice #define FP_X_IMP 0x01 /* imprecise (loss of precision) */ 21eeaa8979SBenno Rice #define FP_X_DZ 0x02 /* divide-by-zero exception */ 22eeaa8979SBenno Rice #define FP_X_UFL 0x04 /* underflow exception */ 23eeaa8979SBenno Rice #define FP_X_OFL 0x08 /* overflow exception */ 24eeaa8979SBenno Rice #define FP_X_INV 0x10 /* invalid operation exception */ 25*adc9dcf3SJustin Hibbits #endif 26eeaa8979SBenno Rice 27eeaa8979SBenno Rice typedef enum { 28eeaa8979SBenno Rice FP_RN=0, /* round to nearest representable number */ 29eeaa8979SBenno Rice FP_RZ=1, /* round to zero (truncate) */ 30eeaa8979SBenno Rice FP_RP=2, /* round toward positive infinity */ 31eeaa8979SBenno Rice FP_RM=3 /* round toward negative infinity */ 32eeaa8979SBenno Rice } fp_rnd_t; 33eeaa8979SBenno Rice 34a50079b7SDavid Schultz __BEGIN_DECLS 35a50079b7SDavid Schultz extern fp_rnd_t fpgetround(void); 36a50079b7SDavid Schultz extern fp_rnd_t fpsetround(fp_rnd_t); 37a50079b7SDavid Schultz extern fp_except_t fpgetmask(void); 38a50079b7SDavid Schultz extern fp_except_t fpsetmask(fp_except_t); 39a50079b7SDavid Schultz extern fp_except_t fpgetsticky(void); 40a50079b7SDavid Schultz __END_DECLS 41a50079b7SDavid Schultz 42eeaa8979SBenno Rice #endif /* _MACHINE_IEEEFP_H_ */ 43