Misc cleanups and CVS surgery. Move a number of header and source files
[dragonfly.git] / sys / cpu / i386 / include / ieeefp.h
CommitLineData
984263bc
MD
1/*-
2 * Copyright (c) 1990 Andrew Moore, Talke Studio
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * from: @(#) ieeefp.h 1.0 (Berkeley) 9/23/93
34 * $FreeBSD: src/sys/i386/include/ieeefp.h,v 1.7 1999/08/28 00:44:15 peter Exp $
88181b08 35 * $DragonFly: src/sys/cpu/i386/include/ieeefp.h,v 1.3 2006/11/07 17:51:21 dillon Exp $
984263bc
MD
36 */
37
38/*
39 * IEEE floating point type and constant definitions.
40 */
41
88181b08
MD
42#ifndef _CPU_IEEEFP_H_
43#define _CPU_IEEEFP_H_
984263bc
MD
44
45/*
46 * FP rounding modes
47 */
48typedef enum {
49 FP_RN=0, /* round to nearest */
50 FP_RM, /* round down to minus infinity */
51 FP_RP, /* round up to plus infinity */
52 FP_RZ /* truncate */
53} fp_rnd_t;
54
55/*
56 * FP precision modes
57 */
58typedef enum {
59 FP_PS=0, /* 24 bit (single-precision) */
60 FP_PRS, /* reserved */
61 FP_PD, /* 53 bit (double-precision) */
62 FP_PE /* 64 bit (extended-precision) */
63} fp_prec_t;
64
65#define fp_except_t int
66
67/*
68 * FP exception masks
69 */
70#define FP_X_INV 0x01 /* invalid operation */
71#define FP_X_DNML 0x02 /* denormal */
72#define FP_X_DZ 0x04 /* zero divide */
73#define FP_X_OFL 0x08 /* overflow */
74#define FP_X_UFL 0x10 /* underflow */
75#define FP_X_IMP 0x20 /* (im)precision */
76#define FP_X_STK 0x40 /* stack fault */
77
78/*
79 * FP registers
80 */
81#define FP_MSKS_REG 0 /* exception masks */
82#define FP_PRC_REG 0 /* precision */
83#define FP_RND_REG 0 /* direction */
84#define FP_STKY_REG 1 /* sticky flags */
85
86/*
87 * FP register bit field masks
88 */
89#define FP_MSKS_FLD 0x3f /* exception masks field */
90#define FP_PRC_FLD 0x300 /* precision control field */
91#define FP_RND_FLD 0xc00 /* round control field */
92#define FP_STKY_FLD 0x3f /* sticky flags field */
93
94/*
95 * FP register bit field offsets
96 */
97#define FP_MSKS_OFF 0 /* exception masks offset */
98#define FP_PRC_OFF 8 /* precision control offset */
99#define FP_RND_OFF 10 /* round control offset */
100#define FP_STKY_OFF 0 /* sticky flags offset */
101
88181b08 102#endif /* !_CPU_IEEEFP_H_ */