Module Name: src
Committed By: matt
Date: Fri Jan 31 19:38:06 UTC 2014
Modified Files:
src/sys/arch/arm/include: ieee.h math.h
src/sys/arch/hppa/include: ieee.h math.h
src/sys/arch/mips/include: ieee.h math.h
src/sys/arch/sparc/include: ieee.h math.h
src/sys/sys: ieee754.h
Log Message:
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>
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/include/ieee.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/include/math.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hppa/include/ieee.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/hppa/include/math.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/mips/include/ieee.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/include/math.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc/include/ieee.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/include/math.h
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/ieee754.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/arm/include/ieee.h
diff -u src/sys/arch/arm/include/ieee.h:1.10 src/sys/arch/arm/include/ieee.h:1.11
--- src/sys/arch/arm/include/ieee.h:1.10 Wed Jan 29 01:34:44 2014
+++ src/sys/arch/arm/include/ieee.h Fri Jan 31 19:38:06 2014
@@ -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_ */
Index: src/sys/arch/arm/include/math.h
diff -u src/sys/arch/arm/include/math.h:1.3 src/sys/arch/arm/include/math.h:1.4
--- src/sys/arch/arm/include/math.h:1.3 Wed Jan 29 01:01:14 2014
+++ src/sys/arch/arm/include/math.h Fri Jan 31 19:38:06 2014
@@ -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
Index: src/sys/arch/hppa/include/ieee.h
diff -u src/sys/arch/hppa/include/ieee.h:1.13 src/sys/arch/hppa/include/ieee.h:1.14
--- src/sys/arch/hppa/include/ieee.h:1.13 Fri Jan 31 12:40:37 2014
+++ src/sys/arch/hppa/include/ieee.h Fri Jan 31 19:38:06 2014
@@ -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_ */
Index: src/sys/arch/hppa/include/math.h
diff -u src/sys/arch/hppa/include/math.h:1.7 src/sys/arch/hppa/include/math.h:1.8
--- src/sys/arch/hppa/include/math.h:1.7 Sun Dec 11 12:17:37 2005
+++ src/sys/arch/hppa/include/math.h Fri Jan 31 19:38:06 2014
@@ -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
Index: src/sys/arch/mips/include/ieee.h
diff -u src/sys/arch/mips/include/ieee.h:1.10 src/sys/arch/mips/include/ieee.h:1.11
--- src/sys/arch/mips/include/ieee.h:1.10 Fri Jan 31 11:53:37 2014
+++ src/sys/arch/mips/include/ieee.h Fri Jan 31 19:38:06 2014
@@ -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 */
Index: src/sys/arch/mips/include/math.h
diff -u src/sys/arch/mips/include/math.h:1.6 src/sys/arch/mips/include/math.h:1.7
--- src/sys/arch/mips/include/math.h:1.6 Thu May 23 21:39:49 2013
+++ src/sys/arch/mips/include/math.h Fri Jan 31 19:38:06 2014
@@ -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
Index: src/sys/arch/sparc/include/ieee.h
diff -u src/sys/arch/sparc/include/ieee.h:1.17 src/sys/arch/sparc/include/ieee.h:1.18
--- src/sys/arch/sparc/include/ieee.h:1.17 Sun Dec 15 03:45:07 2013
+++ src/sys/arch/sparc/include/ieee.h Fri Jan 31 19:38:06 2014
@@ -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 */
Index: src/sys/arch/sparc/include/math.h
diff -u src/sys/arch/sparc/include/math.h:1.5 src/sys/arch/sparc/include/math.h:1.6
--- src/sys/arch/sparc/include/math.h:1.5 Mon Dec 15 00:25:05 2008
+++ src/sys/arch/sparc/include/math.h Fri Jan 31 19:38:06 2014
@@ -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
Index: src/sys/sys/ieee754.h
diff -u src/sys/sys/ieee754.h:1.9 src/sys/sys/ieee754.h:1.10
--- src/sys/sys/ieee754.h:1.9 Wed May 8 05:27:01 2013
+++ src/sys/sys/ieee754.h Fri Jan 31 19:38:06 2014
@@ -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_ */