commit a2861a6c8dd96f69fa280f8a13541ca450143639 (tree)
parent 9dd32d5e65989c33101d4607a0ae15e6b4034879
Author: rpkak <rpkak@noreply.codeberg.org>
Date: Wed, 7 Jan 2026 19:03:26 +0100
libc: remove fmod implementations
Diffstat:
9 files changed, 0 insertions(+), 106 deletions(-)
diff --git a/lib/libc/mingw/math/x86/fmodf.c b/lib/libc/mingw/math/x86/fmodf.c
@@ -1,29 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-/*
- * Written by J.T. Conklin <jtc@netbsd.org>.
- * Public domain.
- *
- * Adapted for float type by Danny Smith
- * <dannysmith@users.sourceforge.net>.
- */
-
-#include <math.h>
-
-float
-fmodf (float x, float y)
-{
- float res = 0.0F;
-
- asm volatile (
- "1:\tfprem\n\t"
- "fstsw %%ax\n\t"
- "sahf\n\t"
- "jp 1b\n\t"
- "fstp %%st(1)"
- : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
- return res;
-}
diff --git a/lib/libc/mingw/math/x86/fmodl.c b/lib/libc/mingw/math/x86/fmodl.c
@@ -1,21 +0,0 @@
-/**
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is part of the mingw-w64 runtime package.
- * No warranty is given; refer to the file DISCLAIMER.PD within this package.
- */
-long double fmodl (long double x, long double y);
-
-long double
-fmodl (long double x, long double y)
-{
- long double res = 0.0L;
-
- asm volatile (
- "1:\tfprem\n\t"
- "fstsw %%ax\n\t"
- "sahf\n\t"
- "jp 1b\n\t"
- "fstp %%st(1)"
- : "=t" (res) : "0" (x), "u" (y) : "ax", "st(1)");
- return res;
-}
diff --git a/lib/libc/musl/src/math/i386/fmod.c b/lib/libc/musl/src/math/i386/fmod.c
@@ -1,10 +0,0 @@
-#include <math.h>
-
-double fmod(double x, double y)
-{
- unsigned short fpsr;
- // fprem does not introduce excess precision into x
- do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y));
- while (fpsr & 0x400);
- return x;
-}
diff --git a/lib/libc/musl/src/math/i386/fmodf.c b/lib/libc/musl/src/math/i386/fmodf.c
@@ -1,10 +0,0 @@
-#include <math.h>
-
-float fmodf(float x, float y)
-{
- unsigned short fpsr;
- // fprem does not introduce excess precision into x
- do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y));
- while (fpsr & 0x400);
- return x;
-}
diff --git a/lib/libc/musl/src/math/i386/fmodl.c b/lib/libc/musl/src/math/i386/fmodl.c
@@ -1,9 +0,0 @@
-#include <math.h>
-
-long double fmodl(long double x, long double y)
-{
- unsigned short fpsr;
- do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y));
- while (fpsr & 0x400);
- return x;
-}
diff --git a/lib/libc/musl/src/math/x32/fmodl.s b/lib/libc/musl/src/math/x32/fmodl.s
@@ -1,11 +0,0 @@
-.global fmodl
-.type fmodl,@function
-fmodl:
- fldt 24(%esp)
- fldt 8(%esp)
-1: fprem
- fnstsw %ax
- testb $4,%ah
- jnz 1b
- fstp %st(1)
- ret
diff --git a/lib/libc/musl/src/math/x86_64/fmodl.c b/lib/libc/musl/src/math/x86_64/fmodl.c
@@ -1,9 +0,0 @@
-#include <math.h>
-
-long double fmodl(long double x, long double y)
-{
- unsigned short fpsr;
- do __asm__ ("fprem; fnstsw %%ax" : "+t"(x), "=a"(fpsr) : "u"(y));
- while (fpsr & 0x400);
- return x;
-}
diff --git a/src/libs/mingw.zig b/src/libs/mingw.zig
@@ -966,7 +966,6 @@ const mingw32_x86_src = [_][]const u8{
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expm1l.c",
- "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodl.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fucom.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ilogbl.S",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "internal_logl.S",
@@ -1005,7 +1004,6 @@ const mingw32_x86_32_src = [_][]const u8{
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "asinf.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c",
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanf.c",
- "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c",
};
const mingw32_arm_src = [_][]const u8{
diff --git a/src/libs/musl.zig b/src/libs/musl.zig
@@ -924,9 +924,6 @@ const src_files = [_][]const u8{
"musl/src/math/i386/exp_ld.s",
"musl/src/math/i386/expl.s",
"musl/src/math/i386/expm1l.s",
- "musl/src/math/i386/fmod.c",
- "musl/src/math/i386/fmodf.c",
- "musl/src/math/i386/fmodl.c",
"musl/src/math/i386/hypotf.s",
"musl/src/math/i386/hypot.s",
"musl/src/math/i386/__invtrigl.s",
@@ -1147,7 +1144,6 @@ const src_files = [_][]const u8{
"musl/src/math/x32/expm1l.s",
"musl/src/math/x32/fma.c",
"musl/src/math/x32/fmaf.c",
- "musl/src/math/x32/fmodl.s",
"musl/src/math/x32/__invtrigl.s",
"musl/src/math/x32/llrintf.s",
"musl/src/math/x32/llrintl.s",
@@ -1173,7 +1169,6 @@ const src_files = [_][]const u8{
"musl/src/math/x86_64/expm1l.s",
"musl/src/math/x86_64/fma.c",
"musl/src/math/x86_64/fmaf.c",
- "musl/src/math/x86_64/fmodl.c",
"musl/src/math/x86_64/__invtrigl.s",
"musl/src/math/x86_64/llrint.c",
"musl/src/math/x86_64/llrintf.c",