ieeefp.h (122296) | ieeefp.h (143063) |
---|---|
1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1990 Andrew Moore, Talke Studio 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * from: @(#) ieeefp.h 1.0 (Berkeley) 9/23/93 | 1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1990 Andrew Moore, Talke Studio 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * from: @(#) ieeefp.h 1.0 (Berkeley) 9/23/93 |
35 * $FreeBSD: head/sys/amd64/include/ieeefp.h 122296 2003-11-08 04:39:22Z peter $ | 35 * $FreeBSD: head/sys/amd64/include/ieeefp.h 143063 2005-03-02 21:33:29Z joerg $ |
36 */ 37 38/* 39 * IEEE floating point type and constant definitions. 40 */ 41 42#ifndef _MACHINE_IEEEFP_H_ 43#define _MACHINE_IEEEFP_H_ 44 | 36 */ 37 38/* 39 * IEEE floating point type and constant definitions. 40 */ 41 42#ifndef _MACHINE_IEEEFP_H_ 43#define _MACHINE_IEEEFP_H_ 44 |
45#ifndef _SYS_CDEFS_H_ 46#error this file needs sys/cdefs.h as a prerequisite 47#endif 48 |
|
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 */ --- 59 unchanged lines hidden (view full) --- 112 * SSE mxcsr register bit field offsets 113 */ 114#define SSE_STKY_OFF 0 /* exception flags offset */ 115#define SSE_DAZ_OFF 6 /* DAZ exception mask offset */ 116#define SSE_MSKS_OFF 7 /* other exception masks offset */ 117#define SSE_RND_OFF 13 /* rounding control offset */ 118#define SSE_FZ_OFF 15 /* flush to zero offset */ 119 | 49/* 50 * FP rounding modes 51 */ 52typedef enum { 53 FP_RN=0, /* round to nearest */ 54 FP_RM, /* round down to minus infinity */ 55 FP_RP, /* round up to plus infinity */ 56 FP_RZ /* truncate */ --- 59 unchanged lines hidden (view full) --- 116 * SSE mxcsr register bit field offsets 117 */ 118#define SSE_STKY_OFF 0 /* exception flags offset */ 119#define SSE_DAZ_OFF 6 /* DAZ exception mask offset */ 120#define SSE_MSKS_OFF 7 /* other exception masks offset */ 121#define SSE_RND_OFF 13 /* rounding control offset */ 122#define SSE_FZ_OFF 15 /* flush to zero offset */ 123 |
120#if defined(__GNUC__) && !defined(__cplusplus) | 124#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) \ 125 && !defined(__cplusplus) |
121 122#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) 123#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) 124#define __fldcw(addr) __asm __volatile("fldcw %0" : "=m" (*(addr))) 125#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) 126#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) 127#define __ldmxcsr(addr) __asm __volatile("ldmxcsr %0" : "=m" (*(addr))) 128#define __stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr))) --- 129 unchanged lines hidden (view full) --- 258 _p |= _mxcsr & SSE_STKY_FLD; 259 _env[FP_STKY_REG] &= ~_m; 260 __fldenv(_env); 261 _mxcsr &= ~_m; 262 __ldmxcsr(&_mxcsr); 263 return (_p); 264} 265 | 126 127#define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) 128#define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) 129#define __fldcw(addr) __asm __volatile("fldcw %0" : "=m" (*(addr))) 130#define __fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) 131#define __fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) 132#define __ldmxcsr(addr) __asm __volatile("ldmxcsr %0" : "=m" (*(addr))) 133#define __stmxcsr(addr) __asm __volatile("stmxcsr %0" : "=m" (*(addr))) --- 129 unchanged lines hidden (view full) --- 263 _p |= _mxcsr & SSE_STKY_FLD; 264 _env[FP_STKY_REG] &= ~_m; 265 __fldenv(_env); 266 _mxcsr &= ~_m; 267 __ldmxcsr(&_mxcsr); 268 return (_p); 269} 270 |
266#endif /* __GNUC__ && !__cplusplus */ | 271#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE__ && !__cplusplus */ |
267 | 272 |
268#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) && defined(__GNUC__) | 273#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) \ 274 && defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) |
269 270#define fpgetround() __fpgetround() 271#define fpsetround(_m) __fpsetround(_m) 272#define fpgetprec() __fpgetprec() 273#define fpsetprec(_m) __fpsetprec(_m) 274#define fpgetmask() __fpgetmask() 275#define fpsetmask(_m) __fpsetmask(_m) 276#define fpgetsticky() __fpgetsticky() 277#define fpsetsticky(_m) __fpsetsticky(_m) 278 279/* Suppress prototypes in the MI header. */ 280#define _IEEEFP_INLINED_ 1 281 | 275 276#define fpgetround() __fpgetround() 277#define fpsetround(_m) __fpsetround(_m) 278#define fpgetprec() __fpgetprec() 279#define fpsetprec(_m) __fpsetprec(_m) 280#define fpgetmask() __fpgetmask() 281#define fpsetmask(_m) __fpsetmask(_m) 282#define fpgetsticky() __fpgetsticky() 283#define fpsetsticky(_m) __fpsetsticky(_m) 284 285/* Suppress prototypes in the MI header. */ 286#define _IEEEFP_INLINED_ 1 287 |
282#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */ | 288#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM 289 && __CC_SUPPORTS___INLINE__ */ |
283 284/* Augment the userland declarations */ 285__BEGIN_DECLS 286extern fp_prec_t fpgetprec(void); 287extern fp_prec_t fpsetprec(fp_prec_t); 288__END_DECLS 289 | 290 291/* Augment the userland declarations */ 292__BEGIN_DECLS 293extern fp_prec_t fpgetprec(void); 294extern fp_prec_t fpsetprec(fp_prec_t); 295__END_DECLS 296 |
290#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */ | 297#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM 298 && __CC_SUPPORTS___INLINE__ */ |
291 292#endif /* !_MACHINE_IEEEFP_H_ */ | 299 300#endif /* !_MACHINE_IEEEFP_H_ */ |