mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-29 00:01:12 +00:00
5de606387b
Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch makes alpha libm function implementations use libm_alias_double to define function aliases. This also simplifies the code because the compatibility for long double = double is handled by libm_alias_double instead of locally in each source file. Tested with build-many-glibcs.py for alpha-linux-gnu that installed stripped shared libraries are unchanged by the patch. * sysdeps/alpha/fpu/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/alpha/fpu/s_copysign.c: Include <libm-alias-double.h>. (copysign): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fabs.c: Include <libm-alias-double.h>. (fabs): Define using libm_alias_double. * sysdeps/alpha/fpu/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fmax.S: Include <libm-alias-double.h>. (fmax): Define using libm_alias_double. * sysdeps/alpha/fpu/s_fmin.S: Include <libm-alias-double.h>. (fmin): Define using libm_alias_double. * sysdeps/alpha/fpu/s_lrint.c: Include <libm-alias-double.h>. (lrint): Define using libm_alias_double. (llrint): Likewise. * sysdeps/alpha/fpu/s_lround.c: Include <libm-alias-double.h>. (lround): Define using libm_alias_double. (llround): Likewise. * sysdeps/alpha/fpu/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/alpha/fpu/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double.
46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
/* Copyright (C) 2007-2017 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Richard Henderson.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library. If not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <math.h>
|
|
#include <math_ldbl_opt.h>
|
|
#include <libm-alias-double.h>
|
|
|
|
|
|
/* Use the chopped rounding mode conversion instructions to implement trunc. */
|
|
|
|
double
|
|
__trunc (double x)
|
|
{
|
|
double two52 = copysign (0x1.0p52, x);
|
|
double r, tmp;
|
|
|
|
if (isgreaterequal (fabs (x), 0x1.0p52))
|
|
return x;
|
|
|
|
__asm (
|
|
"addt/suc %2, %3, %1\n\tsubt/suc %1, %3, %0"
|
|
: "=&f"(r), "=&f"(tmp)
|
|
: "f"(x), "f"(two52));
|
|
|
|
/* trunc(-0) == -0, and in general we'll always have the same
|
|
sign as our input. */
|
|
return copysign (r, x);
|
|
}
|
|
|
|
libm_alias_double (__trunc, trunc)
|