ieeefp.h (109520) | ieeefp.h (126891) |
---|---|
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 109520 2003-01-19 06:01:33Z marcel $ | 34 * $FreeBSD: head/sys/i386/include/ieeefp.h 126891 2004-03-12 21:45:33Z trhodes $ |
35 */ 36 37/* 38 * IEEE floating point type and constant definitions. 39 */ 40 41#ifndef _MACHINE_IEEEFP_H_ 42#define _MACHINE_IEEEFP_H_ --- 50 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 | 35 */ 36 37/* 38 * IEEE floating point type and constant definitions. 39 */ 40 41#ifndef _MACHINE_IEEEFP_H_ 42#define _MACHINE_IEEEFP_H_ --- 50 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 |
101#ifdef __GNUC__ | 101#if defined(__GNUC__) || defined(__INTEL_COMPILER) |
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 | 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 |
154#endif /* __GNUC__ */ | 154#endif /* __GNUC__ || __INTEL_COMPILER */ |
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 --- | 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 --- |