public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/sfp-exceptions] Use libc_fe* macros in ldbl-128/s_nearbyintl.c
Date: Fri, 17 Apr 2020 12:07:05 +0000 (GMT)	[thread overview]
Message-ID: <20200417120705.EE17B385B835@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2b48ff1b0c1083ea8f010867b252547cbaa5cb75

commit 2b48ff1b0c1083ea8f010867b252547cbaa5cb75
Author: Stefan Liebler via Libc-alpha <libc-alpha@sourceware.org>
Date:   Fri Apr 17 08:49:51 2020 -0300

    Use libc_fe* macros in ldbl-128/s_nearbyintl.c
    
    The calls to feholdexcept and fesetenv are replaced
    by the libc_fe* macros as it is also done in nearbyintf
    and nearbyint.

Diff:
---
 sysdeps/ieee754/float128/float128_private.h | 10 ++++++++++
 sysdeps/ieee754/ldbl-128/s_nearbyintl.c     |  9 +++++----
 sysdeps/x86/fpu/fenv_private.h              |  4 ++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/sysdeps/ieee754/float128/float128_private.h b/sysdeps/ieee754/float128/float128_private.h
index f97463d9dc..af1ed8f3c0 100644
--- a/sysdeps/ieee754/float128/float128_private.h
+++ b/sysdeps/ieee754/float128/float128_private.h
@@ -66,6 +66,16 @@
 # define libc_feupdateenv_testl(ENV, EX) libc_feupdateenv_testf128 (ENV, EX)
 #endif
 
+#ifdef libc_feholdexceptf128
+# undef libc_feholdexceptl
+# define libc_feholdexceptl(ENV) libc_feholdexceptf128 (ENV)
+#endif
+
+#ifdef libc_fesetenvf128
+# undef libc_fesetenvl
+# define libc_fesetenvl(ENV) libc_fesetenvf128 (ENV)
+#endif
+
 /* misc macros from the header below.  */
 #include <fix-fp-int-convert-overflow.h>
 #undef FIX_LDBL_LONG_CONVERT_OVERFLOW
diff --git a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
index 8d26786f78..c0bc6fbd6d 100644
--- a/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
+++ b/sysdeps/ieee754/ldbl-128/s_nearbyintl.c
@@ -27,6 +27,7 @@
 #include <math.h>
 #include <math-barriers.h>
 #include <math_private.h>
+#include <fenv_private.h>
 #include <libm-alias-ldouble.h>
 #include <math-use-builtins.h>
 
@@ -53,11 +54,11 @@ __nearbyintl (_Float128 x)
     {
       if (j0 < 0)
 	{
-	  feholdexcept (&env);
+	  libc_feholdexceptl (&env);
 	  w = TWO112[sx] + math_opt_barrier (x);
 	  t = w - TWO112[sx];
 	  math_force_eval (t);
-	  fesetenv (&env);
+	  libc_fesetenvl (&env);
 	  GET_LDOUBLE_MSW64 (i0, t);
 	  SET_LDOUBLE_MSW64 (t, (i0 & 0x7fffffffffffffffLL) | (sx << 63));
 	  return t;
@@ -70,11 +71,11 @@ __nearbyintl (_Float128 x)
       else
 	return x;		/* x is integral  */
     }
-  feholdexcept (&env);
+  libc_feholdexceptl (&env);
   w = TWO112[sx] + math_opt_barrier (x);
   t = w - TWO112[sx];
   math_force_eval (t);
-  fesetenv (&env);
+  libc_fesetenvl (&env);
   return t;
 #endif /* ! USE_NEARBYINTL_BUILTIN  */
 }
diff --git a/sysdeps/x86/fpu/fenv_private.h b/sysdeps/x86/fpu/fenv_private.h
index 4b081e015b..23a430362a 100644
--- a/sysdeps/x86/fpu/fenv_private.h
+++ b/sysdeps/x86/fpu/fenv_private.h
@@ -300,12 +300,16 @@ libc_feresetround_387 (fenv_t *e)
   SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround_sse, libc_feresetround_sse)
 # define libc_feholdexcept_setroundf128	libc_feholdexcept_setround_sse
 # define libc_feupdateenv_testf128	libc_feupdateenv_test_sse
+# define libc_feholdexceptf128	libc_feholdexcept_sse
+# define libc_fesetenvf128	libc_fesetenv_sse
 #else
 /* The 387 rounding mode is used by soft-fp for 32-bit, but whether
    387 or SSE exceptions are used depends on whether libgcc was built
    for SSE math, which is not known when glibc is being built.  */
 # define libc_feholdexcept_setroundf128	default_libc_feholdexcept_setround
 # define libc_feupdateenv_testf128	default_libc_feupdateenv_test
+# define libc_feholdexceptf128	default_libc_feholdexcept
+# define libc_fesetenvf128	default_libc_fesetenv
 #endif
 
 /* We have support for rounding mode context.  */


                 reply	other threads:[~2020-04-17 12:07 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=20200417120705.EE17B385B835@sourceware.org \
    --to=azanella@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).