Only provide one copy of the math functions. If we provide a MD function,

do not also provide a __generic_XXX version as well.  This is how we
used to runtime select the generic vs i387 versions on the i386 platform.

This saves a pile of #defines in the src/math_private.h file to undo the
__generic_XXX renames in some of the *.c files.
This commit is contained in:
Peter Wemm 2003-07-23 04:53:47 +00:00
parent 461d4da338
commit 3819e84017
26 changed files with 32 additions and 80 deletions

View File

@ -60,10 +60,6 @@ ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_fmod.S e_log.S e_log10.S \
# Broken
# ARCH_SRCS+= s_log1p.S
.if defined(ARCH)
.PATH: ${.CURDIR)/${ARCH}
ARCH_PREFIX= ${ARCH}_
.endif
.PATH: ${.CURDIR}/bsdsrc
.PATH: ${.CURDIR}/man
@ -105,19 +101,15 @@ COMMON_SRCS= b_exp.c b_log.c b_tgamma.c \
# FreeBSD's C library supplies these functions:
#COMMON_SRCS+= s_fabs.c s_frexp.c s_isnan.c s_ldexp.c s_modf.c
RENAMED_ARCH_SRCS= ${ARCH_SRCS:S/^/${ARCH_PREFIX}/g}
SRCS= ${COMMON_SRCS} ${RENAMED_ARCH_SRCS}
CLEANFILES+= ${RENAMED_ARCH_SRCS}
# Generate rules to rename arch-specific sources to avoid conflicts.
# The path to the arch-specific sources is given explicitly instead of
# with `.PATH: ${.CURDIR}/${ARCH}' since otherwise bsd.lib.mk would
# use .S.o rules instead of .c.o rules for the conflicting prefixes
# (except after `make depend' it uses the correct rules!).
# Exclude the generic versions of what we provide in the MD area.
.if defined(ARCH_SRCS)
.PATH: ${.CURDIR}/${ARCH}
.for i in ${ARCH_SRCS}
${ARCH_PREFIX}${i}: ${.CURDIR}/${ARCH}/${i}
cp ${.ALLSRC} ${.TARGET}
COMMON_SRCS:= ${COMMON_SRCS:N${i:R}.c}
.endfor
.endif
SRCS= ${COMMON_SRCS} ${ARCH_SRCS}
INCS= math.h

View File

