mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
a1132b5e56
This patch makes more dbl-64 functions use libm_alias_double to define function aliases. Specifically, it makes the change for functions with dbl-64/wordsize-64 versions, changing both the dbl-64 and dbl-64/wordsize-64 versions and removing the ldbl-opt wrappers. Functions are excluded from this patch if there are complications because of versions of those functions also present in libc, or architecture-specific wrappers round these files. Tested for x86_64, and with build-many-glibcs.py. Installed stripped shared libraries are unchanged except for alpha (where increased use of dbl-64/wordsize-64 files, where previously ldbl-opt files that wrapped dbl-64 files were used, was expected to result in different, better code). * sysdeps/ieee754/dbl-64/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_llround.c: Include <libm-alias-double.h>. (llround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_lround.c: Include <libm-alias-double.h>. (lround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_nearbyint.c: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_remquo.c: Include <libm-alias-double.h>. (remquo): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_llround.c: Include <libm-alias-double.h>. (llround): Define using libm_alias_double. [_LP64] (lround): Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_lround.c: Include <libm-alias-double.h>. [!_LP64] (lround): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_nearbyint.c: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_remquo.c: Include <libm-alias-double.h>. (remquo): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/ieee754/dbl-64/wordsize-64/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/ieee754/ldbl-opt/s_ceil.c: Remove file. * sysdeps/ieee754/ldbl-opt/s_floor.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_llround.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_lround.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_nearbyint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_remquo.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_rint.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_round.c: Likewise. * sysdeps/ieee754/ldbl-opt/s_trunc.c: Likewise.
87 lines
1.7 KiB
C
87 lines
1.7 KiB
C
/* @(#)s_floor.c 5.1 93/09/24 */
|
|
/*
|
|
* ====================================================
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
*
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software is freely granted, provided that this notice
|
|
* is preserved.
|
|
* ====================================================
|
|
*/
|
|
|
|
/*
|
|
* floor(x)
|
|
* Return x rounded toward -inf to integral value
|
|
* Method:
|
|
* Bit twiddling.
|
|
*/
|
|
|
|
#include <math.h>
|
|
#include <math_private.h>
|
|
#include <libm-alias-double.h>
|
|
|
|
double
|
|
__floor (double x)
|
|
{
|
|
int32_t i0, i1, j0;
|
|
uint32_t i, j;
|
|
EXTRACT_WORDS (i0, i1, x);
|
|
j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
|
|
if (j0 < 20)
|
|
{
|
|
if (j0 < 0)
|
|
{
|
|
/* return 0*sign(x) if |x|<1 */
|
|
if (i0 >= 0)
|
|
{
|
|
i0 = i1 = 0;
|
|
}
|
|
else if (((i0 & 0x7fffffff) | i1) != 0)
|
|
{
|
|
i0 = 0xbff00000; i1 = 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
i = (0x000fffff) >> j0;
|
|
if (((i0 & i) | i1) == 0)
|
|
return x; /* x is integral */
|
|
if (i0 < 0)
|
|
i0 += (0x00100000) >> j0;
|
|
i0 &= (~i); i1 = 0;
|
|
}
|
|
}
|
|
else if (j0 > 51)
|
|
{
|
|
if (j0 == 0x400)
|
|
return x + x; /* inf or NaN */
|
|
else
|
|
return x; /* x is integral */
|
|
}
|
|
else
|
|
{
|
|
i = ((uint32_t) (0xffffffff)) >> (j0 - 20);
|
|
if ((i1 & i) == 0)
|
|
return x; /* x is integral */
|
|
if (i0 < 0)
|
|
{
|
|
if (j0 == 20)
|
|
i0 += 1;
|
|
else
|
|
{
|
|
j = i1 + (1 << (52 - j0));
|
|
if (j < i1)
|
|
i0 += 1; /* got a carry */
|
|
i1 = j;
|
|
}
|
|
}
|
|
i1 &= (~i);
|
|
}
|
|
INSERT_WORDS (x, i0, i1);
|
|
return x;
|
|
}
|
|
#ifndef __floor
|
|
libm_alias_double (__floor, floor)
|
|
#endif
|