glibc/sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c

35 lines
1.2 KiB
C
Raw Normal View History

/* Multiple versions of round.
Copyright (C) 2013-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
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/>. */
Use round functions not __round functions in glibc libm. Continuing the move to use, within libm, public names for libm functions that can be inlined as built-in functions on many architectures, this patch moves calls to __round functions to call the corresponding round names instead, with asm redirection to __round when the calls are not inlined. An additional complication arises in sysdeps/ieee754/ldbl-128ibm/e_expl.c, where a call to roundl, with the result converted to int, gets converted by the compiler to call lroundl in the case of 32-bit long, so resulting in localplt test failures. It's logically correct to let the compiler make such an optimization; an appropriate asm redirection of lroundl to __lroundl is thus added to that file (it's not needed anywhere else). Tested for x86_64, and with build-many-glibcs.py. * include/math.h [!_ISOMAC && !(__FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ > 0) && !NO_MATH_REDIRECT] (round): Redirect using MATH_REDIRECT. * sysdeps/aarch64/fpu/s_round.c: Define NO_MATH_REDIRECT before header inclusion. * sysdeps/aarch64/fpu/s_roundf.c: Likewise. * sysdeps/ieee754/dbl-64/s_round.c: Likewise. * sysdeps/ieee754/dbl-64/wordsize-64/s_round.c: Likewise. * sysdeps/ieee754/float128/s_roundf128.c: Likewise. * sysdeps/ieee754/flt-32/s_roundf.c: Likewise. * sysdeps/ieee754/ldbl-128/s_roundl.c: Likewise. * sysdeps/ieee754/ldbl-96/s_roundl.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c: Likewise. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_roundf.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Likewise. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_roundf.c: Likewise. * sysdeps/riscv/rv64/rvd/s_round.c: Likewise. * sysdeps/riscv/rvf/s_roundf.c: Likewise. * sysdeps/ieee754/ldbl-128ibm/s_roundl.c: Likewise. (round): Redirect to __round. (__roundl): Call round instead of __round. * sysdeps/powerpc/fpu/math_private.h [_ARCH_PWR5X] (__round): Remove macro. [_ARCH_PWR5X] (__roundf): Likewise. * sysdeps/ieee754/dbl-64/e_gamma_r.c (gamma_positive): Use round functions instead of __round variants. * sysdeps/ieee754/flt-32/e_gammaf_r.c (gammaf_positive): Likewise. * sysdeps/ieee754/ldbl-128/e_gammal_r.c (gammal_positive): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c (gammal_positive): Likewise. * sysdeps/ieee754/ldbl-96/e_gammal_r.c (gammal_positive): Likewise. * sysdeps/x86/fpu/powl_helper.c (__powl_helper): Likewise. * sysdeps/ieee754/ldbl-128ibm/e_expl.c (lroundl): Redirect to __lroundl. (__ieee754_expl): Call roundl instead of __roundl.
2018-09-27 14:35:23 +02:00
#define NO_MATH_REDIRECT
#include <math.h>
#include <math_ldbl_opt.h>
#include <shlib-compat.h>
#include "init-arch.h"
Ues libm_alias_double for various powerpc functions. Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch various powerpc functions use libm_alias_double to define function aliases (with consequent removal of the need for local compat symbol handling). (The present patch excludes the changes to some functions where such changes could result in differences in installed stripped shared libraries because of changes to the exact ordering or properties of symbols in individual .os files.) Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged for all its hard-float powerpc configurations. * sysdeps/powerpc/fpu/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/power5+/fpu/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double.
2017-12-02 00:09:47 +01:00
#include <libm-alias-double.h>
extern __typeof (__round) __round_ppc64 attribute_hidden;
extern __typeof (__round) __round_power5plus attribute_hidden;
libc_ifunc (__round,
(hwcap & PPC_FEATURE_POWER5_PLUS)
? __round_power5plus
: __round_ppc64);
Ues libm_alias_double for various powerpc functions. Continuing the preparation for additional _FloatN / _FloatNx function aliases, this patch various powerpc functions use libm_alias_double to define function aliases (with consequent removal of the need for local compat symbol handling). (The present patch excludes the changes to some functions where such changes could result in differences in installed stripped shared libraries because of changes to the exact ordering or properties of symbols in individual .os files.) Tested with build-many-glibcs.py that installed stripped shared libraries are unchanged for all its hard-float powerpc configurations. * sysdeps/powerpc/fpu/s_rint.c: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/power5+/fpu/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_nearbyint.S: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_rint.S: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc32/power5+/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_ceil.c: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_floor.c: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_modf.c: Include <libm-alias-double.h>. (modf): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_round.c: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/multiarch/s_trunc.c: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_nearbyint.S: Include <libm-alias-double.h>. (nearbyint): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_rint.S: Include <libm-alias-double.h>. (rint): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_ceil.S: Include <libm-alias-double.h>. (ceil): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_floor.S: Include <libm-alias-double.h>. (floor): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_round.S: Include <libm-alias-double.h>. (round): Define using libm_alias_double. * sysdeps/powerpc/powerpc64/power5+/fpu/s_trunc.S: Include <libm-alias-double.h>. (trunc): Define using libm_alias_double.
2017-12-02 00:09:47 +01:00
libm_alias_double (__round, round)