Module Name: src
Committed By: tls
Date: Sun Aug 10 06:52:02 UTC 2014
Modified Files:
src/lib/libm [tls-earlyentropy]: Makefile
src/lib/libm/compiler_rt [tls-earlyentropy]: Makefile.inc
src/lib/libm/src [tls-earlyentropy]: namespace.h s_modf.c
Added Files:
src/lib/libm/src [tls-earlyentropy]: s_modfl.c
Log Message:
Rebase.
To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.156.2.1 src/lib/libm/Makefile
cvs rdiff -u -r1.5 -r1.5.2.1 src/lib/libm/compiler_rt/Makefile.inc
cvs rdiff -u -r1.10 -r1.10.2.1 src/lib/libm/src/namespace.h
cvs rdiff -u -r1.14 -r1.14.22.1 src/lib/libm/src/s_modf.c
cvs rdiff -u -r0 -r1.1.2.2 src/lib/libm/src/s_modfl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libm/Makefile
diff -u src/lib/libm/Makefile:1.156 src/lib/libm/Makefile:1.156.2.1
--- src/lib/libm/Makefile:1.156 Tue Apr 1 19:12:37 2014
+++ src/lib/libm/Makefile Sun Aug 10 06:52:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.156 2014/04/01 19:12:37 christos Exp $
+# $NetBSD: Makefile,v 1.156.2.1 2014/08/10 06:52:02 tls Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@@ -53,6 +53,7 @@ LINTFLAGS += -g
.if (${MACHINE_ARCH} == "alpha")
.PATH: ${.CURDIR}/arch/alpha
ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
+COPTS+= -mfloat-ieee -mieee-with-inexact -mfp-trap-mode=sui -mtrap-precision=i
.elif (${MACHINE_CPU} == "arm")
.PATH: ${.CURDIR}/arch/arm
COMMON_SRCS+= fenv.c s_nexttowardf.c \
@@ -177,7 +178,7 @@ COMMON_SRCS+= b_exp.c b_log.c b_tgamma.c
s_ilogb.c s_ilogbf.c s_ilogbl.c \
s_isinff.c s_isnanf.c s_lib_version.c s_log1p.c \
s_log1pf.c s_logb.c s_logbf.c s_logbl.c \
- s_matherr.c s_modff.c s_nextafter.c s_nextafterl.c \
+ s_matherr.c s_modff.c s_modfl.c s_nextafter.c s_nextafterl.c \
s_nextafterf.c s_remquo.c s_remquof.c s_rint.c s_rintf.c \
s_round.c s_roundf.c s_roundl.c s_scalbn.c \
s_scalbnf.c s_scalbnl.c s_signgam.c s_significand.c s_significandf.c s_sin.c \
@@ -310,6 +311,8 @@ MLINKS+=j0.3 j0f.3 j0.3 j1.3 j0.3 j1f.3
MLINKS+=lgamma.3 lgammaf.3 lgamma.3 lgamma_r.3 lgamma.3 lgammaf_r.3 \
lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 gamma_r.3 \
lgamma.3 gammaf_r.3 lgamma.3 tgamma.3 lgamma.3 tgammaf.3
+MLINKS+=modf.3 modff.3 \
+ modf.3 modfl.3
MLINKS+=nextafter.3 nextafterf.3 \
nextafter.3 nextafterl.3 \
nextafter.3 nexttoward.3
Index: src/lib/libm/compiler_rt/Makefile.inc
diff -u src/lib/libm/compiler_rt/Makefile.inc:1.5 src/lib/libm/compiler_rt/Makefile.inc:1.5.2.1
--- src/lib/libm/compiler_rt/Makefile.inc:1.5 Wed Feb 26 22:37:56 2014
+++ src/lib/libm/compiler_rt/Makefile.inc Sun Aug 10 06:52:02 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.5 2014/02/26 22:37:56 joerg Exp $
+# $NetBSD: Makefile.inc,v 1.5.2.1 2014/08/10 06:52:02 tls Exp $
COMPILER_RT_SRCDIR= ${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
@@ -28,10 +28,6 @@ GENERIC_SRCS+= \
SRCS+= ${src:R}.S
. else
SRCS+= ${src}
-. if ${HAVE_GCC:U} != "4"
COPTS.${src}+= -Wno-error=missing-prototypes
-. else
-COPTS.${src}+= -Wno-missing-prototypes
-. endif
. endif
.endfor
Index: src/lib/libm/src/namespace.h
diff -u src/lib/libm/src/namespace.h:1.10 src/lib/libm/src/namespace.h:1.10.2.1
--- src/lib/libm/src/namespace.h:1.10 Tue Nov 19 19:24:34 2013
+++ src/lib/libm/src/namespace.h Sun Aug 10 06:52:02 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: namespace.h,v 1.10 2013/11/19 19:24:34 joerg Exp $ */
+/* $NetBSD: namespace.h,v 1.10.2.1 2014/08/10 06:52:02 tls Exp $ */
#define atan2 _atan2
#define atan2f _atan2f
@@ -52,6 +52,7 @@
#define floorl _floorl
#define roundl _roundl
#define fmodl _fmodl
+#define modfl _modfl
#define truncl _truncl
#define exp2l _exp2l
Index: src/lib/libm/src/s_modf.c
diff -u src/lib/libm/src/s_modf.c:1.14 src/lib/libm/src/s_modf.c:1.14.22.1
--- src/lib/libm/src/s_modf.c:1.14 Wed Jan 27 14:07:41 2010
+++ src/lib/libm/src/s_modf.c Sun Aug 10 06:52:02 2014
@@ -12,7 +12,7 @@
#include <sys/cdefs.h>
#if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_modf.c,v 1.14 2010/01/27 14:07:41 drochner Exp $");
+__RCSID("$NetBSD: s_modf.c,v 1.14.22.1 2014/08/10 06:52:02 tls Exp $");
#endif
/*
@@ -30,6 +30,11 @@ __RCSID("$NetBSD: s_modf.c,v 1.14 2010/0
static const double one = 1.0;
+#ifndef __HAVE_LONG_DOUBLE
+__strong_alias(_modfl, modf)
+__weak_alias(modfl, modf)
+#endif
+
double
modf(double x, double *iptr)
{
Added files:
Index: src/lib/libm/src/s_modfl.c
diff -u /dev/null src/lib/libm/src/s_modfl.c:1.1.2.2
--- /dev/null Sun Aug 10 06:52:02 2014
+++ src/lib/libm/src/s_modfl.c Sun Aug 10 06:52:02 2014
@@ -0,0 +1,109 @@
+/*-
+ * Copyright (c) 2007 David Schultz <[email protected]>
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * Derived from s_modf.c, which has the following Copyright:
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ *
+ * $FreeBSD: head/lib/msun/src/s_modfl.c 165855 2007-01-07 07:54:21Z das $
+ */
+#include <sys/cdefs.h>
+__RCSID("$NetBSD: s_modfl.c,v 1.1.2.2 2014/08/10 06:52:02 tls Exp $");
+
+#include "namespace.h"
+
+#include <float.h>
+#include <math.h>
+#include <stdint.h>
+#include <machine/ieee.h>
+
+#ifdef __HAVE_LONG_DOUBLE
+
+#ifdef __weak_alias
+__weak_alias(modfl, _modfl)
+#endif
+
+#if LDBL_MANL_SIZE > 32
+#define MASK ((uint64_t)-1)
+#else
+#define MASK ((uint32_t)-1)
+#endif
+/* Return the last n bits of a word, representing the fractional part. */
+#define GETFRAC(bits, n) ((bits) & ~(MASK << (n)))
+/* The number of fraction bits in manh, not counting the integer bit */
+#define HIBITS (LDBL_MANT_DIG - EXT_FRACHBITS)
+
+static const long double zero[] = { 0.0L, -0.0L };
+
+long double
+modfl(long double x, long double *iptr)
+{
+ union ieee_ext_u ux = { .extu_ld = x, };
+ int e = ux.extu_exp - LDBL_MAX_EXP + 1;
+
+ if (e < HIBITS) { /* Integer part is in manh. */
+ if (e < 0) { /* |x|<1 */
+ *iptr = zero[ux.extu_sign];
+ return (x);
+ } else {
+ if ((GETFRAC(ux.extu_frach, HIBITS - 1 - e) |
+ ux.extu_fracl) == 0) { /* X is an integer. */
+ *iptr = x;
+ return (zero[ux.extu_sign]);
+ } else {
+ /* Clear all but the top e+1 bits. */
+ ux.extu_frach >>= HIBITS - 1 - e;
+ ux.extu_frach <<= HIBITS - 1 - e;
+ ux.extu_fracl = 0;
+ *iptr = ux.extu_ld;
+ return (x - ux.extu_ld);
+ }
+ }
+ } else if (e >= LDBL_MANT_DIG - 1) { /* x has no fraction part. */
+ *iptr = x;
+ if (x != x) /* Handle NaNs. */
+ return (x);
+ return (zero[ux.extu_sign]);
+ } else { /* Fraction part is in manl. */
+ if (GETFRAC(ux.extu_fracl, LDBL_MANT_DIG - 1 - e) == 0) {
+ /* x is integral. */
+ *iptr = x;
+ return (zero[ux.extu_sign]);
+ } else {
+ /* Clear all but the top e+1 bits. */
+ ux.extu_fracl >>= LDBL_MANT_DIG - 1 - e;
+ ux.extu_fracl <<= LDBL_MANT_DIG - 1 - e;
+ *iptr = ux.extu_ld;
+ return (x - ux.extu_ld);
+ }
+ }
+}
+#endif /* __HAVE_LONG_DOUBLE */