Module Name:    src
Committed By:   matt
Date:           Fri Apr 29 07:48:37 UTC 2011

Modified Files:
        src/gnu/dist/gcc4/gcc/config/mips [matt-nb5-mips64]: netbsd64.h
        src/lib/libc/arch/mips [matt-nb5-mips64]: Makefile.inc
        src/lib/libc/arch/mips/gdtoa [matt-nb5-mips64]: Makefile.inc gd_qnan.h
        src/lib/libc/arch/mips/gen [matt-nb5-mips64]: Makefile.inc
        src/lib/libc/arch/mips/softfloat [matt-nb5-mips64]: mips-gcc.h
            softfloat.h
        src/lib/libc/softfloat [matt-nb5-mips64]: Makefile.inc
        src/share/mk [matt-nb5-mips64]: bsd.own.mk
        src/sys/arch/mips/include [matt-nb5-mips64]: float.h ieee.h ieeefp.h
            math.h
Added Files:
        src/lib/libc/gen [matt-nb5-mips64]: fpclassifyl_ieee754.c
            infinityl_ieee754.c isfinitel_ieee754.c isinfl_ieee754.c
            isnanl_ieee754.c signbitl_ieee754.c
        src/lib/libc/softfloat [matt-nb5-mips64]: eqtf2.c getf2.c gttf2.c
            letf2.c lttf2.c negtf2.c netf2.c

Log Message:
Pull in true (128-bit) long double support for MIPS from -current.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h
cvs rdiff -u -r1.8.34.2 -r1.8.34.3 src/lib/libc/arch/mips/Makefile.inc
cvs rdiff -u -r1.1 -r1.1.34.1 src/lib/libc/arch/mips/gdtoa/Makefile.inc \
    src/lib/libc/arch/mips/gdtoa/gd_qnan.h
cvs rdiff -u -r1.28.34.2 -r1.28.34.3 src/lib/libc/arch/mips/gen/Makefile.inc
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/lib/libc/arch/mips/softfloat/mips-gcc.h \
    src/lib/libc/arch/mips/softfloat/softfloat.h
cvs rdiff -u -r0 -r1.1.4.2 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.4.2 src/lib/libc/gen/isinfl_ieee754.c
cvs rdiff -u -r0 -r1.6.4.2 src/lib/libc/gen/isnanl_ieee754.c
cvs rdiff -u -r1.4 -r1.4.40.1 src/lib/libc/softfloat/Makefile.inc
cvs rdiff -u -r0 -r1.1.4.2 src/lib/libc/softfloat/eqtf2.c \
    src/lib/libc/softfloat/getf2.c src/lib/libc/softfloat/gttf2.c \
    src/lib/libc/softfloat/letf2.c src/lib/libc/softfloat/lttf2.c \
    src/lib/libc/softfloat/negtf2.c src/lib/libc/softfloat/netf2.c
cvs rdiff -u -r1.542.2.9.4.5 -r1.542.2.9.4.6 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.13 -r1.13.126.1 src/sys/arch/mips/include/float.h
cvs rdiff -u -r1.5 -r1.5.96.1 src/sys/arch/mips/include/ieee.h
cvs rdiff -u -r1.5 -r1.5.12.1 src/sys/arch/mips/include/ieeefp.h
cvs rdiff -u -r1.4 -r1.4.140.1 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.1.2.3 src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.1.2.4
--- src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h:1.1.2.3	Sat Sep  5 03:26:20 2009
+++ src/gnu/dist/gcc4/gcc/config/mips/netbsd64.h	Fri Apr 29 07:48:33 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/Makefile.inc
diff -u src/lib/libc/arch/mips/Makefile.inc:1.8.34.2 src/lib/libc/arch/mips/Makefile.inc:1.8.34.3
--- src/lib/libc/arch/mips/Makefile.inc:1.8.34.2	Thu Aug 27 16:51:27 2009
+++ src/lib/libc/arch/mips/Makefile.inc	Fri Apr 29 07:48:33 2011
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile.inc,v 1.8.34.2 2009/08/27 16:51:27 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.8.34.3 2011/04/29 07:48:33 matt Exp $
+
+.include <bsd.own.mk>
 
 SRCS+=	__sigaction14_sigtramp.c __sigtramp2.S
 
@@ -8,4 +10,5 @@
 .if ${MKSOFTFLOAT} != "no"
 .include <softfloat/Makefile.inc>
 CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
+CPPFLAGS+= -DSOFTFLOAT
 .endif

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.1.34.1
--- 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	Fri Apr 29 07:48:33 2011
@@ -1,3 +1,9 @@
-#	$NetBSD: Makefile.inc,v 1.1 2006/03/15 17:35:18 kleink Exp $
+#	$NetBSD: Makefile.inc,v 1.1.34.1 2011/04/29 07:48:33 matt Exp $
 
 SRCS+=	strtof.c
