diff mbox series

powerpc: Add log IFUNC multiarch support for POWER10

Message ID 20210330201924.27874-1-rzinsly@linux.ibm.com
State Superseded
Headers show
Series powerpc: Add log IFUNC multiarch support for POWER10 | expand

Commit Message

Raphael M Zinsly March 30, 2021, 8:19 p.m. UTC
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

Florian Weimer March 30, 2021, 9:18 p.m. UTC | #1
* 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.
Raphael M Zinsly April 8, 2021, 6:14 p.m. UTC | #2
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,
diff mbox series

Patch

diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
index 767805b510..20510c8a2d 100644
--- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
@@ -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
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-power10.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-power10.c
new file mode 100644
index 0000000000..4226e07643
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-power10.c
@@ -0,0 +1,4 @@ 
+#include <math.h>
+
+#define __log __log_power10
+#include <sysdeps/ieee754/dbl-64/e_log.c>
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-ppc64.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-ppc64.c
new file mode 100644
index 0000000000..cb902d727a
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log-ppc64.c
@@ -0,0 +1,4 @@ 
+#include <math.h>
+#define __log __log_ppc64
+
+#include <sysdeps/ieee754/dbl-64/e_log.c>
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log.c
new file mode 100644
index 0000000000..76112a0621
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/e_log.c
@@ -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)
diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_log.c b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_log.c
new file mode 100644
index 0000000000..9b2b018711
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/w_log.c
@@ -0,0 +1 @@ 
+#include <sysdeps/../math/w_log.c>
diff --git a/sysdeps/powerpc/powerpc64/le/power10/Makeconfig b/sysdeps/powerpc/powerpc64/le/power10/Makeconfig
new file mode 100644
index 0000000000..a85cab248f
--- /dev/null
+++ b/sysdeps/powerpc/powerpc64/le/power10/Makeconfig
@@ -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