public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Joseph Myers <jsm28@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Fix ldbl-128 built-in function use
Date: Thu,  5 Jan 2023 00:03:11 +0000 (GMT)	[thread overview]
Message-ID: <20230105000311.BDB1C3858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=8f27dc1af5238adbc14000f073178ee4a2c2b3cf

commit 8f27dc1af5238adbc14000f073178ee4a2c2b3cf
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Jan 5 00:02:54 2023 +0000

    Fix ldbl-128 built-in function use
    
    Fix the following issues with built-in function use in
    sysdeps/ieee754/ldbl-128 and sysdeps/ieee754/float128:
    
    * fabsl used __builtin_fabsf128 unconditionally, breaking the build
      with GCC 6 for several architectures; it should use __builtin_fabsl
      with an appropriate redirection in float128_private.h.  (I'm not
      particularly concerned with building glibc with GCC 6; rather, I
      want to be able to run the tgmath.h tests with GCC 6, which is a
      significantly different case for tgmath.h compared to GCC 7 and
      later because of the lack of _FloatN / _FloatNx support in the
      compiler, and at present running the tests with a compiler means
      building glibc with that compiler.)
    
    * Some (conditional) uses of built-in functions had been added to
      ldbl-128 without appropriate float128_private.h remapping (there was
      remapping for the macros controlling whether the built-in functions
      are used, just not for the functions themselves).
    
    * s_llrintl.c called __builtin_round not __builtin_llrintl, which is
      obviously wrong.
    
    Tested with build-many-glibcs.py for aarch64-linux-gnu, GCC 6 (where
    it fixes the glibc build) and GCC 12, and with the glibc testsuite for
    x86_64.

Diff:
---
 sysdeps/ieee754/float128/float128_private.h | 4 ++++
 sysdeps/ieee754/ldbl-128/s_fabsl.c          | 2 +-
 sysdeps/ieee754/ldbl-128/s_llrintl.c        | 2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
index 78107b1525..b786488389 100644
--- a/sysdeps/ieee754/float128/float128_private.h
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -406,7 +406,11 @@
 #define __builtin_ceill __builtin_ceilf128
 #define __builtin_truncl __builtin_truncf128
 #define __builtin_roundl __builtin_roundf128
+#define __builtin_roundevenl __builtin_roundevenf128
+#define __builtin_lrintl __builtin_lrintf128
+#define __builtin_llrintl __builtin_llrintf128
 #define __builtin_copysignl __builtin_copysignf128
+#define __builtin_fabsl __builtin_fabsf128
 
 /* Get the constant suffix from bits/floatn-compat.h.  */
 #define L(x) __f128 (x)
diff --git a/sysdeps/ieee754/ldbl-128/s_fabsl.c b/sysdeps/ieee754/ldbl-128/s_fabsl.c
index f22515fec6..2e5ea3f413 100644
--- a/sysdeps/ieee754/ldbl-128/s_fabsl.c
+++ b/sysdeps/ieee754/ldbl-128/s_fabsl.c
@@ -27,6 +27,6 @@ static char rcsid[] = "$NetBSD: $";
 _Float128
 __fabsl (_Float128 x)
 {
-  return __builtin_fabsf128 (x);
+  return __builtin_fabsl (x);
 }
 libm_alias_ldouble (__fabs, fabs)
diff --git a/sysdeps/ieee754/ldbl-128/s_llrintl.c b/sysdeps/ieee754/ldbl-128/s_llrintl.c
index 3a5635d509..22e6e5f812 100644
--- a/sysdeps/ieee754/ldbl-128/s_llrintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_llrintl.c
@@ -31,7 +31,7 @@ long long int
 __llrintl (_Float128 x)
 {
 #if USE_LLRINTL_BUILTIN
-  return __builtin_round (x);
+  return __builtin_llrintl (x);
 #else
   /* Use generic implementation.  */
   static const _Float128 two112[2] =

                 reply	other threads:[~2023-01-05  0:03 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=20230105000311.BDB1C3858D35@sourceware.org \
    --to=jsm28@sourceware.org \
    --cc=glibc-cvs@sourceware.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).