Deleted Added
full compact
ieeefp.h (126891) ieeefp.h (143063)
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

--- 17 unchanged lines hidden (view full) ---

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
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

--- 17 unchanged lines hidden (view full) ---

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: head/sys/i386/include/ieeefp.h 126891 2004-03-12 21:45:33Z trhodes $
34 * $FreeBSD: head/sys/i386/include/ieeefp.h 143063 2005-03-02 21:33:29Z joerg $
35 */
36
37/*
38 * IEEE floating point type and constant definitions.
39 */
40
41#ifndef _MACHINE_IEEEFP_H_
42#define _MACHINE_IEEEFP_H_
43
35 */
36
37/*
38 * IEEE floating point type and constant definitions.
39 */
40
41#ifndef _MACHINE_IEEEFP_H_
42#define _MACHINE_IEEEFP_H_
43
44#ifndef _SYS_CDEFS_H_
45#error this file needs sys/cdefs.h as a prerequisite
46#endif
47
44/*
45 * FP rounding modes
46 */
47typedef enum {
48 FP_RN=0, /* round to nearest */
49 FP_RM, /* round down to minus infinity */
50 FP_RP, /* round up to plus infinity */
51 FP_RZ /* truncate */

--- 41 unchanged lines hidden (view full) ---

93/*
94 * FP register bit field offsets
95 */
96#define FP_MSKS_OFF 0 /* exception masks offset */
97#define FP_PRC_OFF 8 /* precision control offset */
98#define FP_RND_OFF 10 /* round control offset */
99#define FP_STKY_OFF 0 /* sticky flags offset */
100
48/*
49 * FP rounding modes
50 */
51typedef enum {
52 FP_RN=0, /* round to nearest */
53 FP_RM, /* round down to minus infinity */
54 FP_RP, /* round up to plus infinity */
55 FP_RZ /* truncate */

--- 41 unchanged lines hidden (view full) ---

97/*
98 * FP register bit field offsets
99 */
100#define FP_MSKS_OFF 0 /* exception masks offset */
101#define FP_PRC_OFF 8 /* precision control offset */
102#define FP_RND_OFF 10 /* round control offset */
103#define FP_STKY_OFF 0 /* sticky flags offset */
104
101#if defined(__GNUC__) || defined(__INTEL_COMPILER)
105#ifdef __GNUCLIKE_ASM
102
103#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
104#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
105#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr)))
106#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr)))
107
108/*
109 * return the contents of a FP register

--- 36 unchanged lines hidden (view full) ---

146 */
147 __fnstenv(_env);
148 _p = (_env[_reg] & _fld) >> _off;
149 _env[_reg] = (_env[_reg] & ~_fld) | (_m << _off & _fld);
150 __fldenv(_env);
151 return _p;
152}
153
106
107#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr)))
108#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr)))
109#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr)))
110#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr)))
111
112/*
113 * return the contents of a FP register

--- 36 unchanged lines hidden (view full) ---

150 */
151 __fnstenv(_env);
152 _p = (_env[_reg] & _fld) >> _off;
153 _env[_reg] = (_env[_reg] & ~_fld) | (_m << _off & _fld);
154 __fldenv(_env);
155 return _p;
156}
157
154#endif /* __GNUC__ || __INTEL_COMPILER */
158#endif /* __GNUCLIKE_ASM */
155
156/*
157 * SysV/386 FP control interface
158 */
159#define fpgetround() ((fp_rnd_t) \
160 ((__fpgetreg(FP_RND_REG) & FP_RND_FLD) >> FP_RND_OFF))
161#define fpsetround(m) ((fp_rnd_t) \
162 __fpsetreg((m), FP_RND_REG, FP_RND_FLD, FP_RND_OFF))

--- 19 unchanged lines hidden ---
159
160/*
161 * SysV/386 FP control interface
162 */
163#define fpgetround() ((fp_rnd_t) \
164 ((__fpgetreg(FP_RND_REG) & FP_RND_FLD) >> FP_RND_OFF))
165#define fpsetround(m) ((fp_rnd_t) \
166 __fpsetreg((m), FP_RND_REG, FP_RND_FLD, FP_RND_OFF))

--- 19 unchanged lines hidden ---