public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-6504] libgfortran: Avoid using libquadmath APIs on powerpc64le on glibc 2.32+
Date: Tue, 11 Jan 2022 22:51:46 +0000 (GMT)	[thread overview]
Message-ID: <20220111225146.0946C393A411@sourceware.org> (raw)

https://gcc.gnu.org/g:4d0e778fe3d064e3896b7f5f7de78a479f27dc55

commit r12-6504-g4d0e778fe3d064e3896b7f5f7de78a479f27dc55
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 7 18:42:46 2022 +0100

    libgfortran: Avoid using libquadmath APIs on powerpc64le on glibc 2.32+
    
    On a glibc 2.32+ build, we still use some libquadmath APIs
    when we shouldn't:
    readelf -Wr /home/jakub/gcc/obj/powerpc64le-unknown-linux-gnu/libgfortran/.libs/libgfortran.so.5 | grep QUADMATH
    00000000002502c8  0000002600000015 R_PPC64_JMP_SLOT       0000000000000000 fmaq@QUADMATH_1.0 + 0
    00000000002505f8  0000006700000015 R_PPC64_JMP_SLOT       0000000000000000 tanq@QUADMATH_1.0 + 0
    0000000000250930  0000009b00000015 R_PPC64_JMP_SLOT       0000000000000000 fabsq@QUADMATH_1.0 + 0
    0000000000250940  0000009d00000015 R_PPC64_JMP_SLOT       0000000000000000 sinq@QUADMATH_1.0 + 0
    0000000000250c98  000000cf00000015 R_PPC64_JMP_SLOT       0000000000000000 copysignq@QUADMATH_1.0 + 0
    0000000000251038  0000010700000015 R_PPC64_JMP_SLOT       0000000000000000 cosq@QUADMATH_1.0 + 0
    0000000000251068  0000010a00000015 R_PPC64_JMP_SLOT       0000000000000000 fmodq@QUADMATH_1.0 + 0
    These should use __fmaieee128, __tanieee128 etc. instead.
    
    2022-01-07  Jakub Jelinek  <jakub@redhat.com>
    
            * libgfortran.h (__copysignieee128, __fmaieee128, __fmodieee128):
            Declare.
            * intrinsics/trigd.c (COPYSIGN, FMOD, FABS, FMA, SIN, COS, TAN): If
            POWER_IEEE128 is defined, define these for kind 17 include.
            * intrinsics/trigd_lib.inc (COPYSIGN, FMOD, FABS, FMA, SIN, COS, TAN):
            Don't define if COPYSIGN is already defined.

Diff:
---
 libgfortran/intrinsics/trigd.c       | 10 ++++++++++
 libgfortran/intrinsics/trigd_lib.inc |  2 ++
 libgfortran/libgfortran.h            |  6 ++++++
 3 files changed, 18 insertions(+)

diff --git a/libgfortran/intrinsics/trigd.c b/libgfortran/intrinsics/trigd.c
index 2fed8b25e44..5268916a91b 100644
--- a/libgfortran/intrinsics/trigd.c
+++ b/libgfortran/intrinsics/trigd.c
@@ -313,6 +313,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define HAVE_INFINITY_KIND
 #endif
 
+#ifdef POWER_IEEE128
+#define COPYSIGN __copysignieee128
+#define FMOD __fmodieee128
+#define FABS __fabsieee128
+#define FMA __fmaieee128
+#define SIN __sinieee128
+#define COS __cosieee128
+#define TAN __tanieee128
+#endif
+
 #include "trigd_lib.inc"
 
 #undef KIND
diff --git a/libgfortran/intrinsics/trigd_lib.inc b/libgfortran/intrinsics/trigd_lib.inc
index 000e187e49a..aea85ec84fd 100644
--- a/libgfortran/intrinsics/trigd_lib.inc
+++ b/libgfortran/intrinsics/trigd_lib.inc
@@ -65,6 +65,7 @@ PIO180L               -- lower bits of pi/180 for FMA
 #define CONCAT(x,y) x ## y
 #define CONCAT_EXPAND(x,y) CONCAT(x,y)
 
+#ifndef COPYSIGN
 #define COPYSIGN LITERAL(copysign)
 #define FMOD LITERAL(fmod)
 #define FABS LITERAL(fabs)
@@ -72,6 +73,7 @@ PIO180L               -- lower bits of pi/180 for FMA
 #define SIN LITERAL(sin)
 #define COS LITERAL(cos)
 #define TAN LITERAL(tan)
+#endif
 
 #ifdef TINY
 #define TINY_LITERAL LITERAL(TINY)
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index dc7a5f13921..2aec78fc401 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -1968,6 +1968,8 @@ extern __float128 __atanhieee128 (__float128)
   __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __atanieee128 (__float128)
   __attribute__ ((__nothrow__, __leaf__));
+extern __float128 __copysignieee128 (__float128, __float128)
+  __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __coshieee128 (__float128)
   __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __cosieee128 (__float128)
@@ -1980,6 +1982,10 @@ extern __float128 __expieee128 (__float128)
   __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __fabsieee128 (__float128)
   __attribute__ ((__nothrow__, __leaf__));
+extern __float128 __fmaieee128 (__float128, __float128, __float128)
+  __attribute__ ((__nothrow__, __leaf__));
+extern __float128 __fmodieee128 (__float128, __float128)
+  __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __jnieee128 (int, __float128)
   __attribute__ ((__nothrow__, __leaf__));
 extern __float128 __log10ieee128 (__float128)


                 reply	other threads:[~2022-01-11 22:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220111225146.0946C393A411@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).