unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: libc-alpha@sourceware.org
Cc: "H . J . Lu" <hjl.tools@gmail.com>
Subject: [PATCH v2 4/6] i386: Use generic fmodf
Date: Thu, 21 Mar 2024 13:43:23 -0300	[thread overview]
Message-ID: <20240321164325.539976-5-adhemerval.zanella@linaro.org> (raw)
In-Reply-To: <20240321164325.539976-1-adhemerval.zanella@linaro.org>

The resulting performance is similiar (Ryzen 5900, gcc 13.2.1):

* sysdeps/i386/fpu/e_fmodf.S
  "fmodf": {
   "subnormals": {
    "duration": 3.68732e+09,
    "iterations": 2.2912e+08,
    "max": 71.447,
    "min": 15.836,
    "mean": 16.0934
   },
   "normal": {
    "duration": 3.75848e+09,
    "iterations": 5.5296e+07,
    "max": 273.208,
    "min": 15.725,
    "mean": 67.9702
   },
   "close-exponents": {
    "duration": 3.69035e+09,
    "iterations": 2.07872e+08,
    "max": 64.454,
    "min": 15.762,
    "mean": 17.753
   }
  }

* master
  "fmodf": {
   "subnormals": {
    "duration": 3.6863e+09,
    "iterations": 2.23616e+08,
    "max": 65.453,
    "min": 16.243,
    "mean": 16.485
   },
   "normal": {
    "duration": 3.71129e+09,
    "iterations": 5.3248e+07,
    "max": 281.57,
    "min": 16.169,
    "mean": 69.6983
   },
   "close-exponents": {
    "duration": 3.70274e+09,
    "iterations": 2.03776e+08,
    "max": 81.474,
    "min": 16.206,
    "mean": 18.1706
   }
  }
---
 sysdeps/i386/fpu/Versions                 |  2 +-
 sysdeps/i386/fpu/e_fmodf.S                | 18 ------------------
 sysdeps/i386/fpu/e_fmodf.c                |  2 ++
 sysdeps/i386/fpu/w_fmodf_compat.c         | 15 ---------------
 sysdeps/ieee754/flt-32/e_fmodf.c          |  5 ++++-
 sysdeps/mach/hurd/i386/libm.abilist       |  1 +
 sysdeps/unix/sysv/linux/i386/libm.abilist |  1 +
 7 files changed, 9 insertions(+), 35 deletions(-)
 delete mode 100644 sysdeps/i386/fpu/e_fmodf.S
 create mode 100644 sysdeps/i386/fpu/e_fmodf.c
 delete mode 100644 sysdeps/i386/fpu/w_fmodf_compat.c

diff --git a/sysdeps/i386/fpu/Versions b/sysdeps/i386/fpu/Versions
index d37bc1eae6..9509f9b7c7 100644
--- a/sysdeps/i386/fpu/Versions
+++ b/sysdeps/i386/fpu/Versions
@@ -5,6 +5,6 @@ libm {
   }
   GLIBC_2.40 {
     # No SVID compatible error handling.
-    fmod;
+    fmod; fmodf;
   }
 }
