Build just the compatibility versions of frexp()/ldexp()/modf(), the

real implementation is in libm.
This commit is contained in:
drochner 2006-06-27 18:19:57 +00:00
parent 89e2703366
commit 4502979a72
4 changed files with 8 additions and 148 deletions

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile.inc,v 1.24 2005/10/06 08:37:56 dogcow Exp $
# $NetBSD: Makefile.inc,v 1.25 2006/06/27 18:19:57 drochner Exp $
# objects built from assembler sources (need lint stubs)
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S modf.S \
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S fabs.S \
flt_rounds.S fpgetmask.S fpgetround.S fpgetsticky.S \
fpsetmask.S fpsetround.S fpsetsticky.S
@ -10,12 +10,11 @@ SRCS+= setjmp.S _setjmp.S sigsetjmp.S
SRCS+= resumecontext.S swapcontext.S
# objects built from C sources
SRCS+= bswap64.c ldexp.c _lwp.c makecontext.c
SRCS+= bswap64.c _lwp.c makecontext.c
# Common ieee754 constants and functions
SRCS+= infinityf_ieee754.c infinity_ieee754.c
SRCS+= fpclassifyf_ieee754.c fpclassifyd_ieee754.c
SRCS+= frexp_ieee754.c
SRCS+= isinff_ieee754.c isinfd_ieee754.c
SRCS+= isnanf_ieee754.c isnand_ieee754.c
SRCS+= isfinitef_ieee754.c isfinited_ieee754.c
@ -29,7 +28,7 @@ SRCS+= divsi3.S fixdfsi.S fixunsdfsi.S udivsi3.S
SRCS.i386.gen=\
Lint__setjmp.c Lint_alloca.c Lint_bswap16.c Lint_bswap32.c \
Lint_fabs.c Lint_modf.c \
Lint_fabs.c \
Lint___setjmp14.c Lint___sigsetjmp14.c Lint_flt_rounds.c \
Lint_fpgetmask.c Lint_fpgetround.c Lint_fpgetsticky.c \
Lint_fpsetmask.c Lint_fpsetround.c Lint_fpsetsticky.c \

View File

@ -1,68 +0,0 @@
/* $NetBSD: ldexp.c,v 1.7 2001/11/04 13:57:29 lukem Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum.
*
* 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 NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 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: ldexp.c,v 1.7 2001/11/04 13:57:29 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/ieee.h>
#include <math.h>
/*
* ldexp(value, exp): return value * (2 ** exp).
*/
double
ldexp(value, expon)
double value;
int expon;
{
double temp;
#if __GNUC__ >= 2
__asm ("fscale"
: "=t" (temp)
: "0" (value), "u" ((double)expon));
#else
__asm ("fscale; fstp %%st(1)"
: "=f" (temp)
: "f" (value), "0" ((double)expon));
#endif
return (temp);
}

View File

@ -1,74 +0,0 @@
/* $NetBSD: modf.S,v 1.6 2003/08/07 16:42:07 agc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Sean Eric Fagan.
*
* 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. 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: @(#)modf.s 5.5 (Berkeley) 3/18/91
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
RCSID("$NetBSD: modf.S,v 1.6 2003/08/07 16:42:07 agc Exp $")
#endif
/*
* modf(value, iptr): return fractional part of value, and stores the
* integral part into iptr (a pointer to double).
*
* Written by Sean Eric Fagan (sef@kithrup.COM)
* Sun Mar 11 20:27:30 PST 1990
*/
/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */
ENTRY(modf)
pushl %ebp
movl %esp,%ebp
subl $16,%esp
fnstcw -12(%ebp)
movw -12(%ebp),%dx
orw $3072,%dx
movw %dx,-16(%ebp)
fldcw -16(%ebp)
fldl 8(%ebp)
frndint
fstpl -8(%ebp)
fldcw -12(%ebp)
movl 16(%ebp),%eax
movl -8(%ebp),%edx
movl -4(%ebp),%ecx
movl %edx,(%eax)
movl %ecx,4(%eax)
fldl 8(%ebp)
fsubl -8(%ebp)
jmp L1
L1:
leave
ret

View File

@ -1,4 +1,7 @@
# $NetBSD: Makefile.inc,v 1.2 2005/10/05 20:16:43 christos Exp $
# $NetBSD: Makefile.inc,v 1.3 2006/06/27 18:19:57 drochner Exp $
# objects built from assembler sources (need lint stubs)
SRCS+= compat_setjmp.S compat_sigsetjmp.S
# objects built from C sources in compat/gen
SRCS+= compat_frexp_ieee754.c compat_ldexp_ieee754.c compat_modf_ieee754.c