xref: /freebsd/sys/arm64/include/ieeefp.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
1 /*-
2  * Based on sys/sparc64/include/ieeefp.h
3  * Public domain.
4  */
5 
6 #ifdef __arm__
7 #include <arm/ieeefp.h>
8 #else /* !__arm__ */
9 
10 #ifndef _MACHINE_IEEEFP_H_
11 #define	_MACHINE_IEEEFP_H_
12 
13 /* Deprecated FPU control interface */
14 
15 /* FP exception codes */
16 #define	FP_EXCEPT_INV	8
17 #define	FP_EXCEPT_DZ	9
18 #define	FP_EXCEPT_OFL	10
19 #define	FP_EXCEPT_UFL	11
20 #define	FP_EXCEPT_IMP	12
21 #define	FP_EXCEPT_DNML	15
22 
23 typedef int fp_except_t;
24 
25 #define	FP_X_INV	(1 << FP_EXCEPT_INV)	/* invalid operation exception */
26 #define	FP_X_DZ		(1 << FP_EXCEPT_DZ)	/* divide-by-zero exception */
27 #define	FP_X_OFL	(1 << FP_EXCEPT_OFL)	/* overflow exception */
28 #define	FP_X_UFL	(1 << FP_EXCEPT_UFL)	/* underflow exception */
29 #define	FP_X_IMP	(1 << FP_EXCEPT_IMP)	/* imprecise (loss of precision) */
30 #define	FP_X_DNML	(1 << FP_EXCEPT_DNML)	/* denormal exception */
31 
32 typedef enum {
33 	FP_RN = (0 << 22),	/* round to nearest representable number */
34 	FP_RP = (1 << 22),	/* round toward positive infinity */
35 	FP_RM = (2 << 22),	/* round toward negative infinity */
36 	FP_RZ = (3 << 22)	/* round to zero (truncate) */
37 } fp_rnd_t;
38 
39 __BEGIN_DECLS
40 extern fp_rnd_t    fpgetround(void);
41 extern fp_rnd_t    fpsetround(fp_rnd_t);
42 extern fp_except_t fpgetmask(void);
43 extern fp_except_t fpsetmask(fp_except_t);
44 __END_DECLS
45 
46 #endif /* _MACHINE_IEEEFP_H_ */
47 
48 #endif /* !__arm__ */
49