People porting FreeBSD to new architectures ought not have to

implement a deprecated FPU control interface in addition to the
standard one.  To make this clearer, further deprecate ieeefp.h
by not declaring the function prototypes except on architectures
that implement them already.

Currently i386 and amd64 implement the ieeefp.h interface for
compatibility, and for fp[gs]etprec(), which doesn't exist on
most other hardware.  Powerpc, sparc64, and ia64 partially implement
it and probably shouldn't, and other architectures don't implement it
at all.
This commit is contained in:
David Schultz 2011-10-21 06:41:46 +00:00
parent 6232589aeb
commit a50079b7ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226607
8 changed files with 44 additions and 17 deletions

View file

@ -12,15 +12,4 @@
#include <sys/cdefs.h>
#include <machine/ieeefp.h>
#if !defined(_IEEEFP_INLINED_)
__BEGIN_DECLS
extern fp_rnd_t fpgetround(void);
extern fp_rnd_t fpsetround(fp_rnd_t);
extern fp_except_t fpgetmask(void);
extern fp_except_t fpsetmask(fp_except_t);
extern fp_except_t fpgetsticky(void);
extern fp_except_t fpsetsticky(fp_except_t);
__END_DECLS
#endif /* !_IEEEFP_INLINED_ */
#endif /* _IEEEFP_H_ */

View file

@ -39,6 +39,8 @@
#define _MACHINE_IEEEFP_H_
/*
* Deprecated historical FPU control interface
*
* IEEE floating point type, constant and function definitions.
* XXX: {FP,SSE}*FLD and {FP,SSE}*OFF are undocumented pollution.
*/
@ -287,13 +289,16 @@ __fpgetsticky(void)
#define fpsetprec(m) __fpsetprec(m)
#define fpsetround(m) __fpsetround(m)
/* Suppress prototypes in the MI header. */
#define _IEEEFP_INLINED_ 1
#else /* !(!__IEEEFP_NOINLINES__ && __GNUCLIKE_ASM) */
/* Augment the userland declarations. */
__BEGIN_DECLS
extern fp_rnd_t fpgetround(void);
extern fp_rnd_t fpsetround(fp_rnd_t);
extern fp_except_t fpgetmask(void);
extern fp_except_t fpsetmask(fp_except_t);
extern fp_except_t fpgetsticky(void);
extern fp_except_t fpsetsticky(fp_except_t);
fp_prec_t fpgetprec(void);
fp_prec_t fpsetprec(fp_prec_t);
__END_DECLS

View file

@ -8,6 +8,8 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/* Deprecated historical FPU control interface */
/* FP exception codes */
#define FP_EXCEPT_INV 0
#define FP_EXCEPT_DZ 1

View file

@ -39,6 +39,8 @@
#define _MACHINE_IEEEFP_H_
/*
* Deprecated historical FPU control interface
*
* IEEE floating point type, constant and function definitions.
* XXX: FP*FLD and FP*OFF are undocumented pollution.
*/
@ -253,7 +255,4 @@ fpresetsticky(fp_except_t _m)
#endif /* __GNUCLIKE_ASM */
/* Suppress prototypes in the MI header. */
#define _IEEEFP_INLINED_ 1
#endif /* !_MACHINE_IEEEFP_H_ */

View file

@ -29,6 +29,8 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/* Deprecated historical FPU control interface */
#include <machine/fpu.h>
typedef int fp_except_t;
@ -45,4 +47,11 @@ typedef enum {
FP_RZ /* round toward zero */
} fp_rnd_t;
__BEGIN_DECLS
extern fp_rnd_t fpgetround(void);
extern fp_rnd_t fpsetround(fp_rnd_t);
extern fp_except_t fpgetmask(void);
extern fp_except_t fpsetmask(fp_except_t);
__END_DECLS
#endif /* !_MACHINE_IEEEFP_H_ */

View file

@ -11,6 +11,8 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/* Deprecated historical FPU control interface */
typedef int fp_except;
typedef int fp_except_t;

View file

@ -8,6 +8,8 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/* Deprecated historical FPU control interface */
typedef int fp_except_t;
#define FP_X_IMP 0x01 /* imprecise (loss of precision) */
#define FP_X_DZ 0x02 /* divide-by-zero exception */
@ -22,4 +24,12 @@ typedef enum {
FP_RM=3 /* round toward negative infinity */
} fp_rnd_t;
__BEGIN_DECLS
extern fp_rnd_t fpgetround(void);
extern fp_rnd_t fpsetround(fp_rnd_t);
extern fp_except_t fpgetmask(void);
extern fp_except_t fpsetmask(fp_except_t);
extern fp_except_t fpgetsticky(void);
__END_DECLS
#endif /* _MACHINE_IEEEFP_H_ */

View file

@ -7,6 +7,8 @@
#ifndef _MACHINE_IEEEFP_H_
#define _MACHINE_IEEEFP_H_
/* Deprecated FPU control interface */
#include <machine/fsr.h>
typedef int fp_except_t;
@ -23,4 +25,13 @@ typedef enum {
FP_RM = FSR_RD_NINF /* round toward negative infinity */
} fp_rnd_t;
__BEGIN_DECLS
extern fp_rnd_t fpgetround(void);
extern fp_rnd_t fpsetround(fp_rnd_t);
extern fp_except_t fpgetmask(void);
extern fp_except_t fpsetmask(fp_except_t);
extern fp_except_t fpgetsticky(void);
__END_DECLS
#endif /* _MACHINE_IEEEFP_H_ */