@ -58,7 +58,7 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
double
__generic___ieee754_acos(double x)
__ieee754_acos(double x)
{
double z,p,q,r,w,s,c,df;
int32_t hx,ix;

View File

@ -67,7 +67,7 @@ qS3 = -6.88283971605453293030e-01, /* 0xBFE6066C, 0x1B8D0159 */
qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */
double
__generic___ieee754_asin(double x)
__ieee754_asin(double x)
{
double t=0.0,w,p,q,c,r,s;
int32_t hx,ix;

View File

@ -53,7 +53,7 @@ pi = 3.1415926535897931160E+00, /* 0x400921FB, 0x54442D18 */
pi_lo = 1.2246467991473531772E-16; /* 0x3CA1A626, 0x33145C07 */
double
__generic___ieee754_atan2(double y, double x)
__ieee754_atan2(double y, double x)
{
double z;
int32_t k,m,hx,hy,ix,iy;

View File

@ -100,7 +100,7 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
double
__generic___ieee754_exp(double x) /* default IEEE double exp */
__ieee754_exp(double x) /* default IEEE double exp */
{
double y,hi=0.0,lo=0.0,c,t;
int32_t k=0,xsb;

View File

@ -26,7 +26,7 @@ static char rcsid[] = "$FreeBSD$";
static const double one = 1.0, Zero[] = {0.0, -0.0,};
double
__generic___ieee754_fmod(double x, double y)
__ieee754_fmod(double x, double y)
{
int32_t n,hx,hy,hz,ix,iy,sx,i;
u_int32_t lx,ly,lz;

View File

@ -83,7 +83,7 @@ Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */
static const double zero = 0.0;
double
__generic___ieee754_log(double x)
__ieee754_log(double x)
{
double hfsq,f,s,z,R,w,t1,t2,dk;
int32_t k,hx,i,j;

View File

@ -59,7 +59,7 @@ log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */
static const double zero = 0.0;
double
__generic___ieee754_log10(double x)
__ieee754_log10(double x)
{
double y,z;
int32_t i,k,hx;

View File

@ -30,7 +30,7 @@ static const double zero = 0.0;
double
__generic___ieee754_remainder(double x, double p)
__ieee754_remainder(double x, double p)
{
int32_t hx,hp;
u_int32_t sx,lx,lp;

View File

@ -25,10 +25,10 @@ static char rcsid[] = "$FreeBSD$";
#ifdef _SCALB_INT
double
__generic___ieee754_scalb(double x, int fn)
__ieee754_scalb(double x, int fn)
#else
double
__generic___ieee754_scalb(double x, double fn)
__ieee754_scalb(double x, double fn)
#endif
{
#ifdef _SCALB_INT

View File

@ -90,7 +90,7 @@ static char rcsid[] = "$FreeBSD$";
static const double one = 1.0, tiny=1.0e-300;
double
__generic___ieee754_sqrt(double x)
__ieee754_sqrt(double x)
{
double z;
int32_t sign = (int)0x80000000;

View File

@ -225,44 +225,4 @@ float __kernel_cosf(float,float);
float __kernel_tanf(float,float,int);
int __kernel_rem_pio2f(float*,float*,int,int,int,const int*);
/* alpha and i386 provide arch specific copysign() */
#if defined(__ia64__) || defined(__sparc64__) || \
defined(__powerpc__) || defined(__amd64__)
#define __generic_copysign copysign
#endif
/* alpha provides arch specific copysignf() */
#if defined(__i386__) || defined(__ia64__) || defined(__sparc64__) || \
defined(__powerpc__) || defined(__amd64__)
#define __generic_copysignf copysignf
#endif
/* i386 provides lots of arch specific functions */
#if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || \
defined(__powerpc__) || defined(__amd64__)
#define __generic___ieee754_acos __ieee754_acos
#define __generic___ieee754_asin __ieee754_asin
#define __generic___ieee754_atan2 __ieee754_atan2
#define __generic___ieee754_exp __ieee754_exp
#define __generic___ieee754_fmod __ieee754_fmod
#define __generic___ieee754_log __ieee754_log
#define __generic___ieee754_log10 __ieee754_log10
#define __generic___ieee754_remainder __ieee754_remainder
#define __generic___ieee754_scalb __ieee754_scalb
#define __generic___ieee754_sqrt __ieee754_sqrt
#define __generic_atan atan
#define __generic_ceil ceil
#define __generic_cos cos
#define __generic_finite finite
#define __generic_floor floor
#define __generic_ilogb ilogb
#define __generic_log1p log1p
#define __generic_logb logb
#define __generic_rint rint
#define __generic_scalbn scalbn
#define __generic_significand significand
#define __generic_sin sin
#define __generic_tan tan
#endif
#endif /* !_MATH_PRIVATE_H_ */

View File

@ -70,7 +70,7 @@ one = 1.0,
huge = 1.0e300;
double
__generic_atan(double x)
atan(double x)
{
double w,s1,s2,z;
int32_t ix,hx,id;

View File

@ -29,7 +29,7 @@ static char rcsid[] = "$FreeBSD$";
static const double huge = 1.0e300;
double
__generic_ceil(double x)
ceil(double x)
{
int32_t i0,i1,j0;
u_int32_t i,j;

View File

@ -24,7 +24,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_copysign(double x, double y)
copysign(double x, double y)
{
u_int32_t hx,hy;
GET_HIGH_WORD(hx,x);

View File

@ -27,7 +27,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
float
__generic_copysignf(float x, float y)
copysignf(float x, float y)
{
u_int32_t ix,iy;
GET_FLOAT_WORD(ix,x);

View File

@ -49,7 +49,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_cos(double x)
cos(double x)
{
double y[2],z=0.0;
int32_t n, ix;

View File

@ -22,7 +22,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math.h"
#include "math_private.h"
int __generic_finite(double x)
int finite(double x)
{
int32_t hx;
GET_HIGH_WORD(hx,x);

View File

@ -29,7 +29,7 @@ static char rcsid[] = "$FreeBSD$";
static const double huge = 1.0e300;
double
__generic_floor(double x)
floor(double x)
{
int32_t i0,i1,j0;
u_int32_t i,j;

View File

@ -23,7 +23,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math.h"
#include "math_private.h"
int __generic_ilogb(double x)
int ilogb(double x)
{
int32_t hx,lx,ix;

View File

@ -24,7 +24,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_logb(double x)
logb(double x)
{
int32_t lx,ix;
EXTRACT_WORDS(ix,lx,x);

View File

@ -41,7 +41,7 @@ TWO52[2]={
};
double
__generic_rint(double x)
rint(double x)
{
int32_t i0,j0,sx;
u_int32_t i,i1;

View File

@ -31,7 +31,7 @@ huge = 1.0e+300,
tiny = 1.0e-300;
double
__generic_scalbn (double x, int n)
scalbn (double x, int n)
{
int32_t k,hx,lx;
EXTRACT_WORDS(hx,lx,x);

View File

@ -24,7 +24,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_significand(double x)
significand(double x)
{
return __ieee754_scalb(x,(double) -ilogb(x));
}

View File

@ -49,7 +49,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_sin(double x)
sin(double x)
{
double y[2],z=0.0;
int32_t n, ix;

View File

@ -48,7 +48,7 @@ static char rcsid[] = "$FreeBSD$";
#include "math_private.h"
double
__generic_tan(double x)
tan(double x)
{
double y[2],z=0.0;
int32_t n, ix;