diff --git a/sysdeps/i386/fpu/e_fmodf.S b/sysdeps/i386/fpu/e_fmodf.S
deleted file mode 100644
index f73ce9da1e..0000000000
--- a/sysdeps/i386/fpu/e_fmodf.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Public domain.
- */
-
-#include <machine/asm.h>
-#include <libm-alias-finite.h>
-
-ENTRY(__ieee754_fmodf)
-	flds	8(%esp)
-	flds	4(%esp)
-1:	fprem
-	fstsw	%ax
-	sahf
-	jp	1b
-	fstp	%st(1)
-	ret
-END(__ieee754_fmodf)
-libm_alias_finite (__ieee754_fmodf, __fmodf)
diff --git a/sysdeps/i386/fpu/e_fmodf.c b/sysdeps/i386/fpu/e_fmodf.c
new file mode 100644
index 0000000000..15a0f960bf
--- /dev/null
+++ b/sysdeps/i386/fpu/e_fmodf.c
@@ -0,0 +1,2 @@
+#define FMODF_VERSION GLIBC_2_40
+#include <sysdeps/ieee754/flt-32/e_fmodf.c>
diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
deleted file mode 100644
index 5a61693e51..0000000000
--- a/sysdeps/i386/fpu/w_fmodf_compat.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* i386 provides an optimized __ieee752_fmodf.  */
-#include <math-svid-compat.h>
-#ifdef SHARED
-# undef SHLIB_COMPAT
-# define SHLIB_COMPAT(a, b, c) 1
-# undef LIBM_SVID_COMPAT
-# define LIBM_SVID_COMPAT 1
-# undef compat_symbol
-# define compat_symbol(a, b, c, d)
-# include <math/w_fmodf_compat.c>
-libm_alias_float (__fmod_compat, fmod)
-#else
-#include <math-type-macros-float.h>
-#include <w_fmod_template.c>
-#endif
diff --git a/sysdeps/ieee754/flt-32/e_fmodf.c b/sysdeps/ieee754/flt-32/e_fmodf.c
index ef95c05800..78071df756 100644
--- a/sysdeps/ieee754/flt-32/e_fmodf.c
+++ b/sysdeps/ieee754/flt-32/e_fmodf.c
@@ -173,7 +173,10 @@ __fmodf (float x, float y)
 }
 strong_alias (__fmodf, __ieee754_fmodf)
 #if LIBM_SVID_COMPAT
-versioned_symbol (libm, __fmodf, fmodf, GLIBC_2_38);
+# ifndef FMODF_VERSION
+#  define FMODF_VERSION GLIBC_2_38
+# endif
+versioned_symbol (libm, __fmodf, fmodf, FMODF_VERSION);
 libm_alias_float_other (__fmod, fmod)
 #else
 libm_alias_float (__fmod, fmod)
diff --git a/sysdeps/mach/hurd/i386/libm.abilist b/sysdeps/mach/hurd/i386/libm.abilist
index 30665f8b1a..88e7538e51 100644
--- a/sysdeps/mach/hurd/i386/libm.abilist
+++ b/sysdeps/mach/hurd/i386/libm.abilist
@@ -1182,3 +1182,4 @@ GLIBC_2.35 fsqrtl F
 GLIBC_2.35 hypot F
 GLIBC_2.35 hypotf F
 GLIBC_2.40 fmod F
+GLIBC_2.40 fmodf F
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 44932f111d..c99c60161d 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -1189,3 +1189,4 @@ GLIBC_2.35 fsqrtl F
 GLIBC_2.35 hypot F
 GLIBC_2.35 hypotf F
 GLIBC_2.40 fmod F
+GLIBC_2.40 fmodf F
-- 
2.34.1


  parent reply	other threads:[~2024-03-21 16:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 16:43 [PATCH v2 0/6] Math static build fixes Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 1/6] math: Add support for auto static math tests Adhemerval Zanella
2024-03-21 23:35   ` Joseph Myers
2024-03-22  6:46     ` Florian Weimer
2024-03-22 14:14       ` Adhemerval Zanella Netto
2024-03-22 15:51         ` Florian Weimer
2024-03-22 17:46           ` Adhemerval Zanella Netto
2024-03-25 13:34             ` H.J. Lu
2024-03-25 14:13               ` Adhemerval Zanella Netto
2024-03-25 14:25                 ` H.J. Lu
2024-03-25 14:29                   ` Adhemerval Zanella Netto
2024-03-25 14:52                     ` H.J. Lu
2024-03-25 17:41                       ` Adhemerval Zanella Netto
2024-03-26 13:40                         ` H.J. Lu
2024-03-26 17:37                           ` Joseph Myers
2024-03-26 17:55                             ` Adhemerval Zanella Netto
2024-03-26 17:59                               ` H.J. Lu
2024-03-21 16:43 ` [PATCH v2 2/6] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 3/6] i386: Use generic fmod Adhemerval Zanella
2024-03-21 16:43 ` Adhemerval Zanella [this message]
2024-03-21 16:43 ` [PATCH v2 5/6] math: Fix i386 and m68k exp10 on static build Adhemerval Zanella
2024-03-21 16:43 ` [PATCH v2 6/6] i386: Use generic exp10 Adhemerval Zanella

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=20240321164325.539976-5-adhemerval.zanella@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@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).