split fabs.c into hardfloat .S and softfloat .c as requested by joerg

This commit is contained in:
macallan 2014-01-28 13:47:04 +00:00
parent b0bca94549
commit 8a85f2a73f
4 changed files with 28 additions and 17 deletions

View File

@ -1,8 +1,8 @@
# $NetBSD: Makefile.inc,v 1.25 2011/03/12 07:55:09 matt Exp $
# $NetBSD: Makefile.inc,v 1.26 2014/01/28 13:47:04 macallan Exp $
SRCS+= __setjmp14.S __sigsetjmp14.S _setjmp.S
SRCS+= bswap16.c bswap32.c bswap64.c
SRCS+= fabs.c flt_rounds.c
SRCS+= flt_rounds.c
SRCS+= syncicache.c
SRCS+= _lwp.c makecontext.c resumecontext.c swapcontext.S
@ -19,6 +19,9 @@ SRCS+= nanf.c
.if (${MKSOFTFLOAT} == "no")
SRCS+= fpgetround.c fpsetround.c fpgetmask.c fpsetmask.c
SRCS+= fpgetsticky.c fpsetsticky.c
SRCS+= fabs_ieee754.S
.else
SRCS+= fabs_ieee754.c
.endif
CPPFLAGS._lwp.c += -D_LIBC_SOURCE

View File

@ -1,15 +0,0 @@
/* $NetBSD: fabs.c,v 1.4 2005/12/24 23:10:08 perry Exp $ */
#include <math.h>
double
fabs(double x)
{
#ifdef _SOFT_FLOAT
if (x < 0)
x = -x;
#else
__asm volatile("fabs %0,%1" : "=f"(x) : "f"(x));
#endif
return (x);
}

View File

@ -0,0 +1,12 @@
/* $NetBSD: fabs_ieee754.S,v 1.1 2014/01/28 13:47:04 macallan Exp $ */
#include <machine/asm.h>
#if defined(LIBC_SCCS)
__RCSID("$NetBSD: fabs_ieee754.S,v 1.1 2014/01/28 13:47:04 macallan Exp $")
#endif
ENTRY(fabs)
fabs %f1,%f1
blr
END(fabs)

View File

@ -0,0 +1,11 @@
/* $NetBSD: fabs_ieee754.c,v 1.1 2014/01/28 13:47:04 macallan Exp $ */
#include <math.h>
double
fabs(double x)
{
if (x < 0)
x = -x;
return (x);
}