From: Adhemerval Zanella Date: Wed, 8 Oct 2025 13:55:05 +0000 (-0300) Subject: m68k: Remove SVID error handling on fmod X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6deadd4eb6ab4f59d116b2d7ad97be0d0848cb7f;p=thirdparty%2Fglibc.git m68k: Remove SVID error handling on fmod 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 --- diff --git a/sysdeps/m68k/m680x0/fpu/Versions b/sysdeps/m68k/m680x0/fpu/Versions index ee1dc6b649..eb5eae05f8 100644 --- a/sysdeps/m68k/m680x0/fpu/Versions +++ b/sysdeps/m68k/m680x0/fpu/Versions @@ -1,6 +1,6 @@ libm { GLIBC_2.43 { # No SVID compatible error handling. - fmodf; + fmodf; fmod; } } diff --git a/sysdeps/m68k/m680x0/fpu/e_fmod.c b/sysdeps/m68k/m680x0/fpu/e_fmod.c index 422ab72530..8a57349c13 100644 --- a/sysdeps/m68k/m680x0/fpu/e_fmod.c +++ b/sysdeps/m68k/m680x0/fpu/e_fmod.c @@ -15,24 +15,27 @@ License along with the GNU C Library. If not, see . */ +#include +#include #include -#include #include "mathimpl.h" -#include - -#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) diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist index 9de0abca25..a9d615da74 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist @@ -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