]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
m68k: Remove SVID error handling on fmod
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 8 Oct 2025 13:55:05 +0000 (10:55 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 30 Oct 2025 18:41:15 +0000 (15:41 -0300)
The m68k provided an optimized version through __m81_u(fmod)
(mathimpl.h), and gcc does not implement it through a builtin
(different than i386).

Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
sysdeps/m68k/m680x0/fpu/Versions
sysdeps/m68k/m680x0/fpu/e_fmod.c
sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist

index ee1dc6b64933e784bae6ad41e90412a6c821f1fb..eb5eae05f890c05faace2cc9b76b2a4b11dfbb0a 100644 (file)
@@ -1,6 +1,6 @@
 libm {
   GLIBC_2.43 {
     # No SVID compatible error handling.
-    fmodf;
+    fmodf; fmod;
   }
 }
index 422ab72530368da67aa3f7a502979167586f4203..8a57349c135a9f1a0f7ea73eb5af0f2c60921773 100644 (file)
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <libm-alias-double.h>
+#include <libm-alias-finite.h>
 #include <math.h>
-#include <math_private.h>
 #include "mathimpl.h"
-#include <libm-alias-finite.h>
-
-#ifndef FUNC
-# define FUNC __ieee754_fmod
-# define FUNC_FINITE __fmod
-#endif
-#ifndef float_type
-# define float_type double
-#endif
+#include "math_config.h"
 
-float_type
-FUNC (float_type x, float_type y)
+double
+__fmod (double x, double y)
 {
-  return __m81_u(FUNC)(x, y);
+  uint64_t hx = asuint64 (x);
+  uint64_t hy = asuint64 (y);
+
+  /* fmod(+-Inf,y) or fmod(x,0) */
+  if (__glibc_unlikely ((is_inf (hx) || y == 0.0)
+                       && !is_nan (hy)
+                       && !is_nan (hx)))
+    return __math_invalid (x);
+
+  return __m81_u(fmod)(x, y);
 }
-#ifdef FUNC_FINITE
-libm_alias_finite (FUNC, FUNC_FINITE)
-#endif
+strong_alias (__fmod, __ieee754_fmod)
+libm_alias_finite (__ieee754_fmod, __fmod)
+versioned_symbol (libm, __fmod, fmod, GLIBC_2_43);
+libm_alias_double_other (__fmod, fmod)
index 9de0abca2579071241a0a8cfe76cfe9459efa0a4..a9d615da7454b2686420231b2b0eeaa513cb17c3 100644 (file)
@@ -986,4 +986,5 @@ GLIBC_2.42 rsqrtf32 F
 GLIBC_2.42 rsqrtf32x F
 GLIBC_2.42 rsqrtf64 F
 GLIBC_2.42 rsqrtl F
+GLIBC_2.43 fmod F
 GLIBC_2.43 fmodf F