diff options
| author | Wilco Dijkstra <wdijkstr@arm.com> | 2021-01-07 15:26:26 +0000 |
|---|---|---|
| committer | Wilco Dijkstra <wdijkstr@arm.com> | 2021-01-07 15:26:26 +0000 |
| commit | 9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271 (patch) | |
| tree | a9a2828381bf838da12fa738da4f1bda4bee161c /sysdeps | |
| parent | caa884dda78ff226243f8cb344915152052a5118 (diff) | |
| download | glibc-9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271.tar.xz glibc-9e97f239eae1f2b1d2e694d844c0f6fd7c4dd271.zip | |
Remove dbl-64/wordsize-64 (part 2)
Remove the wordsize-64 implementations by merging them into the main dbl-64
directory. The second patch just moves all wordsize-64 files and removes a
few wordsize-64 uses in comments and Implies files.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps')
40 files changed, 422 insertions, 1843 deletions
diff --git a/sysdeps/aarch64/Implies b/sysdeps/aarch64/Implies index a1d5e2e742..30800d54c3 100644 --- a/sysdeps/aarch64/Implies +++ b/sysdeps/aarch64/Implies @@ -1,5 +1,4 @@ wordsize-64 ieee754/ldbl-128 -ieee754/dbl-64/wordsize-64 ieee754/dbl-64 ieee754/flt-32 diff --git a/sysdeps/alpha/Implies b/sysdeps/alpha/Implies index 18fc4f339d..b15c7616d6 100644 --- a/sysdeps/alpha/Implies +++ b/sysdeps/alpha/Implies @@ -1,6 +1,5 @@ wordsize-64 # Alpha uses IEEE 754 single, double and quad precision floating point. ieee754/ldbl-128 -ieee754/dbl-64/wordsize-64 ieee754/dbl-64 ieee754/flt-32 diff --git a/sysdeps/ieee754/dbl-64/e_acosh.c b/sysdeps/ieee754/dbl-64/e_acosh.c index 75df0ab5ef..a241366f30 100644 --- a/sysdeps/ieee754/dbl-64/e_acosh.c +++ b/sysdeps/ieee754/dbl-64/e_acosh.c @@ -1,4 +1,4 @@ -/* @(#)e_acosh.c 5.1 93/09/24 */ +/* Optimized for 64-bit by Ulrich Drepper <drepper@gmail.com>, 2012 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -29,42 +29,40 @@ #include <libm-alias-finite.h> static const double - one = 1.0, - ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ +one = 1.0, +ln2 = 6.93147180559945286227e-01; /* 0x3FE62E42, 0xFEFA39EF */ double __ieee754_acosh (double x) { - double t; - int32_t hx; - uint32_t lx; - EXTRACT_WORDS (hx, lx, x); - if (hx < 0x3ff00000) /* x < 1 */ - { - return (x - x) / (x - x); - } - else if (hx >= 0x41b00000) /* x > 2**28 */ + int64_t hx; + EXTRACT_WORDS64 (hx, x); + + if (hx > INT64_C (0x4000000000000000)) { - if (hx >= 0x7ff00000) /* x is inf of NaN */ + if (__glibc_unlikely (hx >= INT64_C (0x41b0000000000000))) { - return x + x; + /* x > 2**28 */ + if (hx >= INT64_C (0x7ff0000000000000)) + /* x is inf of NaN */ + return x + x; + else + return __ieee754_log (x) + ln2;/* acosh(huge)=log(2x) */ } - else - return __ieee754_log (x) + ln2; /* acosh(huge)=log(2x) */ - } - else if (((hx - 0x3ff00000) | lx) == 0) - { - return 0.0; /* acosh(1) = 0 */ - } - else if (hx > 0x40000000) /* 2**28 > x > 2 */ - { - t = x * x; + + /* 2**28 > x > 2 */ + double t = x * x; return __ieee754_log (2.0 * x - one / (x + sqrt (t - one))); } - else /* 1<x<2 */ + else if (__glibc_likely (hx > INT64_C (0x3ff0000000000000))) { - t = x - one; + /* 1<x<2 */ + double t = x - one; return __log1p (t + sqrt (2.0 * t + t * t)); } + else if (__glibc_likely (hx == INT64_C (0x3ff0000000000000))) + return 0.0; /* acosh(1) = 0 */ + else /* x < 1 */ + return (x - x) / (x - x); } libm_alias_finite (__ieee754_acosh, __acosh) diff --git a/sysdeps/ieee754/dbl-64/e_cosh.c b/sysdeps/ieee754/dbl-64/e_cosh.c index 6c78a3a4e9..4f41ca2c92 100644 --- a/sysdeps/ieee754/dbl-64/e_cosh.c +++ b/sysdeps/ieee754/dbl-64/e_cosh.c @@ -32,59 +32,54 @@ */ #include <math.h> -#include <math-narrow-eval.h> #include <math_private.h> #include <libm-alias-finite.h> -static const double one = 1.0, half = 0.5, huge = 1.0e300; +static const double one = 1.0, half=0.5, huge = 1.0e300; double __ieee754_cosh (double x) { - double t, w; - int32_t ix; - uint32_t lx; + double t,w; + int32_t ix; - /* High word of |x|. */ - GET_HIGH_WORD (ix, x); - ix &= 0x7fffffff; + /* High word of |x|. */ + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; - /* |x| in [0,22] */ - if (ix < 0x40360000) - { - /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ - if (ix < 0x3fd62e43) - { - if (ix < 0x3c800000) - return one; /* cosh(tiny) = 1 */ - t = __expm1 (fabs (x)); - w = one + t; - return one + (t * t) / (w + w); - } + /* |x| in [0,22] */ + if (ix < 0x40360000) { + /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ + if(ix<0x3fd62e43) { + if (ix<0x3c800000) /* cosh(tiny) = 1 */ + return one; + t = __expm1(fabs(x)); + w = one+t; + return one+(t*t)/(w+w); + } - /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ - t = __ieee754_exp (fabs (x)); - return half * t + half / t; - } + /* |x| in [0.5*ln2,22], return (exp(|x|)+1/exp(|x|)/2; */ + t = __ieee754_exp(fabs(x)); + return half*t+half/t; + } - /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x40862e42) - return half * __ieee754_exp (fabs (x)); + /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ + if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x)); - /* |x| in [log(maxdouble), overflowthresold] */ - GET_LOW_WORD (lx, x); - if (ix < 0x408633ce || ((ix == 0x408633ce) && (lx <= (uint32_t) 0x8fb9f87d))) - { - w = __ieee754_exp (half * fabs (x)); - t = half * w; - return t * w; - } + /* |x| in [log(maxdouble), overflowthresold] */ + int64_t fix; + EXTRACT_WORDS64(fix, x); + fix &= UINT64_C(0x7fffffffffffffff); + if (fix <= UINT64_C(0x408633ce8fb9f87d)) { + w = __ieee754_exp(half*fabs(x)); + t = half*w; + return t*w; + } - /* x is INF or NaN */ - if (ix >= 0x7ff00000) - return x * x; + /* x is INF or NaN */ + if(ix>=0x7ff00000) return x*x; - /* |x| > overflowthresold, cosh(x) overflow */ - return math_narrow_eval (huge * huge); + /* |x| > overflowthresold, cosh(x) overflow */ + return huge*huge; } libm_alias_finite (__ieee754_cosh, __cosh) diff --git a/sysdeps/ieee754/dbl-64/e_fmod.c b/sysdeps/ieee754/dbl-64/e_fmod.c index f6a095ba82..52a8687448 100644 --- a/sysdeps/ieee754/dbl-64/e_fmod.c +++ b/sysdeps/ieee754/dbl-64/e_fmod.c @@ -1,3 +1,4 @@ +/* Rewritten for 64-bit machines by Ulrich Drepper <drepper@gmail.com>. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -17,158 +18,89 @@ #include <math.h> #include <math_private.h> +#include <stdint.h> #include <libm-alias-finite.h> -static const double one = 1.0, Zero[] = { 0.0, -0.0, }; +static const double one = 1.0, Zero[] = {0.0, -0.0,}; double __ieee754_fmod (double x, double y) { - int32_t n, hx, hy, hz, ix, iy, sx, i; - uint32_t lx, ly, lz; + int32_t n,ix,iy; + int64_t hx,hy,hz,sx,i; - EXTRACT_WORDS (hx, lx, x); - EXTRACT_WORDS (hy, ly, y); - sx = hx & 0x80000000; /* sign of x */ - hx ^= sx; /* |x| */ - hy &= 0x7fffffff; /* |y| */ + EXTRACT_WORDS64(hx,x); + EXTRACT_WORDS64(hy,y); + sx = hx&UINT64_C(0x8000000000000000); /* sign of x */ + hx ^=sx; /* |x| */ + hy &= UINT64_C(0x7fffffffffffffff); /* |y| */ - /* purge off exception values */ - if ((hy | ly) == 0 || (hx >= 0x7ff00000) || /* y=0,or x not finite */ - ((hy | ((ly | -ly) >> 31)) > 0x7ff00000)) /* or y is NaN */ - return (x * y) / (x * y); - if (hx <= hy) - { - if ((hx < hy) || (lx < ly)) - return x; /* |x|<|y| return x */ - if (lx == ly) - return Zero[(uint32_t) sx >> 31]; /* |x|=|y| return x*0*/ - } - - /* determine ix = ilogb(x) */ - if (__glibc_unlikely (hx < 0x00100000)) /* subnormal x */ - { - if (hx == 0) - { - for (ix = -1043, i = lx; i > 0; i <<= 1) - ix -= 1; - } - else - { - for (ix = -1022, i = (hx << 11); i > 0; i <<= 1) - ix -= 1; + /* purge off exception values */ + if(__builtin_expect(hy==0 + || hx >= UINT64_C(0x7ff0000000000000) + || hy > UINT64_C(0x7ff0000000000000), 0)) + /* y=0,or x not finite or y is NaN */ + return (x*y)/(x*y); + if(__builtin_expect(hx<=hy, 0)) { + if(hx<hy) return x; /* |x|<|y| return x */ + return Zero[(uint64_t)sx>>63]; /* |x|=|y| return x*0*/ } - } - else - ix = (hx >> 20) - 1023; - /* determine iy = ilogb(y) */ - if (__glibc_unlikely (hy < 0x00100000)) /* subnormal y */ - { - if (hy == 0) - { - for (iy = -1043, i = ly; i > 0; i <<= 1) - iy -= 1; - } - else - { - for (iy = -1022, i = (hy << 11); i > 0; i <<= 1) - iy -= 1; - } - } - else - iy = (hy >> 20) - 1023; + /* determine ix = ilogb(x) */ + if(__builtin_expect(hx<UINT64_C(0x0010000000000000), 0)) { + /* subnormal x */ + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } else ix = (hx>>52)-1023; - /* set up {hx,lx}, {hy,ly} and align y to x */ - if (__glibc_likely (ix >= -1022)) - hx = 0x00100000 | (0x000fffff & hx); - else /* subnormal x, shift x to normal */ - { - n = -1022 - ix; - if (n <= 31) - { - hx = (hx << n) | (lx >> (32 - n)); - lx <<= n; - } - else - { - hx = lx << (n - 32); - lx = 0; - } - } - if (__glibc_likely (iy >= -1022)) - hy = 0x00100000 | (0x000fffff & hy); - else /* subnormal y, shift y to normal */ - { - n = -1022 - iy; - if (n <= 31) - { - hy = (hy << n) | (ly >> (32 - n)); - ly <<= n; - } - else - { - hy = ly << (n - 32); - ly = 0; - } - } + /* determine iy = ilogb(y) */ + if(__builtin_expect(hy<UINT64_C(0x0010000000000000), 0)) { /* subnormal y */ + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } else iy = (hy>>52)-1023; - /* fix point fmod */ - n = ix - iy; - while (n--) - { - hz = hx - hy; lz = lx - ly; if (lx < ly) - hz -= 1; - if (hz < 0) - { - hx = hx + hx + (lx >> 31); lx = lx + lx; + /* set up hx, hy and align y to x */ + if(__builtin_expect(ix >= -1022, 1)) + hx = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + hx<<=n; } - else - { - if ((hz | lz) == 0) /* return sign(x)*0 */ - return Zero[(uint32_t) sx >> 31]; - hx = hz + hz + (lz >> 31); lx = lz + lz; + if(__builtin_expect(iy >= -1022, 1)) + hy = UINT64_C(0x0010000000000000)|(UINT64_C(0x000fffffffffffff)&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + hy<<=n; } - } - hz = hx - hy; lz = lx - ly; if (lx < ly) - hz -= 1; - if (hz >= 0) - { - hx = hz; lx = lz; - } - /* convert back to floating value and restore the sign */ - if ((hx | lx) == 0) /* return sign(x)*0 */ - return Zero[(uint32_t) sx >> 31]; - while (hx < 0x00100000) /* normalize x */ - { - hx = hx + hx + (lx >> 31); lx = lx + lx; - iy -= 1; - } - if (__glibc_likely (iy >= -1022)) /* normalize output */ - { - hx = ((hx - 0x00100000) | ((iy + 1023) << 20)); - INSERT_WORDS (x, hx | sx, lx); - } - else /* subnormal output */ - { - n = -1022 - iy; - if (n <= 20) - { - lx = (lx >> n) | ((uint32_t) hx << (32 - n)); - hx >>= n; + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy; + if(hz<0){hx = hx+hx;} + else { + if(hz==0) /* return sign(x)*0 */ + return Zero[(uint64_t)sx>>63]; + hx = hz+hz; + } } - else if (n <= 31) - { - lx = (hx << (32 - n)) | (lx >> n); hx = sx; + hz=hx-hy; + if(hz>=0) {hx=hz;} + + /* convert back to floating value and restore the sign */ + if(hx==0) /* return sign(x)*0 */ + return Zero[(uint64_t)sx>>63]; + while(hx<UINT64_C(0x0010000000000000)) { /* norm |
