ieeefp.h revision 1834
11834Swollman/*-
21834Swollman * Copyright (c) 1990 Andrew Moore, Talke Studio
31834Swollman * All rights reserved.
41834Swollman *
51834Swollman * Redistribution and use in source and binary forms, with or without
61834Swollman * modification, are permitted provided that the following conditions
71834Swollman * are met:
81834Swollman * 1. Redistributions of source code must retain the above copyright
91834Swollman *    notice, this list of conditions and the following disclaimer.
101834Swollman * 2. Redistributions in binary form must reproduce the above copyright
111834Swollman *    notice, this list of conditions and the following disclaimer in the
121834Swollman *    documentation and/or other materials provided with the distribution.
131834Swollman * 3. All advertising materials mentioning features or use of this software
141834Swollman *    must display the following acknowledgement:
151834Swollman *	This product includes software developed by the University of
161834Swollman *	California, Berkeley and its contributors.
171834Swollman * 4. Neither the name of the University nor the names of its contributors
181834Swollman *    may be used to endorse or promote products derived from this software
191834Swollman *    without specific prior written permission.
201834Swollman *
211834Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221834Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231834Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241834Swollman * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251834Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261834Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271834Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281834Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291834Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301834Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311834Swollman * SUCH DAMAGE.
321834Swollman *
331834Swollman * 	from: @(#) ieeefp.h 	1.0 (Berkeley) 9/23/93
341834Swollman *	$Id: ieeefp.h,v 1.2 1993/10/16 17:16:52 rgrimes Exp $
351834Swollman */
361834Swollman
371834Swollman/*
381834Swollman *	IEEE floating point type and constant definitions.
391834Swollman */
401834Swollman
411834Swollman#ifndef _IEEEFP_H_
421834Swollman#define _IEEEFP_H_
431834Swollman
441834Swollman#ifdef __i386__
451834Swollman
461834Swollman/*
471834Swollman * FP rounding modes
481834Swollman */
491834Swollmantypedef enum {
501834Swollman	FP_RN=0,	/* round to nearest */
511834Swollman	FP_RM,		/* round down to minus infinity */
521834Swollman	FP_RP,		/* round up to plus infinity */
531834Swollman	FP_RZ		/* truncate */
541834Swollman} fp_rnd_t;
551834Swollman
561834Swollman/*
571834Swollman * FP precison modes
581834Swollman */
591834Swollmantypedef enum {
601834Swollman	FP_PS=0,	/* 24 bit (single-precsion) */
611834Swollman	FP_PRS,		/* reserved */
621834Swollman	FP_PD,		/* 53 bit (double-precision) */
631834Swollman	FP_PE		/* 64 bit (extended-precsion) */
641834Swollman} fp_prec_t;
651834Swollman
661834Swollman#define fp_except_t	int
671834Swollman
681834Swollman/*
691834Swollman * FP exception masks
701834Swollman */
711834Swollman#define FP_X_INV	0x01	/* invalid operation */
721834Swollman#define FP_X_DNML	0x02	/* denormal */
731834Swollman#define FP_X_DZ		0x04	/* zero divide */
741834Swollman#define FP_X_OFL	0x08	/* overflow */
751834Swollman#define FP_X_UFL	0x10	/* underflow */
761834Swollman#define FP_X_IMP	0x20	/* (im)precision */
771834Swollman
781834Swollman/*
791834Swollman * FP registers
801834Swollman */
811834Swollman#define FP_MSKS_REG	0	/* exception masks */
821834Swollman#define FP_PRC_REG	0	/* precision */
831834Swollman#define FP_RND_REG	0	/* direction */
841834Swollman#define FP_STKY_REG	1	/* sticky flags */
851834Swollman
861834Swollman/*
871834Swollman * FP register bit field masks
881834Swollman */
891834Swollman#define FP_MSKS_FLD	0x3f	/* exception masks field */
901834Swollman#define FP_PRC_FLD	0x300	/* precision control field */
911834Swollman#define FP_RND_FLD	0xc00	/* round control field */
921834Swollman#define FP_STKY_FLD	0x3f	/* sticky flags field */
931834Swollman
941834Swollman/*
951834Swollman * FP register bit field offsets
961834Swollman */
971834Swollman#define FP_MSKS_OFF	0	/* exception masks offset */
981834Swollman#define FP_PRC_OFF	8	/* precision control offset */
991834Swollman#define FP_RND_OFF	10	/* round control offset */
1001834Swollman#define FP_STKY_OFF	0	/* sticky flags offset */
1011834Swollman
1021834Swollman#endif /* __i386__ */
1031834Swollman
1041834Swollman#endif /* !_IEEEFP_H_ */
105