Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen Unify signbitl implementations.



details:   https://anonhg.NetBSD.org/src/rev/edd3abb4342a
branches:  trunk
changeset: 998670:edd3abb4342a
user:      maya <maya%NetBSD.org@localhost>
date:      Fri Apr 26 09:03:46 2019 +0000

description:
Unify signbitl implementations.
(Unclear why they were different, it was only the comments that
differed)

Add a comment describing why the generic version works for both 80-bit
and 128-bit double.

diffstat:

 lib/libc/arch/i386/gen/Makefile.inc    |   6 +-
 lib/libc/arch/i386/gen/signbitl.c      |  52 ----------------------------------
 lib/libc/arch/m68k/gen/Makefile.inc    |   5 +-
 lib/libc/arch/m68k/gen/signbitl.c      |  52 ----------------------------------
 lib/libc/arch/sparc64/gen/Makefile.inc |   6 +-
 lib/libc/arch/sparc64/gen/signbitl.c   |  52 ----------------------------------
 lib/libc/arch/x86_64/gen/Makefile.inc  |   6 +-
 lib/libc/arch/x86_64/gen/signbitl.c    |  52 ----------------------------------
 lib/libc/gen/signbitl_ieee754.c        |   7 +++-
 9 files changed, 17 insertions(+), 221 deletions(-)

diffs (truncated from 330 to 300 lines):

diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/i386/gen/Makefile.inc
--- a/lib/libc/arch/i386/gen/Makefile.inc       Fri Apr 26 08:52:16 2019 +0000
+++ b/lib/libc/arch/i386/gen/Makefile.inc       Fri Apr 26 09:03:46 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.29 2015/07/15 14:27:49 pooka Exp $
+#      $NetBSD: Makefile.inc,v 1.30 2019/04/26 09:03:46 maya Exp $
 
 # objects built from assembler sources (need lint stubs)
 SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S \
@@ -21,10 +21,10 @@
 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+= signbitf_ieee754.c signbitd_ieee754.c signbitl_ieee754.c
 
 SRCS+= nanf.c infinityl.c
-SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c signbitl.c
+SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c
 
 # "internal" objects (don't provide part of the user-visible API)
 SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/i386/gen/signbitl.c
--- a/lib/libc/arch/i386/gen/signbitl.c Fri Apr 26 08:52:16 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*     $NetBSD: signbitl.c,v 1.2 2008/04/28 20:22:56 martin 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: signbitl.c,v 1.2 2008/04/28 20:22:56 martin Exp $");
-#endif
-
-#include <machine/ieee.h>
-#include <math.h>
-
-/*
- * 7.12.3.6 signbit - determine whether the sign of an argument is negative
- *          IEEE 754 compatible 80-bit extended-precision Intel 386 version
- */
-int
-__signbitl(long double x)
-{
-       union ieee_ext_u u;
-
-       u.extu_ld = x;
-
-       return (u.extu_ext.ext_sign == 1);
-}
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/m68k/gen/Makefile.inc
--- a/lib/libc/arch/m68k/gen/Makefile.inc       Fri Apr 26 08:52:16 2019 +0000
+++ b/lib/libc/arch/m68k/gen/Makefile.inc       Fri Apr 26 09:03:46 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.35 2017/03/22 23:11:07 chs Exp $
+#      $NetBSD: Makefile.inc,v 1.36 2019/04/26 09:03:46 maya Exp $
 
 SRCS+= alloca.S fabs.S
 
@@ -18,7 +18,8 @@
 SRCS+= infinityl_dbl_ieee754.c
 .else
 SRCS+= infinityl.c
-SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c signbitl.c
+SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c 
+SRCS+= signbitl_ieee754.c
 .endif
 
 SRCS+= ashlsi3.S ashrsi3.S \
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/m68k/gen/signbitl.c
--- a/lib/libc/arch/m68k/gen/signbitl.c Fri Apr 26 08:52:16 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*     $NetBSD: signbitl.c,v 1.2 2008/04/28 20:22:56 martin 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: signbitl.c,v 1.2 2008/04/28 20:22:56 martin Exp $");
-#endif
-
-#include <machine/ieee.h>
-#include <math.h>
-
-/*
- * 7.12.3.6 signbit - determine whether the sign of an argument is negative
- *          IEEE 754 compatible 80-bit extended-precision Motorola 68k version
- */
-int
-__signbitl(long double x)
-{
-       union ieee_ext_u u;
-
-       u.extu_ld = x;
-
-       return (u.extu_ext.ext_sign == 1);
-}
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/sparc64/gen/Makefile.inc
--- a/lib/libc/arch/sparc64/gen/Makefile.inc    Fri Apr 26 08:52:16 2019 +0000
+++ b/lib/libc/arch/sparc64/gen/Makefile.inc    Fri Apr 26 09:03:46 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.19 2009/12/06 07:12:17 uebayasi Exp $
+#      $NetBSD: Makefile.inc,v 1.20 2019/04/26 09:03:46 maya Exp $
 
 SRCS+= fabs.S modf.S
 SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
@@ -10,10 +10,10 @@
 SRCS+= isfinitef_ieee754.c isfinited_ieee754.c
 SRCS+= isinff_ieee754.c isinfd_ieee754.c
 SRCS+= isnanf_ieee754.c isnand_ieee754.c
-SRCS+= signbitf_ieee754.c signbitd_ieee754.c
+SRCS+= signbitf_ieee754.c signbitd_ieee754.c signbitl_ieee754.c
 
 SRCS+= nanf.c infinityl.c
-SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c signbitl.c
+SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c
 
 SRCS+= bswap16.c bswap32.c bswap64.c
 SRCS+= setjmp.S
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/sparc64/gen/signbitl.c
--- a/lib/libc/arch/sparc64/gen/signbitl.c      Fri Apr 26 08:52:16 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*     $NetBSD: signbitl.c,v 1.2 2008/04/28 20:22:57 martin 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>
-
-/*
- * 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);
-}
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/x86_64/gen/Makefile.inc
--- a/lib/libc/arch/x86_64/gen/Makefile.inc     Fri Apr 26 08:52:16 2019 +0000
+++ b/lib/libc/arch/x86_64/gen/Makefile.inc     Fri Apr 26 09:03:46 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.18 2015/07/15 14:27:49 pooka Exp $
+#      $NetBSD: Makefile.inc,v 1.19 2019/04/26 09:03:46 maya Exp $
 
 # objects built from assembler sources (need lint stubs)
 SRCS+= alloca.S byte_swap_2.S byte_swap_4.S byte_swap_8.S fabs.S \
@@ -21,10 +21,10 @@
 SRCS+= isfinitef_ieee754.c isfinited_ieee754.c
 SRCS+= isinff_ieee754.c isinfd_ieee754.c
 SRCS+= isnanf_ieee754.c isnand_ieee754.c
-SRCS+= signbitf_ieee754.c signbitd_ieee754.c
+SRCS+= signbitf_ieee754.c signbitd_ieee754.c signbitl_ieee754.c
 
 SRCS+= nanf.c infinityl.c
-SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c signbitl.c
+SRCS+= fpclassifyl.c isfinitel.c isinfl.c isnanl.c
 
 LSRCS.x86_64.gen=\
        Lint__setjmp.c Lint_alloca.c Lint_bswap16.c Lint_bswap32.c \
diff -r 87dda3aa9266 -r edd3abb4342a lib/libc/arch/x86_64/gen/signbitl.c
--- a/lib/libc/arch/x86_64/gen/signbitl.c       Fri Apr 26 08:52:16 2019 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*     $NetBSD: signbitl.c,v 1.2 2008/04/28 20:22:58 martin 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: signbitl.c,v 1.2 2008/04/28 20:22:58 martin Exp $");
-#endif
-
-#include <machine/ieee.h>
-#include <math.h>
-
-/*
- * 7.12.3.6 signbit - determine whether the sign of an argument is negative
- *          IEEE 754 compatible 80-bit extended-precision Intel 386 version
- */



Home | Main Index | Thread Index | Old Index