[PATCH v4 04/21] m68k: Avoid include e_fmod.c on fmod/remainder implementation

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Oct 8 13:55:04 GMT 2025


And open-code each implementation.  It simplifies SVID error handling
removal.
---
 sysdeps/m68k/m680x0/fpu/e_fmodl.c      | 34 +++++++++++++++++++++-----
 sysdeps/m68k/m680x0/fpu/e_remainder.c  | 31 ++++++++++++++++++++---
 sysdeps/m68k/m680x0/fpu/e_remainderf.c | 33 ++++++++++++++++++++++---
 sysdeps/m68k/m680x0/fpu/e_remainderl.c | 32 +++++++++++++++++++++---
 4 files changed, 114 insertions(+), 16 deletions(-)

diff --git a/sysdeps/m68k/m680x0/fpu/e_fmodl.c b/sysdeps/m68k/m680x0/fpu/e_fmodl.c
index 8f1cbabda63..48d4cefc6fa 100644
--- a/sysdeps/m68k/m680x0/fpu/e_fmodl.c
+++ b/sysdeps/m68k/m680x0/fpu/e_fmodl.c
@@ -1,6 +1,28 @@
-#ifndef FUNC
-# define FUNC __ieee754_fmodl
-# define FUNC_FINITE __fmodl
-#endif
-#define float_type long double
-#include <e_fmod.c>
+/* Fmod function, m68k double version.
+   Copyright (C) 1996-2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <libm-alias-finite.h>
+#include "mathimpl.h"
+
+long double
+__ieee754_fmodl (long double x, long double y)
+{
+  return __m81_u(__ieee754_fmodl)(x, y);
+}
+libm_alias_finite (__ieee754_fmodl, __fmodl)
diff --git a/sysdeps/m68k/m680x0/fpu/e_remainder.c b/sysdeps/m68k/m680x0/fpu/e_remainder.c
index cc1422c48b3..d9d383840f5 100644
--- a/sysdeps/m68k/m680x0/fpu/e_remainder.c
+++ b/sysdeps/m68k/m680x0/fpu/e_remainder.c
@@ -1,3 +1,28 @@
-#define FUNC __ieee754_remainder
-#define FUNC_FINITE __remainder
-#include <e_fmod.c>
+/* Remainder function, m68k double version.
+   Copyright (C) 1996-2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+#include <libm-alias-finite.h>
+#include "mathimpl.h"
+
+double
+__ieee754_remainder (double x, double y)
+{
+  return __m81_u(__ieee754_remainder)(x, y);
+}
+libm_alias_finite (__ieee754_remainder, __remainder)
diff --git a/sysdeps/m68k/m680x0/fpu/e_remainderf.c b/sysdeps/m68k/m680x0/fpu/e_remainderf.c
index beacf65636f..2c1e4f67746 100644
--- a/sysdeps/m68k/m680x0/fpu/e_remainderf.c
+++ b/sysdeps/m68k/m680x0/fpu/e_remainderf.c
@@ -1,4 +1,29 @@
-#define FUNC __ieee754_remainderf
-#define FUNC_FINITE __remainderf
-#define float_type float
-#include <e_fmod.c>
+/* Remainder function, m68k float version.
+   Copyright (C) 1996-2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+
+#include <math.h>
+#include <libm-alias-finite.h>
+#include "mathimpl.h"
+
+float
+__ieee754_remainderf (float x, float y)
+{
+  return __m81_u(__ieee754_remainderf)(x, y);
+}
+libm_alias_finite (__ieee754_remainderf, __remainderf)
diff --git a/sysdeps/m68k/m680x0/fpu/e_remainderl.c b/sysdeps/m68k/m680x0/fpu/e_remainderl.c
index ce3490a5ec7..f2277b25b56 100644
--- a/sysdeps/m68k/m680x0/fpu/e_remainderl.c
+++ b/sysdeps/m68k/m680x0/fpu/e_remainderl.c
@@ -1,3 +1,29 @@
-#define FUNC __ieee754_remainderl
-#define FUNC_FINITE __remainderl
-#include <e_fmodl.c>
+/* Remainder function, m68k long double version.
+   Copyright (C) 1996-2025 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+
+#include <math.h>
+#include <libm-alias-finite.h>
+#include "mathimpl.h"
+
+long double
+__ieee754_remainderl (long double x, long double y)
+{
+  return __m81_u(__ieee754_remainderl)(x, y);
+}
+libm_alias_finite (__ieee754_remainderl, __remainderl)
-- 
2.43.0



More information about the Libc-alpha mailing list