diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-03-08 16:55:52 +0000 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2019-06-12 11:46:26 -0300 |
commit | e41d66e41ae0626156b3eace8e15aecff3044695 (patch) | |
tree | 870f599d3daea03e6de16399c7b4a270332ee738 /sysdeps/powerpc/fpu | |
parent | 21bd039bb41a59cdbd6c93670433e3b473720653 (diff) | |
download | glibc-e41d66e41ae0626156b3eace8e15aecff3044695.tar glibc-e41d66e41ae0626156b3eace8e15aecff3044695.tar.gz glibc-e41d66e41ae0626156b3eace8e15aecff3044695.tar.bz2 glibc-e41d66e41ae0626156b3eace8e15aecff3044695.zip |
powerpc: copysign cleanup
GCC always expand copysign{f} for all possible cpus, so calling the libm
is only done if user explicitly states to disable the builtin (which is
done usually not for performance reason). So to provide ifunc variant
for copysign is just unrequired complexity, since libm will be called
on non-performance critical code.
This patch removes both powerpc32 and powerpc64 ifunc variants and
consolidates the powerpc implementation on
sysdeps/powerpc/fpu/s_copysign{f}.c using compiler builtins.
Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).
* sysdeps/powerpc/fpu/s_copysign.c: New file.
* sysdeps/powerpc/fpu/s_copysignf.c: Likewise.
* sysdeps/powerpc/powerpc32/fpu/s_copysign.S: Remove file.
* sysdeps/powerpc/powerpc32/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/Makefile
(sysdep_routines, libm-sysdep_routines): Remove s_copysign-power6 and
s_copysign-ppc32.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-power6.S:
Remove file.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign-ppc32.S:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysign.c:
Likewise.
* sysdeps/powerpc/powerpc32/power4/fpu/multiarch/s_copysignf.c:
Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc32/power6/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/Makefile (sysdeps_calls):
Remove s_copysign-power6 s_copysign-ppc64.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-power6.S:
Remove file.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign-ppc64.S:
Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysign.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/multiarch/s_copysignf.c: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/fpu/s_copysignf.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysign.S: Likewise.
* sysdeps/powerpc/powerpc64/power6/fpu/s_copysignf.S: Likewise.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'sysdeps/powerpc/fpu')
-rw-r--r-- | sysdeps/powerpc/fpu/s_copysign.c | 32 | ||||
-rw-r--r-- | sysdeps/powerpc/fpu/s_copysignf.c | 28 |
2 files changed, 60 insertions, 0 deletions
diff --git a/sysdeps/powerpc/fpu/s_copysign.c b/sysdeps/powerpc/fpu/s_copysign.c new file mode 100644 index 0000000000..364242e5d9 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_copysign.c @@ -0,0 +1,32 @@ +/* Copy sign of a number. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#define NO_MATH_REDIRECT +#include <math.h> +#include <math_ldbl_opt.h> +#include <libm-alias-double.h> + +double +__copysign (double x, double y) +{ + return __builtin_copysign (x, y); +} +libm_alias_double (__copysign, copysign) +#if LONG_DOUBLE_COMPAT (libc, GLIBC_2_0) +compat_symbol (libc, __copysign, copysignl, GLIBC_2_0); +#endif diff --git a/sysdeps/powerpc/fpu/s_copysignf.c b/sysdeps/powerpc/fpu/s_copysignf.c new file mode 100644 index 0000000000..de787aea90 --- /dev/null +++ b/sysdeps/powerpc/fpu/s_copysignf.c @@ -0,0 +1,28 @@ +/* Copy sign of a number. PowerPC version. + Copyright (C) 2019 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see <http://www.gnu.org/licenses/>. */ + +#define NO_MATH_REDIRECT +#include <math.h> +#include <libm-alias-float.h> + +float +__copysignf (float x, float y) +{ + return __builtin_copysignf (x, y); +} +libm_alias_float (__copysign, copysign) |