Module Name: src
Committed By: matt
Date: Mon Jan 17 23:53:04 UTC 2011
Modified Files:
src/gnu/dist/gcc4/gcc/config/mips: netbsd64.h
src/lib/libc/arch/mips/gdtoa: Makefile.inc gd_qnan.h
src/lib/libc/arch/mips/gen: Makefile.inc
src/lib/libc/arch/mips/softfloat: softfloat.h
src/sys/arch/mips/include: float.h ieee.h math.h
Added Files:
src/lib/libc/gen: fpclassifyl_ieee754.c infinityl_ieee754.c
isfinitel_ieee754.c isinfl_ieee754.c isnanl_ieee754.c
signbitl_ieee754.c
Log Message:
Make the MIPS N32/N64 ABIs properly support 128-bit long doubles. With this
change, we should be fully conformant with the N32 and N64 ABIs.
Add {fpclassify,infinity,isnan,ininf,signbit}l_ieee754.c back to lib/libc/gen.
Note that infinityl_ieee754.c will work with either 64-bit, 80-bit, or
128-bit long doubles.
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/mips/gdtoa/Makefile.inc \
src/lib/libc/arch/mips/gdtoa/gd_qnan.h
cvs rdiff -u -r1.31 -r1.32 src/lib/libc/arch/mips/gen/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/mips/softfloat/softfloat.h
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/fpclassifyl_ieee754.c \
src/lib/libc/gen/infinityl_ieee754.c src/lib/libc/gen/isfinitel_ieee754.c \
src/lib/libc/gen/signbitl_ieee754.c
cvs rdiff -u -r0 -r1.4 src/lib/libc/gen/isinfl_ieee754.c
cvs rdiff -u -r0 -r1.6 src/lib/libc/gen/isnanl_ieee754.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/mips/include/float.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/mips/include/ieee.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/include/math.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h
diff -u src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.2 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.3
--- src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.2 Mon Dec 14 00:40:04 2009
+++ src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h Mon Jan 17 23:53:03 2011
@@ -50,9 +50,3 @@
%{mips32} %{mips32r2} %{mips64} %{mips64r2} \
%{bestGnum} %{call_shared} %{no_archive} %{exact_version} \
%(netbsd_link_spec)"
-
-#undef LONG_DOUBLE_TYPE_SIZE
-#define LONG_DOUBLE_TYPE_SIZE 64
-
-#undef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
-#define LIBGCC2_LONG_DOUBLE_TYPE_SIZE 64
Index: src/lib/libc/arch/mips/gdtoa/Makefile.inc
diff -u src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.1 src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.2
--- src/lib/libc/arch/mips/gdtoa/Makefile.inc:1.1 Wed Mar 15 17:35:18 2006
+++ src/lib/libc/arch/mips/gdtoa/Makefile.inc Mon Jan 17 23:53:03 2011
@@ -1,3 +1,10 @@
-# $NetBSD: Makefile.inc,v 1.1 2006/03/15 17:35:18 kleink Exp $
+# $NetBSD: Makefile.inc,v 1.2 2011/01/17 23:53:03 matt Exp $
+CPUFLAGS?=
SRCS+= strtof.c
+.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
+.if ${CPUFLAGS:M-mabi=32} == ""
+SRCS+= strtold_pQ.c
+SRCS+= strtopQ.c
+.endif
+.endif
Index: src/lib/libc/arch/mips/gdtoa/gd_qnan.h
diff -u src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.1 src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.2
--- src/lib/libc/arch/mips/gdtoa/gd_qnan.h:1.1 Wed Jan 25 15:33:28 2006
+++ src/lib/libc/arch/mips/gdtoa/gd_qnan.h Mon Jan 17 23:53:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: gd_qnan.h,v 1.1 2006/01/25 15:33:28 kleink Exp $ */
+/* $NetBSD: gd_qnan.h,v 1.2 2011/01/17 23:53:03 matt Exp $ */
#include <machine/endian.h>
@@ -6,7 +6,15 @@
#if BYTE_ORDER == BIG_ENDIAN
#define d_QNAN0 0x7ff40000
#define d_QNAN1 0x0
+#define ld_QNAN0 0x7fff8000
+#define ld_QNAN1 0x0
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x0
#else
#define d_QNAN0 0x0
#define d_QNAN1 0x7ff40000
+#define ld_QNAN0 0x0
+#define ld_QNAN1 0x0
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x7fff8000
#endif
Index: src/lib/libc/arch/mips/gen/Makefile.inc
diff -u src/lib/libc/arch/mips/gen/Makefile.inc:1.31 src/lib/libc/arch/mips/gen/Makefile.inc:1.32
--- src/lib/libc/arch/mips/gen/Makefile.inc:1.31 Fri Sep 3 17:22:51 2010
+++ src/lib/libc/arch/mips/gen/Makefile.inc Mon Jan 17 23:53:03 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.31 2010/09/03 17:22:51 matt Exp $
+# $NetBSD: Makefile.inc,v 1.32 2011/01/17 23:53:03 matt Exp $
.if ${MKSOFTFLOAT} == "no"
SRCS+= fabs.S ldexp.S modf.S
@@ -7,12 +7,12 @@
.endif
# Common ieee754 constants and functions
-SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_dbl_ieee754.c
-SRCS+= fpclassifyf_ieee754.c fpclassifyd_ieee754.c
-SRCS+= isinff_ieee754.c isinfd_ieee754.c
-SRCS+= isnanf_ieee754.c isnand_ieee754.c
-SRCS+= isfinitef_ieee754.c isfinited_ieee754.c
-SRCS+= signbitf_ieee754.c signbitd_ieee754.c
+SRCS+= infinityf_ieee754.c infinity_ieee754.c infinityl_ieee754.c
+SRCS+= fpclassifyf_ieee754.c fpclassifyd_ieee754.c fpclassifyl_ieee754.c
+SRCS+= isinff_ieee754.c isinfd_ieee754.c isinfl_ieee754.c
+SRCS+= isnanf_ieee754.c isnand_ieee754.c isnanl_ieee754.c
+SRCS+= isfinitef_ieee754.c isfinited_ieee754.c isfinitel_ieee754.c
+SRCS+= signbitf_ieee754.c signbitd_ieee754.c signbitl_ieee754.c
SRCS+= nanf.c
SRCS+= flt_rounds.c
Index: src/lib/libc/arch/mips/softfloat/softfloat.h
diff -u src/lib/libc/arch/mips/softfloat/softfloat.h:1.2 src/lib/libc/arch/mips/softfloat/softfloat.h:1.3
--- src/lib/libc/arch/mips/softfloat/softfloat.h:1.2 Mon Dec 14 01:07:42 2009
+++ src/lib/libc/arch/mips/softfloat/softfloat.h Mon Jan 17 23:53:04 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.h,v 1.2 2009/12/14 01:07:42 matt Exp $ */
+/* $NetBSD: softfloat.h,v 1.3 2011/01/17 23:53:04 matt Exp $ */
/* This is a derivative work. */
@@ -42,7 +42,9 @@
-------------------------------------------------------------------------------
*/
/* #define FLOATX80 */
-/* #define FLOAT128 */
+#if defined(__mips_n32) || defined(__mips_n64)
+#define FLOAT128
+#endif
#include <machine/ieeefp.h>
@@ -133,10 +135,10 @@
#ifdef FLOATX80
floatx80 int64_to_floatx80( long long );
#endif
+#endif
#ifdef FLOAT128
float128 int64_to_float128( long long );
#endif
-#endif
/*
-------------------------------------------------------------------------------
@@ -315,6 +317,7 @@
int float128_le_quiet( float128, float128 );
int float128_lt_quiet( float128, float128 );
int float128_is_signaling_nan( float128 );
+flag float128_is_nan( float128 );
#endif
Index: src/sys/arch/mips/include/float.h
diff -u src/sys/arch/mips/include/float.h:1.13 src/sys/arch/mips/include/float.h:1.14
--- src/sys/arch/mips/include/float.h:1.13 Mon May 12 15:22:54 2003
+++ src/sys/arch/mips/include/float.h Mon Jan 17 23:53:03 2011
@@ -1,3 +1,35 @@
-/* $NetBSD: float.h,v 1.13 2003/05/12 15:22:54 kleink Exp $ */
+/* $NetBSD: float.h,v 1.14 2011/01/17 23:53:03 matt Exp $ */
+
+#ifndef _MIPS_FLOAT_H_
+#define _MIPS_FLOAT_H_
+
+#if defined(__mips_n32) || defined(__mips_n64)
+
+#define LDBL_MANT_DIG 113
+#define LDBL_EPSILON 1.925929944387235853055977942584927319E-34L
+#define LDBL_DIG 33
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MIN 3.3621031431120935062626778173217526026E-4932L
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_EXP 16384
+#define LDBL_MAX 1.1897314953572317650857593266280070162E4932L
+#define LDBL_MAX_10_EXP 4932
+
+#endif /* __mips_n32 || __mips_n64 */
#include <sys/float_ieee754.h>
+
+#if defined(__mips_n32) || defined(__mips_n64)
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+ !defined(_XOPEN_SOURCE) || \
+ ((__STDC_VERSION__ - 0) >= 199901L) || \
+ ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+ ((_XOPEN_SOURCE - 0) >= 600) || \
+ defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#define DECIMAL_DIG 36
+#endif /* !defined(_ANSI_SOURCE) && ... */
+
+#endif /* __mips_n32 || __mips_n64 */
+
+#endif /* _MIPS_FLOAT_H_ */
Index: src/sys/arch/mips/include/ieee.h
diff -u src/sys/arch/mips/include/ieee.h:1.5 src/sys/arch/mips/include/ieee.h:1.6
--- src/sys/arch/mips/include/ieee.h:1.5 Sun Dec 11 12:18:09 2005
+++ src/sys/arch/mips/include/ieee.h Mon Jan 17 23:53:03 2011
@@ -1,13 +1,136 @@
-/* $NetBSD: ieee.h,v 1.5 2005/12/11 12:18:09 christos Exp $ */
+/* $NetBSD: ieee.h,v 1.6 2011/01/17 23:53:03 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
#include <sys/ieee754.h>
/*
- * 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'.
+ * The SPARC 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 16
+#define EXT_FRACHMBITS 32
+#define EXT_FRACLMBITS 32
+#define EXT_FRACLBITS 32
+#define EXT_FRACBITS (EXT_FRACLBITS + EXT_FRACLMBITS + EXT_FRACHMBITS + EXT_FRACHBITS)
+
+#define EXT_TO_ARRAY32(u, a) do { \
+ (a)[0] = (uint32_t)(u).extu_ext.ext_fracl; \
+ (a)[1] = (uint32_t)(u).extu_ext.ext_fraclm; \
+ (a)[2] = (uint32_t)(u).extu_ext.ext_frachm; \
+ (a)[3] = (uint32_t)(u).extu_ext.ext_frach; \
+} while(/*CONSTCOND*/0)
+
+struct ieee_ext {
+#if _BYTE_ORDER == _BIG_ENDIAN
+ u_int ext_sign:1;
+ u_int ext_exp:EXT_EXPBITS;
+ u_int ext_frach:EXT_FRACHBITS;
+ u_int ext_frachm;
+ u_int ext_fraclm;
+ u_int ext_fracl;
+#else
+ u_int ext_fracl;
+ u_int ext_fraclm;
+ u_int ext_frachm;
+ u_int ext_frach:EXT_FRACHBITS;
+ u_int ext_exp:EXT_EXPBITS;
+ u_int 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_NBIT 0x80000000
+#define mask_nbit_l(u) ((u).extu_frach &= ~LDBL_NBIT)
+
+#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.4 src/sys/arch/mips/include/math.h:1.5
--- src/sys/arch/mips/include/math.h:1.4 Tue Feb 19 13:08:14 2002
+++ src/sys/arch/mips/include/math.h Mon Jan 17 23:53:03 2011
@@ -1,3 +1,6 @@
-/* $NetBSD: math.h,v 1.4 2002/02/19 13:08:14 simonb Exp $ */
+/* $NetBSD: math.h,v 1.5 2011/01/17 23:53:03 matt Exp $ */
#define __HAVE_NANF
+#if defined(__mips_n32) || defined(__mips_n64)
+#define __HAVE_LONG_DOUBLE
+#endif
Added files:
Index: src/lib/libc/gen/fpclassifyl_ieee754.c
diff -u /dev/null src/lib/libc/gen/fpclassifyl_ieee754.c:1.1
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/fpclassifyl_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,68 @@
+/* $NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fpclassifyl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+/*
+ * 7.12.3.1 fpclassify - classify real floating type
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__fpclassifyl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ if (u.extu_ext.ext_exp == 0) {
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
+ && u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+ return FP_ZERO;
+ else
+ return FP_SUBNORMAL;
+ } else if (u.extu_ext.ext_exp == EXT_EXP_INFNAN) {
+ if (u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
+ && u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0)
+ return FP_INFINITE;
+ else
+ return FP_NAN;
+ }
+
+ return FP_NORMAL;
+}
+#endif /* __HAVE_LONG_DOUBLE */
Index: src/lib/libc/gen/infinityl_ieee754.c
diff -u /dev/null src/lib/libc/gen/infinityl_ieee754.c:1.1
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/infinityl_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,39 @@
+/* $NetBSD: infinityl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $ */
+
+/*
+ * IEEE-compatible infinityl.c for 64-bit or 128-bit long double format.
+ * This is public domain.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: infinityl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <math.h>
+#include <machine/endian.h>
+#include <machine/ieee.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+#define LDBL_EXPBITS EXT_EXPBITS
+#define LDBL_EXP_INFNAN EXT_EXP_INFNAN
+#else
+#define LDBL_EXPBITS DBL_EXPBITS
+#define LDBL_EXP_INFNAN DBL_EXP_INFNAN
+#endif
+
+#define EXP_INFNAN (LDBL_EXP_INFNAN << (31 - LDBL_EXPBITS))
+
+const union __long_double_u __infinityl = { {
+#if BYTE_ORDER == BIG_ENDIAN
+ [0] = (EXP_INFNAN >> 24) & 0x7f,
+ [1] = (EXP_INFNAN >> 16) & 0xff,
+ [2] = (EXP_INFNAN >> 8) & 0xff,
+ [3] = (EXP_INFNAN >> 0) & 0xff,
+#else
+ [sizeof(long double)-4] = (EXP_INFNAN >> 0) & 0xff,
+ [sizeof(long double)-3] = (EXP_INFNAN >> 8) & 0xff,
+ [sizeof(long double)-2] = (EXP_INFNAN >> 16) & 0xff,
+ [sizeof(long double)-1] = (EXP_INFNAN >> 24) & 0x7f,
+#endif
+} };
Index: src/lib/libc/gen/isfinitel_ieee754.c
diff -u /dev/null src/lib/libc/gen/isfinitel_ieee754.c:1.1
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/isfinitel_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,57 @@
+/* $NetBSD: isfinitel_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: isfinitel_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+/*
+ * 7.12.3.2 isfinite - determine whether an argument has finite value
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isfinitel(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ if (u.extu_ext.ext_exp == EXT_EXP_INFNAN)
+ return 0;
+
+ return 1;
+}
+#endif /* __HAVE_LONG_DOUBLE */
Index: src/lib/libc/gen/signbitl_ieee754.c
diff -u /dev/null src/lib/libc/gen/signbitl_ieee754.c:1.1
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/signbitl_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,56 @@
+/* $NetBSD: signbitl_ieee754.c,v 1.1 2011/01/17 23:53:03 matt Exp $ */
+
+/*-
+ * Copyright (c) 2003 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD");
+#endif
+
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+
+/*
+ * 7.12.3.6 signbit - determine whether the sign of an argument is negative
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__signbitl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return (u.extu_ext.ext_sign == 1);
+}
+
+#endif /* __HAVE_LONG_DOUBLE */
Index: src/lib/libc/gen/isinfl_ieee754.c
diff -u /dev/null src/lib/libc/gen/isinfl_ieee754.c:1.4
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/isinfl_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,66 @@
+/* $NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 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.
+ *
+ * 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.
+ *
+ * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isinfl_ieee754.c,v 1.4 2011/01/17 23:53:03 matt Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+/*
+ * 7.12.3.3 isinf - test for infinity
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isinfl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return u.extu_ext.ext_exp == EXT_EXP_INFNAN
+ && u.extu_ext.ext_frach == 0 && u.extu_ext.ext_frachm == 0
+ && u.extu_ext.ext_fraclm == 0 && u.extu_ext.ext_fracl == 0;
+}
+#endif /* __HAVE_LONG_DOUBLE */
Index: src/lib/libc/gen/isnanl_ieee754.c
diff -u /dev/null src/lib/libc/gen/isnanl_ieee754.c:1.6
--- /dev/null Mon Jan 17 23:53:04 2011
+++ src/lib/libc/gen/isnanl_ieee754.c Mon Jan 17 23:53:03 2011
@@ -0,0 +1,66 @@
+/* $NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 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.
+ *
+ * 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.
+ *
+ * from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: isnanl_ieee754.c,v 1.6 2011/01/17 23:53:03 matt Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+/*
+ * 7.12.3.4 isnan - test for a NaN
+ * IEEE 754 compatible 128-bit extended-precision version
+ */
+int
+__isnanl(long double x)
+{
+ union ieee_ext_u u;
+
+ u.extu_ld = x;
+
+ return u.extu_ext.ext_exp == EXT_EXP_INFNAN
+ && (u.extu_ext.ext_frach != 0 || u.extu_ext.ext_frachm != 0
+ || u.extu_ext.ext_fraclm != 0 || u.extu_ext.ext_fracl != 0);
+}
+#endif /* __HAVE_LONG_DOUBLE */