Consolidate the 128-bit long double defintions to <sys/ieee754.h>
Each arch that uses it now defines __HAVE_LONG_DOUBLE to 128. <machine/ieee.h> is now just include the machine's math.h followed by <sys/ieee754.h>
This commit is contained in:
parent
1ee00af75d
commit
4d035bbcf3
@ -1,120 +1,4 @@
|
||||
/* $NetBSD: ieee.h,v 1.10 2014/01/29 01:34:44 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2014 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Matt Thomas of 3am Software Foundry.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||
* floating point. It does *not* define (yet?) any of the rounding
|
||||
* mode bits, exceptions, and so forth.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_IEEE_H_
|
||||
#define _ARM_IEEE_H_
|
||||
/* $NetBSD: ieee.h,v 1.11 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#include <arm/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
|
||||
#include <sys/ieee754.h>
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#endif
|
||||
|
||||
#ifdef __ARM_PCS_AAPCS64
|
||||
|
||||
/*
|
||||
* The AArch64 architecture defines the following IEEE 754 compliant
|
||||
* 128-bit extended-precision format.
|
||||
*/
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >> 0); \
|
||||
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
|
||||
(a)[2] = (uint32_t)((u).extu_ext.ext_frach >> 0); \
|
||||
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32); \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
struct ieee_ext {
|
||||
#ifdef __AARCH64EB__
|
||||
uint64_t ext_sign:1;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_fracl;
|
||||
#else
|
||||
uint64_t ext_fracl;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_sign:1;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
|
||||
* high fraction; if the bit is set, it is a `quiet NaN'.
|
||||
*/
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#define EXT_EXP_INF 0x7fff
|
||||
#define EXT_EXP_NAN 0x7fff
|
||||
|
||||
#if 0
|
||||
#define EXT_QUIETNAN (1 << 15)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define EXT_EXP_BIAS 16383
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
|
||||
#define LDBL_IMPLICIT_NBIT 1 /* our NBIT is implicit */
|
||||
|
||||
#endif /* __ARM_PCS_AAPCS64 */
|
||||
|
||||
#endif /* !_ARM_IEEE_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: math.h,v 1.3 2014/01/29 01:01:14 matt Exp $ */
|
||||
/* $NetBSD: math.h,v 1.4 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#define __HAVE_NANF
|
||||
#ifdef __ARM_PCS_AAPCS64
|
||||
#define __HAVE_LONG_DOUBLE
|
||||
#define __HAVE_LONG_DOUBLE 128
|
||||
#endif
|
||||
|
@ -1,117 +1,4 @@
|
||||
/* $NetBSD: ieee.h,v 1.13 2014/01/31 12:40:37 matt Exp $ */
|
||||
|
||||
/* $OpenBSD: ieee.h,v 1.1 1999/04/20 19:44:04 mickey Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
#ifndef _HPPA_IEEE_H_
|
||||
#define _HPPA_IEEE_H_
|
||||
|
||||
/*
|
||||
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||
* floating point. It does *not* define (yet?) any of the rounding
|
||||
* mode bits, exceptions, and so forth.
|
||||
*/
|
||||
/* $NetBSD: ieee.h,v 1.14 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#include <hppa/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
|
||||
#include <sys/ieee754.h>
|
||||
|
||||
#ifdef _LP64
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >> 0); \
|
||||
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
|
||||
(a)[2] = (uint32_t)((u).extu_ext.ext_frach >> 0); \
|
||||
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32); \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
struct ieee_ext {
|
||||
uint64_t ext_sign:1;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_fracl;
|
||||
};
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* A NaN is a `signalling NaN' if its QUIETNAN bit is set in its
|
||||
* high fraction; if the bit is clear, it is a `quiet NaN'.
|
||||
*/
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#define EXT_EXP_INF 0x7fff
|
||||
#define EXT_EXP_NAN 0x7fff
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#define EXT_QUIETNAN (1 << 15)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define EXT_EXP_BIAS 16383
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
|
||||
#define LDBL_IMPLICIT_NBIT 1 /* our NBIT is implicit */
|
||||
|
||||
#endif /* _LP64 */
|
||||
|
||||
#endif /* !_HPPA_IEEE_H_ */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $NetBSD: math.h,v 1.7 2005/12/11 12:17:37 christos Exp $ */
|
||||
/* $NetBSD: math.h,v 1.8 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#ifdef _LP64
|
||||
#define __HAVE_LONG_DOUBLE
|
||||
#define __HAVE_LONG_DOUBLE 128
|
||||
#endif
|
||||
#define __HAVE_NANF
|
||||
|
@ -1,129 +1,4 @@
|
||||
/* $NetBSD: ieee.h,v 1.10 2014/01/31 11:53:37 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||
* floating point. It does *not* define (yet?) any of the rounding
|
||||
* mode bits, exceptions, and so forth.
|
||||
*/
|
||||
|
||||
#ifndef _MIPS_IEEE_H
|
||||
#define _MIPS_IEEE_H
|
||||
/* $NetBSD: ieee.h,v 1.11 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#include <mips/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
|
||||
#include <sys/ieee754.h>
|
||||
|
||||
/*
|
||||
* The MIPS architecture defines the following IEEE 754 compliant
|
||||
* 128-bit extended-precision format, which is supported only by the
|
||||
* v9 toolchain.
|
||||
*/
|
||||
|
||||
#if defined(__mips_n32) || defined(__mips_n64)
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >> 0); \
|
||||
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
|
||||
(a)[2] = (uint32_t)((u).extu_ext.ext_frach >> 0); \
|
||||
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32); \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
struct ieee_ext {
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
uint64_t ext_sign:1;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_fracl;
|
||||
#else
|
||||
uint64_t ext_fracl;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_sign:1;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
|
||||
* high fraction; if the bit is set, it is a `quiet NaN'.
|
||||
*/
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#define EXT_EXP_INF 0x7fff
|
||||
#define EXT_EXP_NAN 0x7fff
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#define EXT_QUIETNAN (1 << 15)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define EXT_EXP_BIAS 16383
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
|
||||
#define LDBL_IMPLICIT_NBIT 1 /* our NBIT is implicit */
|
||||
|
||||
#endif /* __mips_n32 || __mips_n64 */
|
||||
|
||||
#endif /* _MIPS_IEEE_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: math.h,v 1.6 2013/05/23 21:39:49 christos Exp $ */
|
||||
/* $NetBSD: math.h,v 1.7 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||
@ -27,5 +27,5 @@
|
||||
*/
|
||||
#define __HAVE_NANF
|
||||
#if defined(__mips_n32) || defined(__mips_n64)
|
||||
#define __HAVE_LONG_DOUBLE
|
||||
#define __HAVE_LONG_DOUBLE 128
|
||||
#endif
|
||||
|
@ -1,124 +1,4 @@
|
||||
/* $NetBSD: ieee.h,v 1.17 2013/12/15 03:45:07 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Lawrence Berkeley Laboratory.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ieee.h 8.1 (Berkeley) 6/11/93
|
||||
*/
|
||||
|
||||
/*
|
||||
* ieee.h defines the machine-dependent layout of the machine's IEEE
|
||||
* floating point. It does *not* define (yet?) any of the rounding
|
||||
* mode bits, exceptions, and so forth.
|
||||
*/
|
||||
/* $NetBSD: ieee.h,v 1.18 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#include <sparc/math.h> /* for #define __HAVE_LONG_DOUBLE 128 */
|
||||
#include <sys/ieee754.h>
|
||||
|
||||
/*
|
||||
* The SPARC architecture defines the following IEEE 754 compliant
|
||||
* 128-bit extended-precision format, which is supported only by the
|
||||
* v9 toolchain.
|
||||
*/
|
||||
|
||||
#if defined(__arch64__) || defined(_KERNEL)
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS (16+32)
|
||||
#define EXT_FRACLBITS (32+32)
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
struct ieee_ext {
|
||||
/*LINTED35*/ uint64_t ext_sign:1;
|
||||
/*LINTED35*/ uint64_t ext_exp:EXT_EXPBITS;
|
||||
/*LINTED35*/ uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_fracl;
|
||||
};
|
||||
__CTASSERT(sizeof(struct ieee_ext) == 16);
|
||||
|
||||
/*
|
||||
* Copy all mantissa bits to an array of uint32_t big enough to hold them all.
|
||||
* This is an insane API (seems to only be needed in gdtoa).
|
||||
*/
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl & 0x0ffffffffL); \
|
||||
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
|
||||
(a)[2] = (uint32_t)((u).extu_ext.ext_frach & 0x0ffffffffL); \
|
||||
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32) & 0x0ffff; \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
* Floats whose exponent is zero are either zero (iff all fraction
|
||||
* bits are zero) or subnormal values.
|
||||
*
|
||||
* A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its
|
||||
* high fraction; if the bit is set, it is a `quiet NaN'.
|
||||
*/
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#define EXT_EXP_INF 0x7fff
|
||||
#define EXT_EXP_NAN 0x7fff
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#define EXT_QUIETNAN (1 << 15)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define EXT_EXP_BIAS 16383
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
*/
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_fraclm extu_ext.ext_fraclm
|
||||
#define extu_frachm extu_ext.ext_frachm
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
|
||||
#define LDBL_IMPLICIT_NBIT 1
|
||||
|
||||
#endif /* __arch64__ || _KERNEL */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: math.h,v 1.5 2008/12/15 00:25:05 mrg Exp $ */
|
||||
/* $NetBSD: math.h,v 1.6 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
#define __HAVE_NANF
|
||||
|
||||
#ifdef _LP64
|
||||
#define __HAVE_LONG_DOUBLE
|
||||
#define __HAVE_LONG_DOUBLE 128
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ieee754.h,v 1.9 2013/05/08 05:27:01 matt Exp $ */
|
||||
/* $NetBSD: ieee754.h,v 1.10 2014/01/31 19:38:06 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -52,7 +52,8 @@
|
||||
/*
|
||||
* <sys/ieee754.h> defines the layout of IEEE 754 floating point types.
|
||||
* Only single-precision and double-precision types are defined here;
|
||||
* extended types, if available, are defined in the machine-dependent
|
||||
* 128-bit long doubles are define here IFF __HAVE_LONG_DOUBLE equals 128.
|
||||
* Otherwise extended types, if available, are defined in the machine-dependent
|
||||
* header.
|
||||
*/
|
||||
|
||||
@ -118,6 +119,35 @@ struct ieee_double {
|
||||
#endif
|
||||
};
|
||||
|
||||
#if __HAVE_LONG_DOUBLE == 128
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 48
|
||||
#define EXT_FRACLBITS 64
|
||||
#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACHBITS)
|
||||
|
||||
#define EXT_TO_ARRAY32(u, a) do { \
|
||||
(a)[0] = (uint32_t)((u).extu_ext.ext_fracl >> 0); \
|
||||
(a)[1] = (uint32_t)((u).extu_ext.ext_fracl >> 32); \
|
||||
(a)[2] = (uint32_t)((u).extu_ext.ext_frach >> 0); \
|
||||
(a)[3] = (uint32_t)((u).extu_ext.ext_frach >> 32); \
|
||||
} while(/*CONSTCOND*/0)
|
||||
|
||||
struct ieee_ext {
|
||||
#if _BYTE_ORDER == _BIG_ENDIAN
|
||||
uint64_t ext_sign:1;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_fracl;
|
||||
#else
|
||||
uint64_t ext_fracl;
|
||||
uint64_t ext_frach:EXT_FRACHBITS;
|
||||
uint64_t ext_exp:EXT_EXPBITS;
|
||||
uint64_t ext_sign:1;
|
||||
#endif
|
||||
};
|
||||
#endif /* __HAVE_LONG_DOUBLE == 128 */
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
* `normal'. Floats whose exponent is INFNAN are either Inf or NaN.
|
||||
@ -130,12 +160,18 @@ struct ieee_double {
|
||||
*/
|
||||
#define SNG_EXP_INFNAN 255
|
||||
#define DBL_EXP_INFNAN 2047
|
||||
#if __HAVE_LONG_DOUBLE == 128
|
||||
#define EXT_EXP_INFNAN 0x7fff
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define SNG_EXP_BIAS 127
|
||||
#define DBL_EXP_BIAS 1023
|
||||
#if __HAVE_LONG_DOUBLE == 128
|
||||
#define EXT_EXP_BIAS 16383
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Convenience data structures.
|
||||
@ -161,4 +197,22 @@ union ieee_double_u {
|
||||
#define dblu_fracl dblu_dbl.dbl_fracl
|
||||
#define DBLU_ZEROFRAC_P(u) (((u).dblu_frach|(u).dblu_fracl) != 0)
|
||||
|
||||
#if __HAVE_LONG_DOUBLE
|
||||
union ieee_ext_u {
|
||||
long double extu_ld;
|
||||
struct ieee_ext extu_ext;
|
||||
};
|
||||
|
||||
#define extu_exp extu_ext.ext_exp
|
||||
#define extu_sign extu_ext.ext_sign
|
||||
#define extu_fracl extu_ext.ext_fracl
|
||||
#define extu_frach extu_ext.ext_frach
|
||||
#define EXTU_ZEROFRAC_P(u) (((u).extu_frach|(u).extu_fracl) != 0)
|
||||
|
||||
#ifndef LDBL_NBIT
|
||||
#define LDBL_IMPLICIT_NBIT 1 /* our NBIT is implicit */
|
||||
#endif
|
||||
|
||||
#endif /* __HAVE_LONG_DOUBLE */
|
||||
|
||||
#endif /* _SYS_IEEE754_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user