mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 14:55:25 +00:00
libc: replace MinGW's trigonometric functions with compiler_rt's
- sinf - cosf - sincos - sincosf - tanf
This commit is contained in:
parent
21d9e03758
commit
71ff3830df
@ -8,11 +8,8 @@
|
||||
.file "sincos.S"
|
||||
.text
|
||||
.align 2
|
||||
.globl __MINGW_USYMBOL(sincos)
|
||||
.globl __MINGW_USYMBOL(sincosl)
|
||||
.def __MINGW_USYMBOL(sincos); .scl 2; .type 32; .endef
|
||||
.def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincos):
|
||||
__MINGW_USYMBOL(sincosl):
|
||||
push {r4, r5, r11, lr}
|
||||
add r11, sp, #8
|
||||
|
||||
@ -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.
|
||||
*/
|
||||
#include <_mingw_mac.h>
|
||||
|
||||
.file "sincosf.S"
|
||||
.text
|
||||
.align 2
|
||||
.globl __MINGW_USYMBOL(sincosf)
|
||||
.def __MINGW_USYMBOL(sincosf); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincosf):
|
||||
push {r4, r5, r11, lr}
|
||||
add r11, sp, #8
|
||||
vpush {d8}
|
||||
|
||||
mov r4, r0
|
||||
mov r5, r1
|
||||
vmov.f32 s16, s0
|
||||
bl sinf
|
||||
vstr s0, [r4]
|
||||
|
||||
vmov.f32 s0, s16
|
||||
bl cosf
|
||||
vstr s0, [r5]
|
||||
|
||||
vpop {d8}
|
||||
pop {r4, r5, r11, pc}
|
||||
@ -8,11 +8,8 @@
|
||||
.file "sincos.S"
|
||||
.text
|
||||
.align 2
|
||||
.globl __MINGW_USYMBOL(sincos)
|
||||
.globl __MINGW_USYMBOL(sincosl)
|
||||
.def __MINGW_USYMBOL(sincos); .scl 2; .type 32; .endef
|
||||
.def __MINGW_USYMBOL(sincosl); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincos):
|
||||
__MINGW_USYMBOL(sincosl):
|
||||
str d8, [sp, #-32]!
|
||||
str x30, [sp, #8]
|
||||
|
||||
@ -1,31 +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.
|
||||
*/
|
||||
#include <_mingw_mac.h>
|
||||
|
||||
.file "sincosf.S"
|
||||
.text
|
||||
.align 2
|
||||
.globl __MINGW_USYMBOL(sincosf)
|
||||
.def __MINGW_USYMBOL(sincosf); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincosf):
|
||||
str d8, [sp, #-32]!
|
||||
str x30, [sp, #8]
|
||||
stp x19, x20, [sp, #16]
|
||||
|
||||
mov x19, x0
|
||||
mov x20, x1
|
||||
fmov s8, s0
|
||||
bl sinf
|
||||
str s0, [x19]
|
||||
|
||||
fmov s0, s8
|
||||
bl cosf
|
||||
str s0, [x20]
|
||||
|
||||
ldp x19, x20, [sp, #16]
|
||||
ldr x30, [sp, #8]
|
||||
ldr d8, [sp], #32
|
||||
ret
|
||||
@ -1,11 +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.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float cosf(float _X)
|
||||
{
|
||||
return ((float)cos((double)_X));
|
||||
}
|
||||
@ -1,52 +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.
|
||||
*/
|
||||
|
||||
void sincos (double __x, double *p_sin, double *p_cos);
|
||||
void sincosf (float __x, float *p_sin, float *p_cos);
|
||||
|
||||
void sincos (double __x, double *p_sin, double *p_cos)
|
||||
{
|
||||
long double c, s;
|
||||
|
||||
__asm__ __volatile__ ("fsincos\n\t"
|
||||
"fnstsw %%ax\n\t"
|
||||
"testl $0x400, %%eax\n\t"
|
||||
"jz 1f\n\t"
|
||||
"fldpi\n\t"
|
||||
"fadd %%st(0)\n\t"
|
||||
"fxch %%st(1)\n\t"
|
||||
"2: fprem1\n\t"
|
||||
"fnstsw %%ax\n\t"
|
||||
"testl $0x400, %%eax\n\t"
|
||||
"jnz 2b\n\t"
|
||||
"fstp %%st(1)\n\t"
|
||||
"fsincos\n\t"
|
||||
"1:" : "=t" (c), "=u" (s) : "0" (__x) : "eax");
|
||||
*p_sin = (double) s;
|
||||
*p_cos = (double) c;
|
||||
}
|
||||
|
||||
void sincosf (float __x, float *p_sin, float *p_cos)
|
||||
{
|
||||
long double c, s;
|
||||
|
||||
__asm__ __volatile__ ("fsincos\n\t"
|
||||
"fnstsw %%ax\n\t"
|
||||
"testl $0x400, %%eax\n\t"
|
||||
"jz 1f\n\t"
|
||||
"fldpi\n\t"
|
||||
"fadd %%st(0)\n\t"
|
||||
"fxch %%st(1)\n\t"
|
||||
"2: fprem1\n\t"
|
||||
"fnstsw %%ax\n\t"
|
||||
"testl $0x400, %%eax\n\t"
|
||||
"jnz 2b\n\t"
|
||||
"fstp %%st(1)\n\t"
|
||||
"fsincos\n\t"
|
||||
"1:" : "=t" (c), "=u" (s) : "0" (__x) : "eax");
|
||||
*p_sin = (float) s;
|
||||
*p_cos = (float) c;
|
||||
}
|
||||
@ -1,11 +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.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float sinf(float _X)
|
||||
{
|
||||
return ((float) sin ((double) _X));
|
||||
}
|
||||
@ -1,11 +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.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
||||
float tanf(float _X)
|
||||
{
|
||||
return ((float)tan((double)_X));
|
||||
}
|
||||
@ -916,7 +916,6 @@ const mingw32_x86_src = [_][]const u8{
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "copysignl.S",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosl_internal.S",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossin.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c",
|
||||
@ -965,11 +964,8 @@ const mingw32_x86_32_src = [_][]const u8{
|
||||
"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 ++ "ceilf.S",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cosf.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "floorf.S",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fmodf.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "sinf.c",
|
||||
"math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "tanf.c",
|
||||
};
|
||||
|
||||
const mingw32_arm_src = [_][]const u8{
|
||||
@ -983,7 +979,6 @@ const mingw32_arm32_src = [_][]const u8{
|
||||
"math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rint.c",
|
||||
"math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "s_rintf.c",
|
||||
"math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincos.S",
|
||||
"math" ++ path.sep_str ++ "arm" ++ path.sep_str ++ "sincosf.S",
|
||||
};
|
||||
|
||||
const mingw32_arm64_src = [_][]const u8{
|
||||
@ -992,7 +987,6 @@ const mingw32_arm64_src = [_][]const u8{
|
||||
"math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rint.c",
|
||||
"math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "rintf.c",
|
||||
"math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincos.S",
|
||||
"math" ++ path.sep_str ++ "arm64" ++ path.sep_str ++ "sincosf.S",
|
||||
};
|
||||
|
||||
const mingw32_winpthreads_src = [_][]const u8{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user