* [PATCH] powerpc: Add log IFUNC multiarch support for POWER10
@ 2021-03-30 20:19 Raphael Moreira Zinsly
2021-03-30 21:18 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: Raphael Moreira Zinsly @ 2021-03-30 20:19 UTC (permalink / raw)
To: libc-alpha; +Cc: murphyp, tuliom, Raphael Moreira Zinsly
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
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
--
2.29.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Add log IFUNC multiarch support for POWER10
2021-03-30 20:19 [PATCH] powerpc: Add log IFUNC multiarch support for POWER10 Raphael Moreira Zinsly
@ 2021-03-30 21:18 ` Florian Weimer
2021-04-08 18:14 ` Raphael M Zinsly
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2021-03-30 21:18 UTC (permalink / raw)
To: Raphael Moreira Zinsly via Libc-alpha
Cc: Raphael Moreira Zinsly, murphyp, tuliom
* 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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Add log IFUNC multiarch support for POWER10
2021-03-30 21:18 ` Florian Weimer
@ 2021-04-08 18:14 ` Raphael M Zinsly
0 siblings, 0 replies; 3+ messages in thread
From: Raphael M Zinsly @ 2021-04-08 18:14 UTC (permalink / raw)
To: Florian Weimer, Raphael Moreira Zinsly via Libc-alpha
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,
--
Raphael Moreira Zinsly
IBM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-08 18:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 20:19 [PATCH] powerpc: Add log IFUNC multiarch support for POWER10 Raphael Moreira Zinsly
2021-03-30 21:18 ` Florian Weimer
2021-04-08 18:14 ` Raphael M Zinsly
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).