From be32181245945066b883fee73a288f6bca487054 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 11 Feb 2013 01:47:04 +0000 Subject: [PATCH] add more functions required by fma --- lib/libm/Makefile | 6 ++++-- lib/libm/src/s_frexpl.c | 30 +++++++++++++++++++----------- lib/libm/src/s_scalbln.c | 6 ++++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/lib/libm/Makefile b/lib/libm/Makefile index 8505516e5eef..983420771e2d 100644 --- a/lib/libm/Makefile +++ b/lib/libm/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.129 2013/02/11 01:29:58 christos Exp $ +# $NetBSD: Makefile,v 1.130 2013/02/11 01:47:04 christos Exp $ # # @(#)Makefile 5.1beta 93/09/24 # @@ -67,7 +67,9 @@ COMMON_SRCS+= fenv.c .PATH: ${.CURDIR}/arch/i387 COMMON_SRCS+= fenv.c s_nextafterl.c s_nexttoward.c s_nexttowardf.c \ - s_nearbyint.c s_rintl.c s_fma.c s_fmaf.c s_fmal.c # s_nan.c + s_nearbyint.c s_rintl.c s_fma.c s_fmaf.c s_fmal.c \ + s_scalbln.c s_frexpl.c # s_nan.c + 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 \ e_remainderf.S e_scalb.S e_scalbf.S e_sqrt.S e_sqrtf.S s_atan.S \ diff --git a/lib/libm/src/s_frexpl.c b/lib/libm/src/s_frexpl.c index 20b316706f1a..de2ae10ca158 100644 --- a/lib/libm/src/s_frexpl.c +++ b/lib/libm/src/s_frexpl.c @@ -1,3 +1,5 @@ +/* $NetBSD: s_frexpl.c,v 1.2 2013/02/11 01:47:04 christos Exp $ */ + /*- * Copyright (c) 2004-2005 David Schultz * All rights reserved. @@ -26,11 +28,16 @@ * $FreeBSD: src/lib/msun/src/s_frexpl.c,v 1.1 2005/03/07 04:54:51 das Exp $ */ +#include +__RCSID("$NetBSD: s_frexpl.c,v 1.2 2013/02/11 01:47:04 christos Exp $"); + +#include #include #include -#include "fpmath.h" +#include "math_private.h" +#ifdef EXT_EXPBITS #if LDBL_MAX_EXP != 0x4000 #error "Unsupported long double format" #endif @@ -38,25 +45,26 @@ long double frexpl(long double x, int *ex) { - union IEEEl2bits u; + union ieee_ext_u u; - u.e = x; - switch (u.bits.exp) { + u.extu_ld = x; + switch (u.extu_ext.ext_exp) { case 0: /* 0 or subnormal */ - if ((u.bits.manl | u.bits.manh) == 0) { + if ((u.extu_ext.ext_fracl | u.extu_ext.ext_frach) == 0) { *ex = 0; } else { - u.e *= 0x1.0p514; - *ex = u.bits.exp - 0x4200; - u.bits.exp = 0x3ffe; + u.extu_ld *= 0x1.0p514; + *ex = u.extu_ext.ext_exp - 0x4200; + u.extu_ext.ext_exp = 0x3ffe; } break; case 0x7fff: /* infinity or NaN; value of *ex is unspecified */ break; default: /* normal */ - *ex = u.bits.exp - 0x3ffe; - u.bits.exp = 0x3ffe; + *ex = u.extu_ext.ext_exp - 0x3ffe; + u.extu_ext.ext_exp = 0x3ffe; break; } - return (u.e); + return (u.extu_ld); } +#endif diff --git a/lib/libm/src/s_scalbln.c b/lib/libm/src/s_scalbln.c index 81846b0634cc..1aeae5340379 100644 --- a/lib/libm/src/s_scalbln.c +++ b/lib/libm/src/s_scalbln.c @@ -1,3 +1,5 @@ +/* $NetBSD: s_scalbln.c,v 1.2 2013/02/11 01:47:04 christos Exp $ */ + /*- * Copyright (c) 2004 David Schultz * All rights reserved. @@ -25,7 +27,11 @@ */ #include +#if 0 __FBSDID("$FreeBSD: src/lib/msun/src/s_scalbln.c,v 1.2 2005/03/07 04:57:50 das Exp $"); +#else +__RCSID("$NetBSD: s_scalbln.c,v 1.2 2013/02/11 01:47:04 christos Exp $"); +#endif #include #include