authorgravatar for jeamsblue@gmail.comKoki Ueha <jeamsblue@gmail.com> 2025-06-01 11:25:51+00:00
committergravatar for jeamsblue@gmail.comKoki Ueha <jeamsblue@gmail.com> 2025-06-01 11:25:51+00:00
log71ff3830df5bb175e94a73d5187cea93d87fa5bc
tree1d9d81d28da51f17a3351ea70b06175f51dda0b2
parent21d9e03758d40c690488abce12bb82e063ff15e9

libc: replace MinGW's trigonometric functions with compiler_rt's

- sinf - cosf - sincos - sincosf - tanf

9 files changed, 0 insertions(+), 157 deletions(-)

lib/libc/mingw/math/arm/sincos.S-3
...@@ -8,11 +8,8 @@...@@ -8,11 +8,8 @@
8 .file "sincos.S"8 .file "sincos.S"
9 .text9 .text
10 .align 210 .align 2
11 .globl __MINGW_USYMBOL(sincos)
12 .globl __MINGW_USYMBOL(sincosl)11 .globl __MINGW_USYMBOL(sincosl)
13 .def __MINGW_USYMBOL(sincos); .scl 2; .type 32; .endef
14 .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef12 .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
15__MINGW_USYMBOL(sincos):
16__MINGW_USYMBOL(sincosl):13__MINGW_USYMBOL(sincosl):
17 push {r4, r5, r11, lr}14 push {r4, r5, r11, lr}
18 add r11, sp, #815 add r11, sp, #8
lib/libc/mingw/math/arm/sincosf.S deleted-29
...@@ -1,29 +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 <_mingw_mac.h>
7
8 .file "sincosf.S"
9 .text
10 .align 2
11 .globl __MINGW_USYMBOL(sincosf)
12 .def __MINGW_USYMBOL(sincosf); .scl 2; .type 32; .endef
13__MINGW_USYMBOL(sincosf):
14 push {r4, r5, r11, lr}
15 add r11, sp, #8
16 vpush {d8}
17
18 mov r4, r0
19 mov r5, r1
20 vmov.f32 s16, s0
21 bl sinf
22 vstr s0, [r4]
23
24 vmov.f32 s0, s16
25 bl cosf
26 vstr s0, [r5]
27
28 vpop {d8}
29 pop {r4, r5, r11, pc}
lib/libc/mingw/math/arm64/sincos.S-3
...@@ -8,11 +8,8 @@...@@ -8,11 +8,8 @@
8 .file "sincos.S"8 .file "sincos.S"
9 .text9 .text
10 .align 210 .align 2
11 .globl __MINGW_USYMBOL(sincos)
12 .globl __MINGW_USYMBOL(sincosl)11 .globl __MINGW_USYMBOL(sincosl)
13 .def __MINGW_USYMBOL(sincos); .scl 2; .type 32; .endef
14 .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef12 .def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
15__MINGW_USYMBOL(sincos):
16__MINGW_USYMBOL(sincosl):13__MINGW_USYMBOL(sincosl):
17 str d8, [sp, #-32]!14 str d8, [sp, #-32]!
18 str x30, [sp, #8]15 str x30, [sp, #8]
lib/libc/mingw/math/arm64/sincosf.S deleted-31
...@@ -1,31 +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 <_mingw_mac.h>
7
8 .file "sincosf.S"
9 .text
10 .align 2
11 .globl __MINGW_USYMBOL(sincosf)
12 .def __MINGW_USYMBOL(sincosf); .scl 2; .type 32; .endef
13__MINGW_USYMBOL(sincosf):
14 str d8, [sp, #-32]!
15 str x30, [sp, #8]
16 stp x19, x20, [sp, #16]
17
18 mov x19, x0
19 mov x20, x1
20 fmov s8, s0
21 bl sinf
22 str s0, [x19]
23
24 fmov s0, s8
25 bl cosf
26 str s0, [x20]
27
28 ldp x19, x20, [sp, #16]
29 ldr x30, [sp, #8]
30 ldr d8, [sp], #32
31 ret
lib/libc/mingw/math/x86/cosf.c deleted-11
...@@ -1,11 +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
8float cosf(float _X)
9{
10 return ((float)cos((double)_X));
11}
lib/libc/mingw/math/x86/cossin.c deleted-52
...@@ -1,52 +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
7void sincos (double __x, double *p_sin, double *p_cos);
8void sincosf (float __x, float *p_sin, float *p_cos);
9
10void sincos (double __x, double *p_sin, double *p_cos)
11{
12 long double c, s;
13
14 __asm__ __volatile__ ("fsincos\n\t"
15 "fnstsw %%ax\n\t"
16 "testl $0x400, %%eax\n\t"
17 "jz 1f\n\t"
18 "fldpi\n\t"
19 "fadd %%st(0)\n\t"
20 "fxch %%st(1)\n\t"
21 "2: fprem1\n\t"
22 "fnstsw %%ax\n\t"
23 "testl $0x400, %%eax\n\t"
24 "jnz 2b\n\t"
25 "fstp %%st(1)\n\t"
26 "fsincos\n\t"
27 "1:" : "=t" (c), "=u" (s) : "0" (__x) : "eax");
28 *p_sin = (double) s;
29 *p_cos = (double) c;
30}
31
32void sincosf (float __x, float *p_sin, float *p_cos)
33{
34 long double c, s;
35
36 __asm__ __volatile__ ("fsincos\n\t"
37 "fnstsw %%ax\n\t"
38 "testl $0x400, %%eax\n\t"
39 "jz 1f\n\t"
40 "fldpi\n\t"
41 "fadd %%st(0)\n\t"
42 "fxch %%st(1)\n\t"
43 "2: fprem1\n\t"
44 "fnstsw %%ax\n\t"
45 "testl $0x400, %%eax\n\t"
46 "jnz 2b\n\t"
47 "fstp %%st(1)\n\t"
48 "fsincos\n\t"
49 "1:" : "=t" (c), "=u" (s) : "0" (__x) : "eax");
50 *p_sin = (float) s;
51 *p_cos = (float) c;
52}
lib/libc/mingw/math/x86/sinf.c deleted-11
...@@ -1,11 +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
8float sinf(float _X)
9{
10 return ((float) sin ((double) _X));
11}
lib/libc/mingw/math/x86/tanf.c deleted-11
...@@ -1,11 +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
8float tanf(float _X)
9{
10 return ((float)tan((double)_X));
11}
src/libs/mingw.zig-6
...@@ -916,7 +916,6 @@ const mingw32_x86_src = [_][]const u8{...@@ -916,7 +916,6 @@ const mingw32_x86_src = [_][]const u8{
916 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "copysignl.S",916 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "copysignl.S",
917 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl.c",917 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl.c",
918 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl_internal.S",918 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl_internal.S",
919 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossin.c",
920 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c",919 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c",
921 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S",920 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S",
922 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c",921 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c",
...@@ -965,11 +964,8 @@ const mingw32_x86_32_src = [_][]const u8{...@@ -965,11 +964,8 @@ const mingw32_x86_32_src = [_][]const u8{
965 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c",964 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c",
966 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanf.c",965 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanf.c",
967 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ceilf.S",966 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ceilf.S",
968 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosf.c",
969 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "floorf.S",967 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "floorf.S",
970 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c",968 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c",
971 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "sinf.c",
972 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "tanf.c",
973};969};
974970
975const mingw32_arm_src = [_][]const u8{971const mingw32_arm_src = [_][]const u8{
...@@ -983,7 +979,6 @@ const mingw32_arm32_src = [_][]const u8{...@@ -983,7 +979,6 @@ const mingw32_arm32_src = [_][]const u8{
983 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rint.c",979 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rint.c",
984 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rintf.c",980 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rintf.c",
985 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincos.S",981 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincos.S",
986 "math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincosf.S",
987};982};
988983
989const mingw32_arm64_src = [_][]const u8{984const mingw32_arm64_src = [_][]const u8{
...@@ -992,7 +987,6 @@ const mingw32_arm64_src = [_][]const u8{...@@ -992,7 +987,6 @@ const mingw32_arm64_src = [_][]const u8{
992 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",987 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",
993 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",988 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",
994 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincos.S",989 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincos.S",
995 "math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincosf.S",
996};990};
997991
998const mingw32_winpthreads_src = [_][]const u8{992const mingw32_winpthreads_src = [_][]const u8{