ieeefp.h revision 49081
12089Ssos/*-
216565Ssos * Copyright (c) 1990 Andrew Moore, Talke Studio
32089Ssos * All rights reserved.
42089Ssos *
52089Ssos * Redistribution and use in source and binary forms, with or without
62089Ssos * modification, are permitted provided that the following conditions
72089Ssos * are met:
82089Ssos * 1. Redistributions of source code must retain the above copyright
95994Ssos *    notice, this list of conditions and the following disclaimer.
105994Ssos * 2. Redistributions in binary form must reproduce the above copyright
112089Ssos *    notice, this list of conditions and the following disclaimer in the
122089Ssos *    documentation and/or other materials provided with the distribution.
132089Ssos * 3. All advertising materials mentioning features or use of this software
142089Ssos *    must display the following acknowledgement:
1597748Sschweikh *	This product includes software developed by the University of
162089Ssos *	California, Berkeley and its contributors.
172089Ssos * 4. Neither the name of the University nor the names of its contributors
182089Ssos *    may be used to endorse or promote products derived from this software
192089Ssos *    without specific prior written permission.
202089Ssos *
212089Ssos * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
222089Ssos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
232089Ssos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
242089Ssos * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
252089Ssos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
262089Ssos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
272089Ssos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
282089Ssos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2930764Scharnier * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3030764Scharnier * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3150479Speter * SUCH DAMAGE.
3230764Scharnier *
3330764Scharnier * 	from: @(#) ieeefp.h 	1.0 (Berkeley) 9/23/93
342089Ssos *	$Id: ieeefp.h,v 1.5 1997/02/22 09:34:41 peter Exp $
3530764Scharnier */
3655849Syokota
372089Ssos/*
3823457Sbrian *	IEEE floating point type and constant definitions.
3930764Scharnier */
4023702Speter
4166834Sphk#ifndef _MACHINE_IEEEFP_H_
4266834Sphk#define _MACHINE_IEEEFP_H_
432089Ssos
4475344Ssobomax/*
4575344Ssobomax * FP rounding modes
462089Ssos */
4723457Sbriantypedef enum {
482089Ssos	FP_RN=0,	/* round to nearest */
4971642Ssobomax	FP_RM,		/* round down to minus infinity */
5071642Ssobomax	FP_RP,		/* round up to plus infinity */
5171642Ssobomax	FP_RZ		/* truncate */
5271642Ssobomax} fp_rnd_t;
53102111Ssobomax
54102111Ssobomax/*
55102111Ssobomax * FP precision modes
56102111Ssobomax */
57102111Ssobomaxtypedef enum {
58102111Ssobomax	FP_PS=0,	/* 24 bit (single-precision) */
59102111Ssobomax	FP_PRS,		/* reserved */
6076845Ssobomax	FP_PD,		/* 53 bit (double-precision) */
6176845Ssobomax	FP_PE		/* 64 bit (extended-precision) */
622089Ssos} fp_prec_t;
632089Ssos
642089Ssos#define fp_except_t	int
652089Ssos
662089Ssos/*
676628Ssos * FP exception masks
682089Ssos */
696047Ssos#define FP_X_INV	0x01	/* invalid operation */
7071642Ssobomax#define FP_X_DNML	0x02	/* denormal */
7171642Ssobomax#define FP_X_DZ		0x04	/* zero divide */
722089Ssos#define FP_X_OFL	0x08	/* overflow */
732089Ssos#define FP_X_UFL	0x10	/* underflow */
742089Ssos#define FP_X_IMP	0x20	/* (im)precision */
752089Ssos#define FP_X_STK	0x40	/* stack fault */
7630764Scharnier
77140159Sdelphij/*
786628Ssos * FP registers
7999706Sdd */
80102111Ssobomax#define FP_MSKS_REG	0	/* exception masks */
8177329Sdes#define FP_PRC_REG	0	/* precision */
8299706Sdd#define FP_RND_REG	0	/* direction */
8399706Sdd#define FP_STKY_REG	1	/* sticky flags */
8499706Sdd
8530764Scharnier/*
866628Ssos * FP register bit field masks
876628Ssos */
88140159Sdelphij#define FP_MSKS_FLD	0x3f	/* exception masks field */
8975344Ssobomax#define FP_PRC_FLD	0x300	/* precision control field */
902089Ssos#define FP_RND_FLD	0xc00	/* round control field */
912089Ssos#define FP_STKY_FLD	0x3f	/* sticky flags field */
922089Ssos
9375344Ssobomax/*
9475344Ssobomax * FP register bit field offsets
9575344Ssobomax */
962089Ssos#define FP_MSKS_OFF	0	/* exception masks offset */
972089Ssos#define FP_PRC_OFF	8	/* precision control offset */
98140159Sdelphij#define FP_RND_OFF	10	/* round control offset */
99140159Sdelphij#define FP_STKY_OFF	0	/* sticky flags offset */
1002089Ssos
10192460Ssobomax#endif /* !_MACHINE_IEEEFP_H_ */
10292460Ssobomax