* [PATCH 0/3] math: fmod fixes on i386 and m68k
@ 2024-03-14 18:18 Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 1/3] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-03-14 18:18 UTC (permalink / raw)
To: libc-alpha
The first patch is also meant to be back-portable to 2.38.
Adhemerval Zanella (3):
math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
i386: Use generic fmod
i386: Use generic fmodf
sysdeps/i386/fpu/e_fmod.S | 18 ------------------
sysdeps/i386/fpu/e_fmodf.S | 18 ------------------
sysdeps/i386/fpu/math_err.c | 1 -
sysdeps/i386/fpu/w_fmod_compat.c | 14 --------------
sysdeps/i386/fpu/w_fmodf_compat.c | 14 --------------
sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
sysdeps/unix/sysv/linux/i386/libm.abilist | 2 ++
8 files changed, 9 insertions(+), 70 deletions(-)
delete mode 100644 sysdeps/i386/fpu/e_fmod.S
delete mode 100644 sysdeps/i386/fpu/e_fmodf.S
delete mode 100644 sysdeps/i386/fpu/math_err.c
delete mode 100644 sysdeps/i386/fpu/w_fmod_compat.c
delete mode 100644 sysdeps/i386/fpu/w_fmodf_compat.c
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488)
2024-03-14 18:18 [PATCH 0/3] math: fmod fixes on i386 and m68k Adhemerval Zanella
@ 2024-03-14 18:18 ` Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 2/3] i386: Use generic fmod Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 3/3] i386: Use generic fmodf Adhemerval Zanella
2 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-03-14 18:18 UTC (permalink / raw)
To: libc-alpha
The commit 16439f419b removed the static fmod/fmodf on i386 and
m68k with and empty w_fmod.c (required for the ABIs that uses
the newly implementation). This patch fixes by adding the
required symbols on the arch-specific w_fmod{f}_compat.c
implementation.
Checked on i686-linux-gnu and with a build for m68k-linux-gnu.
I also checked that a stack build using fmod/fmodf correctly
resolves on both ABIs.
---
sysdeps/i386/fpu/w_fmod_compat.c | 7 ++++---
sysdeps/i386/fpu/w_fmodf_compat.c | 7 ++++---
sysdeps/m68k/m680x0/fpu/w_fmod_compat.c | 5 +++--
sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c | 7 ++++---
4 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
index 5ac9995ffd..528bfc2a13 100644
--- a/sysdeps/i386/fpu/w_fmod_compat.c
+++ b/sysdeps/i386/fpu/w_fmod_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmod_compat.c>
-#ifdef SHARED
+# include <math/w_fmod_compat.c>
libm_alias_double (__fmod_compat, fmod)
+#else
+#include <math-type-macros-double.h>
+#include <w_fmod_template.c>
#endif
diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c
index cc417e07d3..5a61693e51 100644
--- a/sysdeps/i386/fpu/w_fmodf_compat.c
+++ b/sysdeps/i386/fpu/w_fmodf_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmodf_compat.c>
-#ifdef SHARED
+# 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/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
index 527d4fbed2..57f38091e6 100644
--- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
+++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
#include <math/w_fmod_compat.c>
-#ifdef SHARED
libm_alias_double (__fmod_compat, fmod)
+#else
+#include <math-type-macros-double.h>
+#include <w_fmod_template.c>
#endif
diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
index 5043586b91..88db07f443 100644
--- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
+++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c
@@ -7,8 +7,9 @@
# define LIBM_SVID_COMPAT 1
# undef compat_symbol
# define compat_symbol(a, b, c, d)
-#endif
-#include <math/w_fmodf_compat.c>
-#ifdef SHARED
+# 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
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] i386: Use generic fmod
2024-03-14 18:18 [PATCH 0/3] math: fmod fixes on i386 and m68k Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 1/3] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
@ 2024-03-14 18:18 ` Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 3/3] i386: Use generic fmodf Adhemerval Zanella
2 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-03-14 18:18 UTC (permalink / raw)
To: libc-alpha
The benchtest results shows a slight improvement:
* sysdeps/i386/fpu/e_fmod.S:
"fmod": {
"subnormals": {
"duration": 3.68855e+09,
"iterations": 2.12608e+08,
"max": 62.012,
"min": 16.798,
"mean": 17.349
},
"normal": {
"duration": 3.88459e+09,
"iterations": 7.168e+06,
"max": 2879.12,
"min": 16.909,
"mean": 541.934
},
"close-exponents": {
"duration": 3.692e+09,
"iterations": 1.96608e+08,
"max": 66.452,
"min": 16.835,
"mean": 18.7785
}
}
* generic
"fmod": {
"subnormals": {
"duration": 3.68645e+09,
"iterations": 2.2848e+08,
"max": 66.896,
"min": 15.91,
"mean": 16.1347
},
"normal": {
"duration": 4.1455e+09,
"iterations": 8.192e+06,
"max": 3376.18,
"min": 15.873,
"mean": 506.043
},
"close-exponents": {
"duration": 3.70197e+09,
"iterations": 2.08896e+08,
"max": 69.597,
"min": 15.947,
"mean": 17.7216
}
}
---
sysdeps/i386/fpu/e_fmod.S | 18 ------------------
sysdeps/i386/fpu/w_fmod_compat.c | 15 ---------------
sysdeps/unix/sysv/linux/i386/libm.abilist | 1 +
3 files changed, 1 insertion(+), 33 deletions(-)
delete mode 100644 sysdeps/i386/fpu/e_fmod.S
delete mode 100644 sysdeps/i386/fpu/w_fmod_compat.c
diff --git a/sysdeps/i386/fpu/e_fmod.S b/sysdeps/i386/fpu/e_fmod.S
deleted file mode 100644
index 86ac1bcfaf..0000000000
--- a/sysdeps/i386/fpu/e_fmod.S
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Public domain.
- */
-
-#include <machine/asm.h>
-#include <libm-alias-finite.h>
-
-ENTRY(__ieee754_fmod)
- fldl 12(%esp)
- fldl 4(%esp)
-1: fprem
- fstsw %ax
- sahf
- jp 1b
- fstp %st(1)
- ret
-END (__ieee754_fmod)
-libm_alias_finite (__ieee754_fmod, __fmod)
diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c
deleted file mode 100644
index 528bfc2a13..0000000000
--- a/sysdeps/i386/fpu/w_fmod_compat.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* i386 provides an optimized __ieee752_fmod. */
-#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_fmod_compat.c>
-libm_alias_double (__fmod_compat, fmod)
-#else
-#include <math-type-macros-double.h>
-#include <w_fmod_template.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 5d89aaa08e..dccd7ccd79 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -1188,3 +1188,4 @@ GLIBC_2.35 fsqrt F
GLIBC_2.35 fsqrtl F
GLIBC_2.35 hypot F
GLIBC_2.35 hypotf F
+GLIBC_2.38 fmod F
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] i386: Use generic fmodf
2024-03-14 18:18 [PATCH 0/3] math: fmod fixes on i386 and m68k Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 1/3] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 2/3] i386: Use generic fmod Adhemerval Zanella
@ 2024-03-14 18:18 ` Adhemerval Zanella
2 siblings, 0 replies; 4+ messages in thread
From: Adhemerval Zanella @ 2024-03-14 18:18 UTC (permalink / raw)
To: libc-alpha
The resulting performance is similiar:
* 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/e_fmodf.S | 18 ------------------
sysdeps/i386/fpu/math_err.c | 1 -
sysdeps/i386/fpu/w_fmodf_compat.c | 15 ---------------
sysdeps/unix/sysv/linux/i386/libm.abilist | 1 +
4 files changed, 1 insertion(+), 34 deletions(-)
delete mode 100644 sysdeps/i386/fpu/e_fmodf.S
delete mode 100644 sysdeps/i386/fpu/math_err.c
delete mode 100644 sysdeps/i386/fpu/w_fmodf_compat.c
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/math_err.c b/sysdeps/i386/fpu/math_err.c
deleted file mode 100644
index 1cc8931700..0000000000
--- a/sysdeps/i386/fpu/math_err.c
+++ /dev/null
@@ -1 +0,0 @@
-/* Not needed. */
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/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index dccd7ccd79..73c14a914e 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.38 fmod F
+GLIBC_2.38 fmodf F
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-14 18:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-14 18:18 [PATCH 0/3] math: fmod fixes on i386 and m68k Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 1/3] math: Fix i386 and m68k fmod/fmodf on static build (BZ 31488) Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 2/3] i386: Use generic fmod Adhemerval Zanella
2024-03-14 18:18 ` [PATCH 3/3] i386: Use generic fmodf Adhemerval Zanella
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).