xref: /titanic_51/usr/src/head/ieeefp.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T */
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved */
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate 
31*7c478bd9Sstevel@tonic-gate #ifndef _IEEEFP_H
32*7c478bd9Sstevel@tonic-gate #define	_IEEEFP_H
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
37*7c478bd9Sstevel@tonic-gate extern "C" {
38*7c478bd9Sstevel@tonic-gate #endif
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate /*
41*7c478bd9Sstevel@tonic-gate  * Floating point enviornment for machines that support
42*7c478bd9Sstevel@tonic-gate  * the IEEE 754 floating-point standard.  This file currently
43*7c478bd9Sstevel@tonic-gate  * supports the 80*87, and SPARC families.
44*7c478bd9Sstevel@tonic-gate  *
45*7c478bd9Sstevel@tonic-gate  * This header defines the following interfaces:
46*7c478bd9Sstevel@tonic-gate  *	1) Classes of floating point numbers
47*7c478bd9Sstevel@tonic-gate  *	2) Rounding Control
48*7c478bd9Sstevel@tonic-gate  *	3) Exception Control
49*7c478bd9Sstevel@tonic-gate  *	4) Exception Handling
50*7c478bd9Sstevel@tonic-gate  *	5) Utility Macros
51*7c478bd9Sstevel@tonic-gate  *	6) Full Exception Environment Control
52*7c478bd9Sstevel@tonic-gate  */
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate /*
55*7c478bd9Sstevel@tonic-gate  * CLASSES of floating point numbers *************************
56*7c478bd9Sstevel@tonic-gate  * IEEE floating point values fall into 1 of the following 10
57*7c478bd9Sstevel@tonic-gate  * classes
58*7c478bd9Sstevel@tonic-gate  */
59*7c478bd9Sstevel@tonic-gate typedef	enum	fpclass_t {
60*7c478bd9Sstevel@tonic-gate 	FP_SNAN = 0,	/* signaling NaN */
61*7c478bd9Sstevel@tonic-gate 	FP_QNAN = 1,	/* quiet NaN */
62*7c478bd9Sstevel@tonic-gate 	FP_NINF = 2,	/* negative infinity */
63*7c478bd9Sstevel@tonic-gate 	FP_PINF = 3,	/* positive infinity */
64*7c478bd9Sstevel@tonic-gate 	FP_NDENORM = 4, /* negative denormalized non-zero */
65*7c478bd9Sstevel@tonic-gate 	FP_PDENORM = 5, /* positive denormalized non-zero */
66*7c478bd9Sstevel@tonic-gate 	FP_NZERO = 6,	/* -0.0 */
67*7c478bd9Sstevel@tonic-gate 	FP_PZERO = 7,   /* +0.0 */
68*7c478bd9Sstevel@tonic-gate 	FP_NNORM = 8,	/* negative normalized non-zero */
69*7c478bd9Sstevel@tonic-gate 	FP_PNORM = 9	/* positive normalized non-zero */
70*7c478bd9Sstevel@tonic-gate } fpclass_t;
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
73*7c478bd9Sstevel@tonic-gate extern fpclass_t fpclass(double);	/* get class of double value */
74*7c478bd9Sstevel@tonic-gate extern int	finite(double);
75*7c478bd9Sstevel@tonic-gate extern int	unordered(double, double);
76*7c478bd9Sstevel@tonic-gate #else
77*7c478bd9Sstevel@tonic-gate extern fpclass_t fpclass();	/* get class of double value */
78*7c478bd9Sstevel@tonic-gate #endif
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate /*
81*7c478bd9Sstevel@tonic-gate  * ROUNDING CONTROL ******************************************
82*7c478bd9Sstevel@tonic-gate  *
83*7c478bd9Sstevel@tonic-gate  * At all times, floating-point math is done using one of four
84*7c478bd9Sstevel@tonic-gate  * mutually-exclusive rounding modes.
85*7c478bd9Sstevel@tonic-gate  */
86*7c478bd9Sstevel@tonic-gate 
87*7c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate /*
90*7c478bd9Sstevel@tonic-gate  * NOTE: the values given are chosen to match those used by the
91*7c478bd9Sstevel@tonic-gate  * 80*87 rounding mode field in the control word.
92*7c478bd9Sstevel@tonic-gate  */
93*7c478bd9Sstevel@tonic-gate typedef	enum	fp_rnd {
94*7c478bd9Sstevel@tonic-gate 	FP_RN = 0,	/* round to nearest representable number, tie -> even */
95*7c478bd9Sstevel@tonic-gate 	FP_RM = 1,	/* round toward minus infinity */
96*7c478bd9Sstevel@tonic-gate 	FP_RP = 2,	/* round toward plus infinity */
97*7c478bd9Sstevel@tonic-gate 	FP_RZ = 3	/* round toward zero (truncate) */
98*7c478bd9Sstevel@tonic-gate } fp_rnd;
99*7c478bd9Sstevel@tonic-gate 
100*7c478bd9Sstevel@tonic-gate #endif
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate #if defined(__sparc)
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate /*
105*7c478bd9Sstevel@tonic-gate  * NOTE: the values given are chosen to match those used by the
106*7c478bd9Sstevel@tonic-gate  * RD (Round Direction) field of the FSR (Floating Point State Register).
107*7c478bd9Sstevel@tonic-gate  */
108*7c478bd9Sstevel@tonic-gate typedef	enum	fp_rnd {
109*7c478bd9Sstevel@tonic-gate 	FP_RN = 0,	/* round to nearest representable number, tie -> even */
110*7c478bd9Sstevel@tonic-gate 	FP_RZ = 1,	/* round toward zero (truncate) */
111*7c478bd9Sstevel@tonic-gate 	FP_RP = 2,	/* round toward plus infinity */
112*7c478bd9Sstevel@tonic-gate 	FP_RM = 3	/* round toward minus infinity */
113*7c478bd9Sstevel@tonic-gate } fp_rnd;
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate #endif
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
118*7c478bd9Sstevel@tonic-gate extern fp_rnd	fpsetround(fp_rnd);	/* set rounding mode, return previous */
119*7c478bd9Sstevel@tonic-gate extern fp_rnd	fpgetround(void);	/* return current rounding mode */
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate #else
122*7c478bd9Sstevel@tonic-gate extern fp_rnd	fpsetround();		/* set rounding mode, return previous */
123*7c478bd9Sstevel@tonic-gate extern fp_rnd	fpgetround();		/* return current rounding mode */
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate #endif
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * EXCEPTION CONTROL *****************************************
129*7c478bd9Sstevel@tonic-gate  *
130*7c478bd9Sstevel@tonic-gate  */
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate #define	fp_except	int
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #define	FP_DISABLE	0	/* exception will be ignored */
135*7c478bd9Sstevel@tonic-gate #define	FP_ENABLE	1	/* exception will cause SIGFPE */
136*7c478bd9Sstevel@tonic-gate #define	FP_CLEAR	0	/* exception has not occurred */
137*7c478bd9Sstevel@tonic-gate #define	FP_SET		1	/* exception has occurred */
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate /*
142*7c478bd9Sstevel@tonic-gate  * There are six floating point exceptions, which can be individually
143*7c478bd9Sstevel@tonic-gate  * ENABLED (== 1) or DISABLED (== 0).  When an exception occurs
144*7c478bd9Sstevel@tonic-gate  * (ENABLED or not), the fact is noted by changing an associated
145*7c478bd9Sstevel@tonic-gate  * "sticky bit" from CLEAR (==0) to SET (==1).
146*7c478bd9Sstevel@tonic-gate  *
147*7c478bd9Sstevel@tonic-gate  * NOTE: the bit positions in fp_except are chosen to match those of
148*7c478bd9Sstevel@tonic-gate  * the 80*87 control word mask bits.  Although the 87 chips actually
149*7c478bd9Sstevel@tonic-gate  * ENABLE exceptions with a mask value of 0 (not 1, as on the 3b), it
150*7c478bd9Sstevel@tonic-gate  * is felt that switching these values may create more problems than
151*7c478bd9Sstevel@tonic-gate  * it solves.
152*7c478bd9Sstevel@tonic-gate  */
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate /* an fp_except can have the following (not exclusive) values: */
155*7c478bd9Sstevel@tonic-gate #define	FP_X_INV	0x01	/* invalid operation exception */
156*7c478bd9Sstevel@tonic-gate #define	FP_X_DNML	0x02	/* denormalization exception */
157*7c478bd9Sstevel@tonic-gate #define	FP_X_DZ		0x04	/* divide-by-zero exception */
158*7c478bd9Sstevel@tonic-gate #define	FP_X_OFL	0x08	/* overflow exception */
159*7c478bd9Sstevel@tonic-gate #define	FP_X_UFL	0x10	/* underflow exception */
160*7c478bd9Sstevel@tonic-gate #define	FP_X_IMP	0x20	/* imprecise (loss of precision) */
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate #endif
163*7c478bd9Sstevel@tonic-gate 
164*7c478bd9Sstevel@tonic-gate #if defined(__sparc)
165*7c478bd9Sstevel@tonic-gate 
166*7c478bd9Sstevel@tonic-gate /*
167*7c478bd9Sstevel@tonic-gate  * There are five floating-point exceptions, which can be individually
168*7c478bd9Sstevel@tonic-gate  * ENABLED (== 1) or DISABLED (== 0).  When an exception occurs
169*7c478bd9Sstevel@tonic-gate  * (ENABLED or not), the fact is noted by changing an associated
170*7c478bd9Sstevel@tonic-gate  * "sticky bit" from CLEAR (==0) to SET (==1).
171*7c478bd9Sstevel@tonic-gate  *
172*7c478bd9Sstevel@tonic-gate  * NOTE: the bit positions in an fp_except are chosen to match that in
173*7c478bd9Sstevel@tonic-gate  * the Trap Enable Mask of the FSR (Floating Point State Register).
174*7c478bd9Sstevel@tonic-gate  */
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate /* an fp_except can have the following (not exclusive) values: */
177*7c478bd9Sstevel@tonic-gate #define	FP_X_INV	0x10	/* invalid operation exception */
178*7c478bd9Sstevel@tonic-gate #define	FP_X_OFL	0x08	/* overflow exception */
179*7c478bd9Sstevel@tonic-gate #define	FP_X_UFL	0x04	/* underflow exception */
180*7c478bd9Sstevel@tonic-gate #define	FP_X_DZ		0x02	/* divide-by-zero exception */
181*7c478bd9Sstevel@tonic-gate #define	FP_X_IMP	0x01	/* imprecise (loss of precision) */
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate #endif
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
186*7c478bd9Sstevel@tonic-gate extern fp_except fpgetmask(void);		/* current exception mask */
187*7c478bd9Sstevel@tonic-gate extern fp_except fpsetmask(fp_except);		/* set mask, return previous */
188*7c478bd9Sstevel@tonic-gate extern fp_except fpgetsticky(void);		/* return logged exceptions */
189*7c478bd9Sstevel@tonic-gate extern fp_except fpsetsticky(fp_except);	/* change logged exceptions */
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate #else
192*7c478bd9Sstevel@tonic-gate extern fp_except fpgetmask();	/* current exception mask */
193*7c478bd9Sstevel@tonic-gate extern fp_except fpsetmask();	/* set mask, return previous */
194*7c478bd9Sstevel@tonic-gate extern fp_except fpgetsticky();	/* return logged exceptions */
195*7c478bd9Sstevel@tonic-gate extern fp_except fpsetsticky();	/* change logged exceptions */
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate #endif
198*7c478bd9Sstevel@tonic-gate 
199*7c478bd9Sstevel@tonic-gate /*
200*7c478bd9Sstevel@tonic-gate  * UTILITY MACROS ********************************************
201*7c478bd9Sstevel@tonic-gate  */
202*7c478bd9Sstevel@tonic-gate 
203*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
204*7c478bd9Sstevel@tonic-gate extern int isnanf(float);
205*7c478bd9Sstevel@tonic-gate extern int isnand(double);
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #else
208*7c478bd9Sstevel@tonic-gate extern int isnand();
209*7c478bd9Sstevel@tonic-gate #define	isnanf(x)	(((*(long *)&(x) & 0x7f800000L) == 0x7f800000L) && \
210*7c478bd9Sstevel@tonic-gate 			    ((*(long *)&(x) & 0x007fffffL) != 0x00000000L))
211*7c478bd9Sstevel@tonic-gate #endif
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate /*
216*7c478bd9Sstevel@tonic-gate  * EXCEPTION HANDLING ****************************************
217*7c478bd9Sstevel@tonic-gate  *
218*7c478bd9Sstevel@tonic-gate  * When a signal handler catches an FPE, it will have a freshly initialized
219*7c478bd9Sstevel@tonic-gate  * coprocessor.  This allows signal handling routines to make use of
220*7c478bd9Sstevel@tonic-gate  * floating point arithmetic, if need be.  The previous state of the 87
221*7c478bd9Sstevel@tonic-gate  * chip is available, however.  There are two ways to get at this information,
222*7c478bd9Sstevel@tonic-gate  * depending on how the signal handler was set up.
223*7c478bd9Sstevel@tonic-gate  *
224*7c478bd9Sstevel@tonic-gate  * If the handler was set via signal() or sigset(), the old, SVR3, method
225*7c478bd9Sstevel@tonic-gate  * should be used: the signal handler assumes that it has a single parameter,
226*7c478bd9Sstevel@tonic-gate  * which is of type struct _fpstackframe, defined below.  By investigating
227*7c478bd9Sstevel@tonic-gate  * this parameter, the cause of the FPE may be determined.  By modifying it,
228*7c478bd9Sstevel@tonic-gate  * the state of the coprocessor can be changed upon return to the main task.
229*7c478bd9Sstevel@tonic-gate  * THIS METHOD IS OBSOLETE, AND MAY NOT BE SUPPORTED IN FUTURE RELEASES.
230*7c478bd9Sstevel@tonic-gate  *
231*7c478bd9Sstevel@tonic-gate  * If the handler was set via sigaction(), the new, SVR4, method should be
232*7c478bd9Sstevel@tonic-gate  * used: the third argument to the handler will be a pointer to a ucontext
233*7c478bd9Sstevel@tonic-gate  * structure (see sys/ucontext.h).  The uc_mcontext.fpregs member of the
234*7c478bd9Sstevel@tonic-gate  * ucontext structure holds the saved floating-point registers.  This can be
235*7c478bd9Sstevel@tonic-gate  * examined and/or modified.  By modifying it, the state of the coprocessor
236*7c478bd9Sstevel@tonic-gate  * can be changed upon return to the main task.
237*7c478bd9Sstevel@tonic-gate  */
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate struct _fpreg {	/* structure of a temp real fp register */
240*7c478bd9Sstevel@tonic-gate 	unsigned short significand[4];	/* 64 bit mantissa value */
241*7c478bd9Sstevel@tonic-gate 	unsigned short exponent;	/* 15 bit exponent and sign bit */
242*7c478bd9Sstevel@tonic-gate };
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate #if defined(__i386)
245*7c478bd9Sstevel@tonic-gate 
246*7c478bd9Sstevel@tonic-gate /*
247*7c478bd9Sstevel@tonic-gate  * AMD64 users should use sigaction() as described above.
248*7c478bd9Sstevel@tonic-gate  */
249*7c478bd9Sstevel@tonic-gate 
250*7c478bd9Sstevel@tonic-gate struct _fpstackframe {		/* signal handler's argument */
251*7c478bd9Sstevel@tonic-gate 	long signo;		/* signal number arg */
252*7c478bd9Sstevel@tonic-gate 	long regs[19];		/* all registers */
253*7c478bd9Sstevel@tonic-gate 	struct _fpstate *fpsp;	/* address of saved 387 state */
254*7c478bd9Sstevel@tonic-gate 	char *wsp;		/* address of saved Weitek state */
255*7c478bd9Sstevel@tonic-gate };
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate #endif
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate #if defined(__i386) || defined(__amd64)
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate #if defined(__amd64)
262*7c478bd9Sstevel@tonic-gate #define	_fpstate _fpstate32
263*7c478bd9Sstevel@tonic-gate #endif
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate struct _fpstate {		/* saved state info from an exception */
266*7c478bd9Sstevel@tonic-gate 	unsigned int	cw,	/* control word */
267*7c478bd9Sstevel@tonic-gate 			sw,	/* status word after fnclex-not useful */
268*7c478bd9Sstevel@tonic-gate 			tag,	/* tag word */
269*7c478bd9Sstevel@tonic-gate 			ipoff,	/* %eip register */
270*7c478bd9Sstevel@tonic-gate 			cssel,	/* code segment selector */
271*7c478bd9Sstevel@tonic-gate 			dataoff, /* data operand address */
272*7c478bd9Sstevel@tonic-gate 			datasel; /* data operand selector */
273*7c478bd9Sstevel@tonic-gate 	struct _fpreg _st[8];	/* saved register stack */
274*7c478bd9Sstevel@tonic-gate 	unsigned int status;	/* status word saved at exception */
275*7c478bd9Sstevel@tonic-gate 	unsigned int mxcsr;
276*7c478bd9Sstevel@tonic-gate 	unsigned int xstatus;	/* status word saved at exception */
277*7c478bd9Sstevel@tonic-gate 	unsigned int __pad[2];
278*7c478bd9Sstevel@tonic-gate 	unsigned int xmm[8][4];
279*7c478bd9Sstevel@tonic-gate };
280*7c478bd9Sstevel@tonic-gate 
281*7c478bd9Sstevel@tonic-gate #if defined(__amd64)
282*7c478bd9Sstevel@tonic-gate #undef	_fpstate
283*7c478bd9Sstevel@tonic-gate #endif
284*7c478bd9Sstevel@tonic-gate 
285*7c478bd9Sstevel@tonic-gate #endif	/* __i386 || __amd64 */
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate /*
288*7c478bd9Sstevel@tonic-gate  * The structure of the 80*87 status and control words, and the mxcsr
289*7c478bd9Sstevel@tonic-gate  * register are given by the following structures.
290*7c478bd9Sstevel@tonic-gate  */
291*7c478bd9Sstevel@tonic-gate struct _cw87 {
292*7c478bd9Sstevel@tonic-gate 	unsigned
293*7c478bd9Sstevel@tonic-gate 		mask:	6,	/* exception masks */
294*7c478bd9Sstevel@tonic-gate 		res1:	2,	/* not used */
295*7c478bd9Sstevel@tonic-gate 		prec:	2,	/* precision control field */
296*7c478bd9Sstevel@tonic-gate 		rnd:	2,	/* rounding control field */
297*7c478bd9Sstevel@tonic-gate 		inf:	1,	/* infinity control (not on 387) */
298*7c478bd9Sstevel@tonic-gate 		res2:	3;	/* not used */
299*7c478bd9Sstevel@tonic-gate };
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate struct _sw87 {
302*7c478bd9Sstevel@tonic-gate 	unsigned
303*7c478bd9Sstevel@tonic-gate 		excp:	6,	/* exception sticky bits */
304*7c478bd9Sstevel@tonic-gate 		res1:	1,	/* not used */
305*7c478bd9Sstevel@tonic-gate 		errs:	1,	/* error summary-set if unmasked excp */
306*7c478bd9Sstevel@tonic-gate 		c012:	3,	/* condition code bits 0..2 */
307*7c478bd9Sstevel@tonic-gate 		stkt:	3,	/* stack top pointer */
308*7c478bd9Sstevel@tonic-gate 		c3:	1,	/* condition code bit 3 */
309*7c478bd9Sstevel@tonic-gate 		busy:	1;	/* coprocessor busy */
310*7c478bd9Sstevel@tonic-gate };
311*7c478bd9Sstevel@tonic-gate 
312*7c478bd9Sstevel@tonic-gate struct _mxcsr {
313*7c478bd9Sstevel@tonic-gate 	unsigned
314*7c478bd9Sstevel@tonic-gate 		excp:	6,	/* exception sticky bits */
315*7c478bd9Sstevel@tonic-gate 		daz:	1,	/* denormals are zeroes */
316*7c478bd9Sstevel@tonic-gate 		mask:	6,	/* exception masks */
317*7c478bd9Sstevel@tonic-gate 		rnd:	2,	/* rounding control */
318*7c478bd9Sstevel@tonic-gate 		fzero:	1;	/* flush to zero */
319*7c478bd9Sstevel@tonic-gate };
320*7c478bd9Sstevel@tonic-gate 
321*7c478bd9Sstevel@tonic-gate #endif
322*7c478bd9Sstevel@tonic-gate 
323*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
324*7c478bd9Sstevel@tonic-gate }
325*7c478bd9Sstevel@tonic-gate #endif
326*7c478bd9Sstevel@tonic-gate 
327*7c478bd9Sstevel@tonic-gate #endif	/* _IEEEFP_H */
328