Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libm Try to fix the build (again): move e_sqrtl.c to com...
details: https://anonhg.NetBSD.org/src/rev/cbdb19b4ad68
branches: trunk
changeset: 791525:cbdb19b4ad68
user: martin <martin%NetBSD.org@localhost>
date: Fri Nov 22 13:37:24 2013 +0000
description:
Try to fix the build (again): move e_sqrtl.c to common soure, but
move the include of fenv.h into the #ifdef __HAVE_LONG_DOUBLE block
and also provide a -DHAVE_FENV_H from the makefile for archs that have
it - leaving out exception settings on architectures that do not provide
it.
diffstat:
lib/libm/Makefile | 12 ++++++++----
lib/libm/src/e_sqrtl.c | 15 +++++++++++++--
2 files changed, 21 insertions(+), 6 deletions(-)
diffs (118 lines):
diff -r 8872469e3f40 -r cbdb19b4ad68 lib/libm/Makefile
--- a/lib/libm/Makefile Fri Nov 22 11:13:54 2013 +0000
+++ b/lib/libm/Makefile Fri Nov 22 13:37:24 2013 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.151 2013/11/21 11:21:54 martin Exp $
+# $NetBSD: Makefile,v 1.152 2013/11/22 13:37:24 martin Exp $
#
# @(#)Makefile 5.1beta 93/09/24
#
@@ -53,6 +53,7 @@
.elif (${MACHINE_CPU} == "arm")
.PATH: ${.CURDIR}/arch/arm
COMMON_SRCS+= fenv.c
+COPTS.e_sqrtl.c += -DHAVE_FENV_H
.if (${MKSOFTFLOAT} == "no")
ARCH_SRCS = e_sqrt.S e_sqrtf.S lrint.S lrintf.S s_fabsf.S s_fma.S s_fmaf.S
.else
@@ -63,11 +64,13 @@
.elif (${MACHINE_ARCH} == "sparc")
.PATH: ${.CURDIR}/arch/sparc
COMMON_SRCS+= fenv.c
+COPTS.e_sqrtl.c += -DHAVE_FENV_H
COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
.elif (${MACHINE_ARCH} == "sparc64")
.PATH: ${.CURDIR}/arch/sparc64
COMMON_SRCS+= fenv.c s_nexttowardf.c \
- s_nearbyint.c s_rintl.c e_sqrtl.c
+ s_nearbyint.c s_rintl.c
+COPTS.e_sqrtl.c += -DHAVE_FENV_H
.ifndef _COMPAT_M32_MK_
COMMON_SRCS+= s_nexttoward.c
.endif
@@ -80,8 +83,9 @@
.PATH: ${.CURDIR}/arch/i387
COMMON_SRCS+= fenv.c s_nexttoward.c s_nexttowardf.c \
- s_nearbyint.c s_rintl.c e_sqrtl.c
+ s_nearbyint.c s_rintl.c
COMMON_SRCS+= s_fma.c s_fmaf.c s_fmal.c
+COPTS.e_sqrtl.c += -DHAVE_FENV_H
ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
e_logf.S e_log10.S e_log10f.S e_log2.S e_log2f.S e_remainder.S \
@@ -156,7 +160,7 @@
e_j1.c e_j1f.c e_jn.c e_jnf.c e_lgamma_r.c e_lgammaf_r.c e_log.c \
e_log2.c e_log10.c e_log10f.c e_log2f.c e_logf.c e_pow.c e_powf.c \
e_rem_pio2.c e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c \
- e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
+ e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c e_sqrtl.c \
k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
k_standard.c k_tan.c k_tanf.c \
ldbl_dummy.c \
diff -r 8872469e3f40 -r cbdb19b4ad68 lib/libm/src/e_sqrtl.c
--- a/lib/libm/src/e_sqrtl.c Fri Nov 22 11:13:54 2013 +0000
+++ b/lib/libm/src/e_sqrtl.c Fri Nov 22 13:37:24 2013 +0000
@@ -28,10 +28,9 @@
#if 0
__FBSDID("$FreeBSD: head/lib/msun/src/e_sqrtl.c 176720 2008-03-02 01:47:58Z das $");
#endif
-__RCSID("$NetBSD: e_sqrtl.c,v 1.2 2013/11/20 21:12:30 martin Exp $");
+__RCSID("$NetBSD: e_sqrtl.c,v 1.3 2013/11/22 13:37:24 martin Exp $");
#include <machine/ieee.h>
-#include <fenv.h>
#include <float.h>
#include "math.h"
@@ -39,6 +38,10 @@
#ifdef __HAVE_LONG_DOUBLE
+#ifdef HAVE_FENV_H
+#include <fenv.h>
+#endif
+
#ifdef LDBL_IMPLICIT_NBIT
#define LDBL_NBIT 0
#endif
@@ -84,7 +87,9 @@
union ieee_ext_u ux = { .extu_ld = x, };
int k, r;
long double lo, xn;
+#ifdef HAVE_FENV_H
fenv_t env;
+#endif
/* If x = NaN, then sqrt(x) = NaN. */
/* If x = Inf, then sqrt(x) = Inf. */
@@ -100,7 +105,9 @@
if (ux.extu_sign)
return ((x - x) / (x - x));
+#ifdef HAVE_FENV_H
feholdexcept(&env);
+#endif
if (ux.extu_exp == 0) {
/* Adjust subnormal numbers. */
@@ -143,7 +150,9 @@
if (!fetestexcept(FE_INEXACT)) { /* Quotient is exact. */
if (xn == ux.extu_ld) {
+#ifdef HAVE_FENV_H
fesetenv(&env);
+#endif
return (ux.extu_ld);
}
/* Round correctly for inputs like x = y**2 - ulp. */
@@ -157,7 +166,9 @@
xn = inc(xn); /* xn = xn + ulp. */
}
ux.extu_ld = ux.extu_ld + xn; /* Chopped sum. */
+#ifdef HAVE_FENV_H
feupdateenv(&env); /* Restore env and raise inexact */
+#endif
ux.extu_exp--;
return (ux.extu_ld);
}
Home |
Main Index |
Thread Index |
Old Index