1 1.5 thorpej /* $NetBSD: ieeefp.h,v 1.5 2003/01/17 22:11:16 thorpej Exp $ */ 2 1.1 cgd 3 1.1 cgd /* 4 1.1 cgd * Written by J.T. Conklin, Apr 28, 1995 5 1.1 cgd * Public domain. 6 1.1 cgd */ 7 1.1 cgd 8 1.1 cgd #ifndef _ALPHA_IEEEFP_H_ 9 1.1 cgd #define _ALPHA_IEEEFP_H_ 10 1.1 cgd 11 1.1 cgd typedef int fp_except; 12 1.4 ross 13 1.4 ross #ifdef _KERNEL 14 1.4 ross 15 1.4 ross #include <sys/param.h> 16 1.4 ross #include <sys/proc.h> 17 1.4 ross #include <machine/fpu.h> 18 1.4 ross #include <machine/alpha.h> 19 1.4 ross 20 1.4 ross /* FP_X_IOV is intentionally omitted from the architecture flags mask */ 21 1.4 ross 22 1.4 ross #define FP_AA_FLAGS (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP) 23 1.4 ross 24 1.4 ross #define float_raise(f) \ 25 1.5 thorpej do curlwp->l_md.md_flags |= NETBSD_FLAG_TO_FP_C(f); \ 26 1.4 ross while(0) 27 1.4 ross 28 1.4 ross #define float_set_inexact() float_raise(FP_X_IMP) 29 1.4 ross #define float_set_invalid() float_raise(FP_X_INV) 30 1.4 ross #define fpgetround() (alpha_read_fpcr() >> 58 & 3) 31 1.4 ross 32 1.4 ross #endif 33 1.4 ross 34 1.1 cgd #define FP_X_INV 0x01 /* invalid operation exception */ 35 1.1 cgd #define FP_X_DZ 0x02 /* divide-by-zero exception */ 36 1.1 cgd #define FP_X_OFL 0x04 /* overflow exception */ 37 1.1 cgd #define FP_X_UFL 0x08 /* underflow exception */ 38 1.1 cgd #define FP_X_IMP 0x10 /* imprecise (loss of precision; "inexact") */ 39 1.4 ross #define FP_X_IOV 0x20 /* integer overflow */ 40 1.1 cgd 41 1.4 ross /* 42 1.4 ross * fp_rnd bits match the fpcr, below, as well as bits 12:11 43 1.4 ross * in fp operate instructions 44 1.4 ross */ 45 1.1 cgd typedef enum { 46 1.4 ross FP_RZ = 0, /* round to zero (truncate) */ 47 1.4 ross FP_RM = 1, /* round toward negative infinity */ 48 1.4 ross FP_RN = 2, /* round to nearest representable number */ 49 1.4 ross FP_RP = 3, /* round toward positive infinity */ 50 1.4 ross _FP_DYNAMIC=FP_RP 51 1.1 cgd } fp_rnd; 52 1.1 cgd 53 1.1 cgd #endif /* _ALPHA_IEEEFP_H_ */ 54