authorgravatar for rpkak@noreply.codeberg.orgrpkak <rpkak@noreply.codeberg.org> 2026-01-07 19:14:58+01:00
committergravatar for rpkak@noreply.codeberg.orgrpkak <rpkak@noreply.codeberg.org> 2026-01-10 00:09:54+01:00
logaa7dac9739f7ce332c2c3841dd7f3a6d17343e0d
tree4d01d0f235b0cbf38bc9641d7c741b49b3c7b5e2
parenta2861a6c8dd96f69fa280f8a13541ca450143639
signaturebadge-check Signed by SSH key SHA256:A2g6ATENrgLKQcUdthsn72P0njmQxnHSimzwnyJsZzo

libc: remove fmin/fmax implementations


28 files changed, 0 insertions(+), 387 deletions(-)

lib/libc/mingw/math/fmaxl.c deleted-12
...@@ -1,12 +0,0 @@
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#include <math.h>
7
8long double
9fmaxl (long double _x, long double _y)
10{
11 return (( isgreaterequal(_x, _y) || __isnanl (_y)) ? _x : _y );
12}
lib/libc/mingw/math/fminl.c deleted-12
...@@ -1,12 +0,0 @@
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#include <math.h>
7
8long double
9fminl (long double _x, long double _y)
10{
11 return ((islessequal(_x, _y) || __isnanl (_y)) ? _x : _y );
12}
lib/libc/musl/src/math/aarch64/fmax.c deleted-7
...@@ -1,7 +0,0 @@
1#include <math.h>
2
3double fmax(double x, double y)
4{
5 __asm__ ("fmaxnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y));
6 return x;
7}
lib/libc/musl/src/math/aarch64/fmaxf.c deleted-7
...@@ -1,7 +0,0 @@
1#include <math.h>
2
3float fmaxf(float x, float y)
4{
5 __asm__ ("fmaxnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y));
6 return x;
7}
lib/libc/musl/src/math/aarch64/fmin.c deleted-7
...@@ -1,7 +0,0 @@
1#include <math.h>
2
3double fmin(double x, double y)
4{
5 __asm__ ("fminnm %d0, %d1, %d2" : "=w"(x) : "w"(x), "w"(y));
6 return x;
7}
lib/libc/musl/src/math/aarch64/fminf.c deleted-7
...@@ -1,7 +0,0 @@
1#include <math.h>
2
3float fminf(float x, float y)
4{
5 __asm__ ("fminnm %s0, %s1, %s2" : "=w"(x) : "w"(x), "w"(y));
6 return x;
7}
lib/libc/musl/src/math/fmax.c deleted-13
...@@ -1,13 +0,0 @@
1#include <math.h>
2
3double fmax(double x, double y)
4{
5 if (isnan(x))
6 return y;
7 if (isnan(y))
8 return x;
9 /* handle signed zeros, see C99 Annex F.9.9.2 */
10 if (signbit(x) != signbit(y))
11 return signbit(x) ? y : x;
12 return x < y ? y : x;
13}
lib/libc/musl/src/math/fmaxf.c deleted-13
...@@ -1,13 +0,0 @@
1#include <math.h>
2
3float fmaxf(float x, float y)
4{
5 if (isnan(x))
6 return y;
7 if (isnan(y))
8 return x;
9 /* handle signed zeroes, see C99 Annex F.9.9.2 */
10 if (signbit(x) != signbit(y))
11 return signbit(x) ? y : x;
12 return x < y ? y : x;
13}
lib/libc/musl/src/math/fmaxl.c deleted-21
...@@ -1,21 +0,0 @@
1#include <math.h>
2#include <float.h>
3
4#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
5long double fmaxl(long double x, long double y)
6{
7 return fmax(x, y);
8}
9#else
10long double fmaxl(long double x, long double y)
11{
12 if (isnan(x))
13 return y;
14 if (isnan(y))
15 return x;
16 /* handle signed zeros, see C99 Annex F.9.9.2 */
17 if (signbit(x) != signbit(y))
18 return signbit(x) ? y : x;
19 return x < y ? y : x;
20}
21#endif
lib/libc/musl/src/math/fmin.c deleted-13
...@@ -1,13 +0,0 @@
1#include <math.h>
2
3double fmin(double x, double y)
4{
5 if (isnan(x))
6 return y;
7 if (isnan(y))
8 return x;
9 /* handle signed zeros, see C99 Annex F.9.9.2 */
10 if (signbit(x) != signbit(y))
11 return signbit(x) ? x : y;
12 return x < y ? x : y;
13}
lib/libc/musl/src/math/fminf.c deleted-13
...@@ -1,13 +0,0 @@
1#include <math.h>
2
3float fminf(float x, float y)
4{
5 if (isnan(x))
6 return y;
7 if (isnan(y))
8 return x;
9 /* handle signed zeros, see C99 Annex F.9.9.2 */
10 if (signbit(x) != signbit(y))
11 return signbit(x) ? x : y;
12 return x < y ? x : y;
13}
lib/libc/musl/src/math/fminl.c deleted-21
...@@ -1,21 +0,0 @@
1#include <math.h>
2#include <float.h>
3
4#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
5long double fminl(long double x, long double y)
6{
7 return fmin(x, y);
8}
9#else
10long double fminl(long double x, long double y)
11{
12 if (isnan(x))
13 return y;
14 if (isnan(y))
15 return x;
16 /* handle signed zeros, see C99 Annex F.9.9.2 */
17 if (signbit(x) != signbit(y))
18 return signbit(x) ? x : y;
19 return x < y ? x : y;
20}
21#endif
lib/libc/musl/src/math/powerpc64/fmax.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#ifdef __VSX__
4
5double fmax(double x, double y)
6{
7 __asm__ ("xsmaxdp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y));
8 return x;
9}
10
11#else
12
13#include "../fmax.c"
14
15#endif
lib/libc/musl/src/math/powerpc64/fmaxf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#ifdef __VSX__
4
5float fmaxf(float x, float y)
6{
7 __asm__ ("xsmaxdp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y));
8 return x;
9}
10
11#else
12
13#include "../fmaxf.c"
14
15#endif
lib/libc/musl/src/math/powerpc64/fmin.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#ifdef __VSX__
4
5double fmin(double x, double y)
6{
7 __asm__ ("xsmindp %x0, %x1, %x2" : "=ws"(x) : "ws"(x), "ws"(y));
8 return x;
9}
10
11#else
12
13#include "../fmin.c"
14
15#endif
lib/libc/musl/src/math/powerpc64/fminf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#ifdef __VSX__
4
5float fminf(float x, float y)
6{
7 __asm__ ("xsmindp %x0, %x1, %x2" : "=ww"(x) : "ww"(x), "ww"(y));
8 return x;
9}
10
11#else
12
13#include "../fminf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmax.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmax(double x, double y)
6{
7 __asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmax.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmaxf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fmaxf(float x, float y)
6{
7 __asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmaxf.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fmin.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmin(double x, double y)
6{
7 __asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmin.c"
14
15#endif
lib/libc/musl/src/math/riscv32/fminf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fminf(float x, float y)
6{
7 __asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fminf.c"
14
15#endif
lib/libc/musl/src/math/riscv64/fmax.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmax(double x, double y)
6{
7 __asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmax.c"
14
15#endif
lib/libc/musl/src/math/riscv64/fmaxf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fmaxf(float x, float y)
6{
7 __asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmaxf.c"
14
15#endif
lib/libc/musl/src/math/riscv64/fmin.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 64
4
5double fmin(double x, double y)
6{
7 __asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fmin.c"
14
15#endif
lib/libc/musl/src/math/riscv64/fminf.c deleted-15
...@@ -1,15 +0,0 @@
1#include <math.h>
2
3#if __riscv_flen >= 32
4
5float fminf(float x, float y)
6{
7 __asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y));
8 return x;
9}
10
11#else
12
13#include "../fminf.c"
14
15#endif
lib/libc/wasi/libc-bottom-half/sources/math/fmin-fmax.c deleted-34
...@@ -1,34 +0,0 @@
1// Wasm's `min` and `max` operators implement the IEEE 754-2019
2// `minimum` and `maximum` operations, meaning that given a choice
3// between NaN and a number, they return NaN. This differs from
4// the C standard library's `fmin` and `fmax` functions, which
5// return the number. However, we can still use wasm's builtins
6// by handling the NaN cases explicitly, and it still turns out
7// to be faster than doing the whole operation in
8// target-independent C. And, it's smaller.
9
10#include <math.h>
11
12float fminf(float x, float y) {
13 if (isnan(x)) return y;
14 if (isnan(y)) return x;
15 return __builtin_wasm_min_f32(x, y);
16}
17
18float fmaxf(float x, float y) {
19 if (isnan(x)) return y;
20 if (isnan(y)) return x;
21 return __builtin_wasm_max_f32(x, y);
22}
23
24double fmin(double x, double y) {
25 if (isnan(x)) return y;
26 if (isnan(y)) return x;
27 return __builtin_wasm_min_f64(x, y);
28}
29
30double fmax(double x, double y) {
31 if (isnan(x)) return y;
32 if (isnan(y)) return x;
33 return __builtin_wasm_max_f64(x, y);
34}
src/libs/mingw.zig-2
...@@ -942,8 +942,6 @@ const mingw32_x86_src = [_][]const u8{...@@ -942,8 +942,6 @@ const mingw32_x86_src = [_][]const u8{
942 "math" ++ path.sep_str ++ "erfl.c",942 "math" ++ path.sep_str ++ "erfl.c",
943 "math" ++ path.sep_str ++ "fdiml.c",943 "math" ++ path.sep_str ++ "fdiml.c",
944 "math" ++ path.sep_str ++ "fmal.c",944 "math" ++ path.sep_str ++ "fmal.c",
945 "math" ++ path.sep_str ++ "fmaxl.c",
946 "math" ++ path.sep_str ++ "fminl.c",
947 "math" ++ path.sep_str ++ "llrintl.c",945 "math" ++ path.sep_str ++ "llrintl.c",
948 "math" ++ path.sep_str ++ "llroundl.c",946 "math" ++ path.sep_str ++ "llroundl.c",
949 "math" ++ path.sep_str ++ "lrintl.c",947 "math" ++ path.sep_str ++ "lrintl.c",
src/libs/musl.zig-22
...@@ -812,10 +812,6 @@ const src_files = [_][]const u8{...@@ -812,10 +812,6 @@ const src_files = [_][]const u8{
812 "musl/src/malloc/replaced.c",812 "musl/src/malloc/replaced.c",
813 "musl/src/math/aarch64/fma.c",813 "musl/src/math/aarch64/fma.c",
814 "musl/src/math/aarch64/fmaf.c",814 "musl/src/math/aarch64/fmaf.c",
815 "musl/src/math/aarch64/fmax.c",
816 "musl/src/math/aarch64/fmaxf.c",
817 "musl/src/math/aarch64/fmin.c",
818 "musl/src/math/aarch64/fminf.c",
819 "musl/src/math/aarch64/llrint.c",815 "musl/src/math/aarch64/llrint.c",
820 "musl/src/math/aarch64/llrintf.c",816 "musl/src/math/aarch64/llrintf.c",
821 "musl/src/math/aarch64/llround.c",817 "musl/src/math/aarch64/llround.c",
...@@ -893,12 +889,6 @@ const src_files = [_][]const u8{...@@ -893,12 +889,6 @@ const src_files = [_][]const u8{
893 "musl/src/math/fma.c",889 "musl/src/math/fma.c",
894 "musl/src/math/fmaf.c",890 "musl/src/math/fmaf.c",
895 "musl/src/math/fmal.c",891 "musl/src/math/fmal.c",
896 "musl/src/math/fmax.c",
897 "musl/src/math/fmaxf.c",
898 "musl/src/math/fmaxl.c",
899 "musl/src/math/fmin.c",
900 "musl/src/math/fminf.c",
901 "musl/src/math/fminl.c",
902 "musl/src/math/__fpclassify.c",892 "musl/src/math/__fpclassify.c",
903 "musl/src/math/__fpclassifyf.c",893 "musl/src/math/__fpclassifyf.c",
904 "musl/src/math/__fpclassifyl.c",894 "musl/src/math/__fpclassifyl.c",
...@@ -1030,10 +1020,6 @@ const src_files = [_][]const u8{...@@ -1030,10 +1020,6 @@ const src_files = [_][]const u8{
1030 "musl/src/math/pow_data.c",1020 "musl/src/math/pow_data.c",
1031 "musl/src/math/powerpc64/fma.c",1021 "musl/src/math/powerpc64/fma.c",
1032 "musl/src/math/powerpc64/fmaf.c",1022 "musl/src/math/powerpc64/fmaf.c",
1033 "musl/src/math/powerpc64/fmax.c",
1034 "musl/src/math/powerpc64/fmaxf.c",
1035 "musl/src/math/powerpc64/fmin.c",
1036 "musl/src/math/powerpc64/fminf.c",
1037 "musl/src/math/powerpc64/lrint.c",1023 "musl/src/math/powerpc64/lrint.c",
1038 "musl/src/math/powerpc64/lrintf.c",1024 "musl/src/math/powerpc64/lrintf.c",
1039 "musl/src/math/powerpc64/lround.c",1025 "musl/src/math/powerpc64/lround.c",
...@@ -1066,20 +1052,12 @@ const src_files = [_][]const u8{...@@ -1066,20 +1052,12 @@ const src_files = [_][]const u8{
1066 "musl/src/math/riscv32/copysignf.c",1052 "musl/src/math/riscv32/copysignf.c",
1067 "musl/src/math/riscv32/fma.c",1053 "musl/src/math/riscv32/fma.c",
1068 "musl/src/math/riscv32/fmaf.c",1054 "musl/src/math/riscv32/fmaf.c",
1069 "musl/src/math/riscv32/fmax.c",
1070 "musl/src/math/riscv32/fmaxf.c",
1071 "musl/src/math/riscv32/fmin.c",
1072 "musl/src/math/riscv32/fminf.c",
1073 "musl/src/math/riscv32/sqrt.c",1055 "musl/src/math/riscv32/sqrt.c",
1074 "musl/src/math/riscv32/sqrtf.c",1056 "musl/src/math/riscv32/sqrtf.c",
1075 "musl/src/math/riscv64/copysign.c",1057 "musl/src/math/riscv64/copysign.c",
1076 "musl/src/math/riscv64/copysignf.c",1058 "musl/src/math/riscv64/copysignf.c",
1077 "musl/src/math/riscv64/fma.c",1059 "musl/src/math/riscv64/fma.c",
1078 "musl/src/math/riscv64/fmaf.c",1060 "musl/src/math/riscv64/fmaf.c",
1079 "musl/src/math/riscv64/fmax.c",
1080 "musl/src/math/riscv64/fmaxf.c",
1081 "musl/src/math/riscv64/fmin.c",
1082 "musl/src/math/riscv64/fminf.c",
1083 "musl/src/math/riscv64/sqrt.c",1061 "musl/src/math/riscv64/sqrt.c",
1084 "musl/src/math/riscv64/sqrtf.c",1062 "musl/src/math/riscv64/sqrtf.c",
1085 "musl/src/math/round.c",1063 "musl/src/math/round.c",
src/libs/wasi_libc.zig-3
...@@ -547,7 +547,6 @@ const libc_bottom_half_src_files = [_][]const u8{...@@ -547,7 +547,6 @@ const libc_bottom_half_src_files = [_][]const u8{
547 "wasi/libc-bottom-half/sources/getentropy.c",547 "wasi/libc-bottom-half/sources/getentropy.c",
548 "wasi/libc-bottom-half/sources/isatty.c",548 "wasi/libc-bottom-half/sources/isatty.c",
549 "wasi/libc-bottom-half/sources/__main_void.c",549 "wasi/libc-bottom-half/sources/__main_void.c",
550 "wasi/libc-bottom-half/sources/math/fmin-fmax.c",
551 "wasi/libc-bottom-half/sources/math/math-builtins.c",550 "wasi/libc-bottom-half/sources/math/math-builtins.c",
552 "wasi/libc-bottom-half/sources/posix.c",551 "wasi/libc-bottom-half/sources/posix.c",
553 "wasi/libc-bottom-half/sources/preopens.c",552 "wasi/libc-bottom-half/sources/preopens.c",
...@@ -737,8 +736,6 @@ const libc_top_half_src_files = [_][]const u8{...@@ -737,8 +736,6 @@ const libc_top_half_src_files = [_][]const u8{
737 "musl/src/math/finitef.c",736 "musl/src/math/finitef.c",
738 "musl/src/math/fma.c",737 "musl/src/math/fma.c",
739 "musl/src/math/fmaf.c",738 "musl/src/math/fmaf.c",
740 "musl/src/math/fmaxl.c",
741 "musl/src/math/fminl.c",
742 "musl/src/math/frexp.c",739 "musl/src/math/frexp.c",
743 "musl/src/math/frexpf.c",740 "musl/src/math/frexpf.c",
744 "musl/src/math/frexpl.c",741 "musl/src/math/frexpl.c",