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/x86-libc_fe] x86: Use default libc_fe* implementation for float128 Date: Mon, 20 Apr 2020 18:53:10 +0000 (GMT) [thread overview] Message-ID: <20200420185310.C6AFB3858D31@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a5fbe60dae20a90b6b922d9786749e08062cfffc commit a5fbe60dae20a90b6b922d9786749e08062cfffc Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> Date: Mon Apr 20 13:26:12 2020 -0300 x86: Use default libc_fe* implementation for float128 The exported x86_64 fenv.h functions operate on both i387 and SSE (since they should work on both float, double, and long double) while the internal libc_fe* set either SSE (float, double, and float128) or i387 (long double). The rounding mode is used by soft-fp (libgcc and glibc), so that must be set for float128 computations. For x86_64 it uses SSE mode, while for i386 is uses x87. However for exception generation both 387 and SSE exception might be generated even for x86_64. The FP_EX_DIVZERO, FP_EX_DIVZERO, and FP_EX_INEXACT uses SSE while FP_EX_DENORM, FP_EX_OVERFLOW, and FP_EX_UNDERFLOW uses x87. For i686 it depends whether libgcc was built for SSE math (where it follows x86_64 behaviour) or x87 math (which uses only x87 mode). In any case use generic routines to handle float128 since it handles both modes. It allows to use libc_fe* macros on float128 implementation for x86_64. Checked on x86_64-linux-gnu. Diff: --- sysdeps/x86/fpu/fenv_private.h | 44 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/sysdeps/x86/fpu/fenv_private.h b/sysdeps/x86/fpu/fenv_private.h index 8453aaa270..032bbd0dfa 100644 --- a/sysdeps/x86/fpu/fenv_private.h +++ b/sysdeps/x86/fpu/fenv_private.h @@ -293,28 +293,28 @@ libc_feresetround_387 (fenv_t *e) # define libc_feholdsetround_53bit libc_feholdsetround_387_53bit #endif -#ifdef __x86_64__ -/* The SSE rounding mode is used by soft-fp (libgcc and glibc) on - x86_64, so that must be set for float128 computations. */ -# define SET_RESTORE_ROUNDF128(RM) \ - 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 -# define libc_feupdateenvf128 libc_feupdateenv_sse -# define libc_fesetroundf128 libc_fesetround_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 -# define libc_feupdateenvf128 default_libc_feupdateenv -# define libc_fesetroundf128 default_libc_fesetround -#endif +/* The rounding mode is used by soft-fp (libgcc and glibc), so that must be + set for float128 computations. For x86_64 it uses SSE mode, while for + i386 is uses x87. + + However for exception generation both 387 and SSE exception might be + generated even for x86_64: FP_EX_DIVZERO, FP_EX_DIVZERO, and FP_EX_INEXACT + uses SSE while FP_EX_DENORM, FP_EX_OVERFLOW, and FP_EX_UNDERFLOW uses x87. + + For i686 it depends whether libgcc was built for SSE math (where it + follows x86_64 behaviour) or x87 math (which uses only x87 mode). + + In any case use generic routines to handle float128 since it handles + both modes. */ +#define SET_RESTORE_ROUNDF128(RM) \ + SET_RESTORE_ROUND_GENERIC (RM, default_libc_feholdsetround, \ + default_libc_feresetround) +#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 +#define libc_feupdateenvf128 default_libc_feupdateenv +#define libc_fesetroundf128 default_libc_fesetround /* We have support for rounding mode context. */ #define HAVE_RM_CTX 1
reply other threads:[~2020-04-20 18:53 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=20200420185310.C6AFB3858D31@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: linkBe 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).