powerpc: Add log IFUNC multiarch support for POWER10
Commit Message
Checked on ppc64le built without --with-cpu, with --with-cpu=power9
and with --disable-multi-arch.
---
.../powerpc64/le/fpu/multiarch/Makefile | 7 ++++
.../le/fpu/multiarch/e_log-power10.c | 4 ++
.../powerpc64/le/fpu/multiarch/e_log-ppc64.c | 4 ++
.../powerpc64/le/fpu/multiarch/e_log.c | 37 +++++++++++++++++++
.../powerpc64/le/fpu/multiarch/w_log.c | 1 +
.../powerpc/powerpc64/le/power10/Makeconfig | 6 +++
6 files changed, 59 insertions(+)
create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-power10.c
create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-ppc64.c
create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log.c
create mode 100644 sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_log.c
create mode 100644 sysdeps/powerpc/powerpc64/le/power10/Makeconfig
Comments
* Raphael Moreira Zinsly via Libc-alpha:
> +ifeq (10.0,$(firstword $(sort $(GCC_VER) 10.0)))
> +mcpu_powe10 = yes
> +endif
Looks like a typo: “mcpu_powe10” should probably be “mcpu_power10”,
to match the reference in sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile.
On 30/03/2021 18:18, Florian Weimer wrote:
> * Raphael Moreira Zinsly via Libc-alpha:
>
>> +ifeq (10.0,$(firstword $(sort $(GCC_VER) 10.0)))
>> +mcpu_powe10 = yes
>> +endif
>
> Looks like a typo: “mcpu_powe10” should probably be “mcpu_power10”,
> to match the reference in sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile.
>
Yes, on v2 I changed the way I check for the -mcpu=power10 support and
removed this file.
Thanks,
@@ -199,4 +199,11 @@ object-suffixes-left := $(all-object-suffixes)
include $(o-iterator)
endif # do_f128_multiarch
+
+libm-sysdep_routines += e_log-power10 \
+ e_log-ppc64
+ifeq ($(mcpu_power10), yes)
+CFLAGS-e_log-power10.c += -mcpu=power10
+endif
+
endif
new file mode 100644
@@ -0,0 +1,4 @@
+#include <math.h>
+
+#define __log __log_power10
+#include <sysdeps/ieee754/dbl-64/e_log.c>
new file mode 100644
@@ -0,0 +1,4 @@
+#include <math.h>
+#define __log __log_ppc64
+
+#include <sysdeps/ieee754/dbl-64/e_log.c>
new file mode 100644
@@ -0,0 +1,37 @@
+/* Multiple versions of IEEE 754 log.
+ Copyright (C) 2021 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
+ <https://www.gnu.org/licenses/>. */
+
+#include <math.h>
+#include "init-arch.h"
+#include <libm-alias-finite.h>
+
+extern double __redirect_ieee754_log (double);
+
+extern __typeof (log) __log_ppc64 attribute_hidden;
+#if __GNUC_PREREQ (10, 0)
+extern __typeof (log) __log_power10 attribute_hidden;
+#endif
+
+libc_ifunc_redirected (__redirect_ieee754_log, __ieee754_log,
+#if __GNUC_PREREQ (10, 0)
+ (hwcap2 & PPC_FEATURE2_ARCH_3_1)
+ ? __log_power10 :
+#endif
+ __log_ppc64);
+
+libm_alias_finite (__ieee754_log, __log)
new file mode 100644
@@ -0,0 +1 @@
+#include <sysdeps/../math/w_log.c>
new file mode 100644
@@ -0,0 +1,6 @@
+# -mcpu=power10 was introduced on GCC 10
+GCC_VER := $(shell gcc --version)
+
+ifeq (10.0,$(firstword $(sort $(GCC_VER) 10.0)))
+mcpu_powe10 = yes
+endif