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 r13-1344] libgfortran: Fix up LIBGFOR_CHECK_FLOAT128 [PR106137]
Date: Wed, 29 Jun 2022 15:06:37 +0000 (GMT)	[thread overview]
Message-ID: <20220629150637.04D783858D3C@sourceware.org> (raw)

https://gcc.gnu.org/g:c022c0de2a6c9110350cd50275be97d061a19530

commit r13-1344-gc022c0de2a6c9110350cd50275be97d061a19530
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 29 17:04:50 2022 +0200

    libgfortran: Fix up LIBGFOR_CHECK_FLOAT128 [PR106137]
    
    My recent gfortran + libgfortran patch apparently broke (some?) aarch64
    builds.  While it is desirable to use just _Float128 rather than __float128,
    we only want to use it (and e.g. define HAVE_FLOAT128) on targets where
    _Float128 is supported and long double isn't IEEE quad precision.
    Which is targets that support __float128 type which we have been testing
    for before - _Float128 is supported on those targets and on targets where
    long double is IEEE quad precision.
    
    So, the following patch restores check for whether __float128 is supported
    into the LIBGFOR_CHECK_FLOAT128 check which determines whether
    HAVE_FLOAT128 is defined or whether to use libquadmath, so that e.g. on
    aarch64 where long double is IEEE quad we don't do that.
    
    2022-06-29  Jakub Jelinek  <jakub@redhat.com>
    
            PR bootstrap/106137
            * acinclude.m4 (LIBGFOR_CHECK_FLOAT128): Adjust comment.
            Also test for __float128.
            (HAVE_FLOAT128): Adjust description.
            * config.h.in: Regenerated.
            * configure: Regenerated.

Diff:
---
 libgfortran/acinclude.m4 | 12 +++++++++---
 libgfortran/config.h.in  |  2 +-
 libgfortran/configure    | 16 ++++++++++++++--
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/libgfortran/acinclude.m4 b/libgfortran/acinclude.m4
index dbf687e5cc2..7585df13fd7 100644
--- a/libgfortran/acinclude.m4
+++ b/libgfortran/acinclude.m4
@@ -261,7 +261,7 @@ __mingw_snprintf (NULL, 0, "%d\n", 1);
   fi
 ])
 
-dnl Check whether we have a __float128 type
+dnl Check whether we have a __float128 and _Float128 type
 AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
   LIBQUADSPEC=
   LIBQUADLIB=
@@ -276,7 +276,6 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
    GCC_TRY_COMPILE_OR_LINK([
     _Float128 foo (_Float128 x)
     {
-
      _Complex _Float128 z1, z2;
 
      z1 = x;
@@ -290,11 +289,18 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
     {
       return x * __builtin_huge_valf128 ();
     }
+
+    __float128 baz (__float128 x)
+    {
+      return x * __builtin_huge_valf128 ();
+    }
   ],[
     foo (1.2F128);
     bar (1.2F128);
+    baz (1.2F128);
     foo (1.2Q);
     bar (1.2Q);
+    baz (1.2Q);
   ],[
     libgfor_cv_have_float128=yes
   ],[
@@ -310,7 +316,7 @@ AC_DEFUN([LIBGFOR_CHECK_FLOAT128], [
     if test "x$USE_IEC_60559" = xyes; then
       AC_DEFINE(USE_IEC_60559, 1, [Define if IEC 60559 *f128 APIs should be used for _Float128.])
     fi
-    AC_DEFINE(HAVE_FLOAT128, 1, [Define if have a usable _Float128 type.])
+    AC_DEFINE(HAVE_FLOAT128, 1, [Define if target has usable _Float128 and __float128 types.])
 
     dnl Check whether -Wl,--as-needed resp. -Wl,-zignore is supported
     dnl 
diff --git a/libgfortran/config.h.in b/libgfortran/config.h.in
index c403934661b..da2c44c1af1 100644
--- a/libgfortran/config.h.in
+++ b/libgfortran/config.h.in
@@ -468,7 +468,7 @@
 /* Define to 1 if you have the <fenv.h> header file. */
 #undef HAVE_FENV_H
 
-/* Define if have a usable _Float128 type. */
+/* Define if target has usable _Float128 and __float128 types. */
 #undef HAVE_FLOAT128
 
 /* Define to 1 if you have the <floatingpoint.h> header file. */
diff --git a/libgfortran/configure b/libgfortran/configure
index c833591d844..c440721d1fd 100755
--- a/libgfortran/configure
+++ b/libgfortran/configure
@@ -30130,7 +30130,6 @@ else
 
     _Float128 foo (_Float128 x)
     {
-
      _Complex _Float128 z1, z2;
 
      z1 = x;
@@ -30145,14 +30144,21 @@ else
       return x * __builtin_huge_valf128 ();
     }
 
+    __float128 baz (__float128 x)
+    {
+      return x * __builtin_huge_valf128 ();
+    }
+
 int
 main ()
 {
 
     foo (1.2F128);
     bar (1.2F128);
+    baz (1.2F128);
     foo (1.2Q);
     bar (1.2Q);
+    baz (1.2Q);
 
   ;
   return 0;
@@ -30177,7 +30183,6 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 
     _Float128 foo (_Float128 x)
     {
-
      _Complex _Float128 z1, z2;
 
      z1 = x;
@@ -30192,14 +30197,21 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
       return x * __builtin_huge_valf128 ();
     }
 
+    __float128 baz (__float128 x)
+    {
+      return x * __builtin_huge_valf128 ();
+    }
+
 int
 main ()
 {
 
     foo (1.2F128);
     bar (1.2F128);
+    baz (1.2F128);
     foo (1.2Q);
     bar (1.2Q);
+    baz (1.2Q);
 
   ;
   return 0;


                 reply	other threads:[~2022-06-29 15:06 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=20220629150637.04D783858D3C@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).