+.if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
+.if !defined(CPUFLAGS) || empty(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.1.34.1
--- 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	Fri Apr 29 07:48:34 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.1.34.1 2011/04/29 07:48:34 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.28.34.2 src/lib/libc/arch/mips/gen/Makefile.inc:1.28.34.3
--- src/lib/libc/arch/mips/gen/Makefile.inc:1.28.34.2	Wed Jan 27 06:55:25 2010
+++ src/lib/libc/arch/mips/gen/Makefile.inc	Fri Apr 29 07:48:34 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.28.34.2 2010/01/27 06:55:25 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.28.34.3 2011/04/29 07:48:34 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
@@ -32,7 +32,9 @@
 # mips abi builtin extensions (used by GCC for lexical-closure trampoline)
 SRCS+=	cacheflush.c
 
-SRCS.mips.gen=	Lint__setjmp.c Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
-LSRCS+=		${SRCS.mips.gen}
-DPSRCS+=	${SRCS.mips.gen}
-CLEANFILES+=	${SRCS.mips.gen}
+CPPFLAGS._lwp.c	+= -D_LIBC_SOURCE
+
+LSRCS.mips.gen=	Lint__setjmp.c Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
+LSRCS+=		${LSRCS.mips.gen}
+DPSRCS+=	${LSRCS.mips.gen}
+CLEANFILES+=	${LSRCS.mips.gen}

Index: src/lib/libc/arch/mips/softfloat/mips-gcc.h
diff -u src/lib/libc/arch/mips/softfloat/mips-gcc.h:1.1.2.1 src/lib/libc/arch/mips/softfloat/mips-gcc.h:1.1.2.2
--- src/lib/libc/arch/mips/softfloat/mips-gcc.h:1.1.2.1	Thu Aug 27 16:51:27 2009
+++ src/lib/libc/arch/mips/softfloat/mips-gcc.h	Fri Apr 29 07:48:34 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: mips-gcc.h,v 1.1.2.1 2009/08/27 16:51:27 matt Exp $ */
+/* $NetBSD: mips-gcc.h,v 1.1.2.2 2011/04/29 07:48:34 matt Exp $ */
 
 /*
 -------------------------------------------------------------------------------
@@ -85,11 +85,16 @@
 
 /*
 -------------------------------------------------------------------------------
-The ARM FPA is odd in that it stores doubles high-order word first, no matter
+The MIPS FPA is odd in that it stores doubles high-order word first, no matter
 what the endianness of the CPU.  VFP is sane.
 -------------------------------------------------------------------------------
 */
 #if defined(SOFTFLOAT_FOR_GCC)
+#if defined(__MIPSEB__)
 #define FLOAT64_DEMANGLE(a)	(a)
 #define FLOAT64_MANGLE(a)	(a)
+#else
+#define FLOAT64_DEMANGLE(a)	(((a) << 32) | ((a) >> 32))
+#define FLOAT64_MANGLE(a)	FLOAT64_DEMANGLE(a)
+#endif
 #endif
Index: src/lib/libc/arch/mips/softfloat/softfloat.h
diff -u src/lib/libc/arch/mips/softfloat/softfloat.h:1.1.2.1 src/lib/libc/arch/mips/softfloat/softfloat.h:1.1.2.2
--- src/lib/libc/arch/mips/softfloat/softfloat.h:1.1.2.1	Thu Aug 27 16:51:27 2009
+++ src/lib/libc/arch/mips/softfloat/softfloat.h	Fri Apr 29 07:48:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: softfloat.h,v 1.1.2.1 2009/08/27 16:51:27 matt Exp $	*/
+/*	$NetBSD: softfloat.h,v 1.1.2.2 2011/04/29 07:48:34 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/lib/libc/softfloat/Makefile.inc
diff -u src/lib/libc/softfloat/Makefile.inc:1.4 src/lib/libc/softfloat/Makefile.inc:1.4.40.1
--- src/lib/libc/softfloat/Makefile.inc:1.4	Sun Sep 26 21:13:27 2004
+++ src/lib/libc/softfloat/Makefile.inc	Fri Apr 29 07:48:35 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.4 2004/09/26 21:13:27 jmmv Exp $
+#	$NetBSD: Makefile.inc,v 1.4.40.1 2011/04/29 07:48:35 matt Exp $
 
 SOFTFLOAT_BITS?=64
 .PATH:		${ARCHDIR}/softfloat \
@@ -7,11 +7,14 @@
 CPPFLAGS+=	-I${ARCHDIR}/softfloat -I${.CURDIR}/softfloat
 CPPFLAGS+=	-DSOFTFLOAT_FOR_GCC
 
-SRCS+=		softfloat.c
+SRCS.softfloat+=softfloat.c
 
-SRCS+=		fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c \
+SRCS.softfloat+=fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c \
 		fpgetsticky.c fpsetsticky.c
 
-SRCS+=		eqsf2.c nesf2.c gtsf2.c gesf2.c ltsf2.c lesf2.c negsf2.c \
+SRCS.softfloat+=eqsf2.c nesf2.c gtsf2.c gesf2.c ltsf2.c lesf2.c negsf2.c \
 		eqdf2.c nedf2.c gtdf2.c gedf2.c ltdf2.c ledf2.c negdf2.c \
+		eqtf2.c netf2.c gttf2.c getf2.c lttf2.c letf2.c negtf2.c \
 		nexf2.c gtxf2.c gexf2.c negxf2.c unordsf2.c unorddf2.c
+
+SRCS+=		${SRCS.softfloat}

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.542.2.9.4.5 src/share/mk/bsd.own.mk:1.542.2.9.4.6
--- src/share/mk/bsd.own.mk:1.542.2.9.4.5	Wed Apr 21 05:26:47 2010
+++ src/share/mk/bsd.own.mk	Fri Apr 29 07:48:36 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.542.2.9.4.5 2010/04/21 05:26:47 matt Exp $
+#	$NetBSD: bsd.own.mk,v 1.542.2.9.4.6 2011/04/29 07:48:36 matt Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -644,6 +644,13 @@
 .endif
 
 #
+# Default mips64 to softfloat now.
+#
+.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
+MKSOFTFLOAT?=   yes
+.endif
+
+#
 # MK* options which default to "yes".
 #
 .for var in \

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.13.126.1
--- src/sys/arch/mips/include/float.h:1.13	Mon May 12 15:22:54 2003
+++ src/sys/arch/mips/include/float.h	Fri Apr 29 07:48:36 2011
@@ -1,3 +1,35 @@
-/*	$NetBSD: float.h,v 1.13 2003/05/12 15:22:54 kleink Exp $	*/
+/*	$NetBSD: float.h,v 1.13.126.1 2011/04/29 07:48:36 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.5.96.1
--- src/sys/arch/mips/include/ieee.h:1.5	Sun Dec 11 12:18:09 2005
+++ src/sys/arch/mips/include/ieee.h	Fri Apr 29 07:48:36 2011
@@ -1,13 +1,136 @@
-/*	$NetBSD: ieee.h,v 1.5 2005/12/11 12:18:09 christos Exp $ */
+/*	$NetBSD: ieee.h,v 1.5.96.1 2011/04/29 07:48:36 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/ieeefp.h
diff -u src/sys/arch/mips/include/ieeefp.h:1.5 src/sys/arch/mips/include/ieeefp.h:1.5.12.1
--- src/sys/arch/mips/include/ieeefp.h:1.5	Tue Aug  5 16:47:42 2008
+++ src/sys/arch/mips/include/ieeefp.h	Fri Apr 29 07:48:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieeefp.h,v 1.5 2008/08/05 16:47:42 matt Exp $	*/
+/*	$NetBSD: ieeefp.h,v 1.5.12.1 2011/04/29 07:48:36 matt Exp $	*/
 
 /*
  * Written by J.T. Conklin, Apr 11, 1995
@@ -16,9 +16,9 @@
 typedef int fexcept_t;
 
 #define	FE_INEXACT	0x01	/* imprecise (loss of precision) */
-#define	FE_UNDERFLOW	0x02	/* divide-by-zero exception */
+#define	FE_UNDERFLOW	0x02	/* underflow exception */
 #define	FE_OVERFLOW	0x04	/* overflow exception */
-#define	FE_DIVBYZERO	0x08	/* underflow exception */
+#define	FE_DIVBYZERO	0x08	/* divide-by-zero exception */
 #define	FE_INVALID	0x10	/* invalid operation exception */
 
 #define	FE_ALL_EXCEPT	0x1f

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.4.140.1
--- src/sys/arch/mips/include/math.h:1.4	Tue Feb 19 13:08:14 2002
+++ src/sys/arch/mips/include/math.h	Fri Apr 29 07:48:37 2011
@@ -1,3 +1,6 @@
-/*	$NetBSD: math.h,v 1.4 2002/02/19 13:08:14 simonb Exp $	*/
+/*	$NetBSD: math.h,v 1.4.140.1 2011/04/29 07:48:37 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/fpclassifyl_ieee754.c	Fri Apr 29 07:48:34 2011
@@ -0,0 +1,68 @@
+/*	$NetBSD: fpclassifyl_ieee754.c,v 1.1.4.2 2011/04/29 07:48:34 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.4.2 2011/04/29 07:48:34 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/infinityl_ieee754.c	Fri Apr 29 07:48:34 2011
@@ -0,0 +1,39 @@
+/*	$NetBSD: infinityl_ieee754.c,v 1.1.4.2 2011/04/29 07:48:34 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.4.2 2011/04/29 07:48:34 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/isfinitel_ieee754.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,57 @@
+/*	$NetBSD: isfinitel_ieee754.c,v 1.1.4.2 2011/04/29 07:48:35 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.4.2 2011/04/29 07:48:35 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/signbitl_ieee754.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,56 @@
+/*	$NetBSD: signbitl_ieee754.c,v 1.1.4.2 2011/04/29 07:48:35 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/isinfl_ieee754.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,66 @@
+/*	$NetBSD: isinfl_ieee754.c,v 1.4.4.2 2011/04/29 07:48:35 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.4.2 2011/04/29 07:48:35 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.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/gen/isnanl_ieee754.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,66 @@
+/*	$NetBSD: isnanl_ieee754.c,v 1.6.4.2 2011/04/29 07:48:35 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.4.2 2011/04/29 07:48:35 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 */

Index: src/lib/libc/softfloat/eqtf2.c
diff -u /dev/null src/lib/libc/softfloat/eqtf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/eqtf2.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,26 @@
+/* $NetBSD: eqtf2.c,v 1.1.4.2 2011/04/29 07:48:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: eqtf2.c,v 1.1.4.2 2011/04/29 07:48:35 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#ifdef FLOAT128
+flag __eqtf2(float128, float128);
+
+flag
+__eqtf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says !(a == b) */
+	return !float128_eq(a, b);
+}
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/getf2.c
diff -u /dev/null src/lib/libc/softfloat/getf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/getf2.c	Fri Apr 29 07:48:35 2011
@@ -0,0 +1,28 @@
+/* $NetBSD: getf2.c,v 1.1.4.2 2011/04/29 07:48:35 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: getf2.c,v 1.1.4.2 2011/04/29 07:48:35 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+flag __getf2(float128, float128);
+
+flag
+__getf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says (a >= b) - 1 */
+	return float128_le(b, a) - 1;
+}
+
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/gttf2.c
diff -u /dev/null src/lib/libc/softfloat/gttf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/gttf2.c	Fri Apr 29 07:48:36 2011
@@ -0,0 +1,28 @@
+/* $NetBSD: gttf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: gttf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+flag __gttf2(float128, float128);
+
+flag
+__gttf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says a > b */
+	return float128_lt(b, a);
+}
+
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/letf2.c
diff -u /dev/null src/lib/libc/softfloat/letf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/letf2.c	Fri Apr 29 07:48:36 2011
@@ -0,0 +1,28 @@
+/* $NetBSD: letf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: letf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+flag __letf2(float128, float128);
+
+flag
+__letf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says 1 - (a <= b) */
+	return 1 - float128_le(a, b);
+}
+
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/lttf2.c
diff -u /dev/null src/lib/libc/softfloat/lttf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/lttf2.c	Fri Apr 29 07:48:36 2011
@@ -0,0 +1,28 @@
+/* $NetBSD: lttf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: lttf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+flag __lttf2(float128, float128);
+
+flag
+__lttf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says -(a < b) */
+	return -float128_lt(a, b);
+}
+
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/negtf2.c
diff -u /dev/null src/lib/libc/softfloat/negtf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/negtf2.c	Fri Apr 29 07:48:36 2011
@@ -0,0 +1,29 @@
+/* $NetBSD: negtf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: negtf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+float128 __negtf2(float128);
+
+float128
+__negtf2(float128 a)
+{
+
+	/* libgcc1.c says -a */
+	a.high ^= FLOAT64_MANGLE(0x8000000000000000ULL);
+	return a;
+}
+
+#endif /* FLOAT128 */
Index: src/lib/libc/softfloat/netf2.c
diff -u /dev/null src/lib/libc/softfloat/netf2.c:1.1.4.2
--- /dev/null	Fri Apr 29 07:48:37 2011
+++ src/lib/libc/softfloat/netf2.c	Fri Apr 29 07:48:36 2011
@@ -0,0 +1,28 @@
+/* $NetBSD: netf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $ */
+
+/*
+ * Written by Matt Thomas, 2011.  This file is in the Public Domain.
+ */
+
+#include "softfloat-for-gcc.h"
+#include "milieu.h"
+#include "softfloat.h"
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: netf2.c,v 1.1.4.2 2011/04/29 07:48:36 matt Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef FLOAT128
+
+flag __netf2(float128, float128);
+
+flag
+__netf2(float128 a, float128 b)
+{
+
+	/* libgcc1.c says a != b */
+	return !float128_eq(a, b);
+}
+
+#endif /* FLOAT128 */

Reply via email to