Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/mips/gen Use C versions of isinf() and isnan()...
details: https://anonhg.NetBSD.org/src/rev/ac34ef7a6731
branches: trunk
changeset: 475926:ac34ef7a6731
user: mycroft <mycroft%NetBSD.org@localhost>
date: Sun Aug 29 23:01:40 1999 +0000
description:
Use C versions of isinf() and isnan(). The assembler code is basically
identical, but was endian-dependent.
diffstat:
lib/libc/arch/mips/gen/Makefile.inc | 4 +-
lib/libc/arch/mips/gen/isinf.S | 108 ------------------------------------
lib/libc/arch/mips/gen/isinf.c | 68 ++++++++++++++++++++++
lib/libc/arch/mips/gen/isnan.c | 68 ++++++++++++++++++++++
4 files changed, 138 insertions(+), 110 deletions(-)
diffs (268 lines):
diff -r 39263fb615b6 -r ac34ef7a6731 lib/libc/arch/mips/gen/Makefile.inc
--- a/lib/libc/arch/mips/gen/Makefile.inc Sun Aug 29 22:50:25 1999 +0000
+++ b/lib/libc/arch/mips/gen/Makefile.inc Sun Aug 29 23:01:40 1999 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile.inc,v 1.8 1999/01/18 04:32:49 castor Exp $
+# $NetBSD: Makefile.inc,v 1.9 1999/08/29 23:01:40 mycroft Exp $
-SRCS+= fabs.S frexp.c infinity.c isinf.S ldexp.S modf.S
+SRCS+= fabs.S frexp.c infinity.c isinf.c isnan.c ldexp.S modf.S
SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
fpsetround.c fpsetsticky.c
diff -r 39263fb615b6 -r ac34ef7a6731 lib/libc/arch/mips/gen/isinf.S
--- a/lib/libc/arch/mips/gen/isinf.S Sun Aug 29 22:50:25 1999 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,108 +0,0 @@
-/* $NetBSD: isinf.S,v 1.6 1998/10/13 14:43:37 kleink Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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. 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, Berkeley and its contributors.
- * 4. 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.
- */
-
-#include <mips/asm.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)isinf.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: isinf.S,v 1.6 1998/10/13 14:43:37 kleink Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef WEAK_ALIAS
-#define isnan _isnan /* XXX */
-#define isinf _isinf /* XXX */
-WEAK_ALIAS(isnan,_isnan);
-WEAK_ALIAS(isinf,_isinf);
-#endif
-
-#ifdef ABICALLS
- .abicalls
-#endif
-
-#define DEXP_INF 0x7ff
-
- .set noreorder
-
-/*
- * isnan(x)
- * double x;
- *
- * Return true if x is a NAN.
- */
-LEAF(isnan)
- mfc1 v1, $f13 # get MSW of x
- mfc1 t3, $f12 # get LSW of x
- sll t1, v1, 1 # get x exponent
- srl t1, t1, 32 - 11
- bne t1, DEXP_INF, 2f # is it a finite number?
- sll t2, v1, 32 - 20 # get x fraction
- bne t3, zero, 1f # is it a NAN?
- nop
- beq t2, zero, 2f # its infinity
- nop
-1:
- j ra
- li v0, 1 # x is a NAN
-2:
- j ra
- move v0, zero # x is NOT a NAN
-END(isnan)
-
-/*
- * isinf(x)
- * double x;
- *
- * Return true if x is infinity.
- */
-LEAF(isinf)
- mfc1 v1, $f13 # get MSW of x
- mfc1 t3, $f12 # get LSW of x
- sll t1, v1, 1 # get x exponent
- srl t1, t1, 32 - 11
- bne t1, DEXP_INF, 1f # is it a finite number?
- sll t2, v1, 32 - 20 # get x fraction
- bne t3, zero, 1f # is it a NAN?
- nop
- bne t2, zero, 1f # is it a NAN?
- nop
- j ra
- li v0, 1 # x is infinity
-1:
- j ra
- move v0, zero # x is NOT infinity
-END(isinf)
diff -r 39263fb615b6 -r ac34ef7a6731 lib/libc/arch/mips/gen/isinf.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/mips/gen/isinf.c Sun Aug 29 23:01:40 1999 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: isinf.c,v 1.1 1999/08/29 23:01:40 mycroft 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. 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, Berkeley and its contributors.
+ * 4. 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: isinf.c,v 1.1 1999/08/29 23:01:40 mycroft Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __weak_alias
+__weak_alias(isinf,_isinf);
+#endif
+
+int
+isinf(d)
+ double d;
+{
+ register struct ieee_double *p = (struct ieee_double *)(void *)&d;
+
+ return (p->dbl_exp == DBL_EXP_INFNAN &&
+ (p->dbl_frach == 0 && p->dbl_fracl == 0));
+}
diff -r 39263fb615b6 -r ac34ef7a6731 lib/libc/arch/mips/gen/isnan.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/mips/gen/isnan.c Sun Aug 29 23:01:40 1999 +0000
@@ -0,0 +1,68 @@
+/* $NetBSD: isnan.c,v 1.1 1999/08/29 23:01:40 mycroft 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. 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, Berkeley and its contributors.
+ * 4. 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: isnan.c,v 1.1 1999/08/29 23:01:40 mycroft Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <machine/ieee.h>
+#include <math.h>
+
+#ifdef __weak_alias
+__weak_alias(isnan,_isnan);
+#endif
+
+int
+isnan(d)
+ double d;
+{
+ register struct ieee_double *p = (struct ieee_double *)(void *)&d;
+
+ return (p->dbl_exp == DBL_EXP_INFNAN &&
+ (p->dbl_frach != 0 || p->dbl_fracl != 0));
+}
Home |
Main Index |
Thread Index |
Old Index