mirror of
https://git.code.sf.net/p/mingw-w64/mingw-w64
synced 2025-04-18 17:44:18 +03:00
crt: Implement sincos in C.
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
57ec2cff5f
commit
3d15f5e160
@ -465,6 +465,8 @@ src_ucrtbase32=\
|
||||
math/logf.c \
|
||||
math/modff.c \
|
||||
math/powf.c \
|
||||
math/sincos.c \
|
||||
math/sincosf.c \
|
||||
math/sinhf.c \
|
||||
math/sqrtf.c \
|
||||
math/tanhf.c \
|
||||
@ -476,8 +478,6 @@ src_ucrtbase32=\
|
||||
math/x86/cosf.c \
|
||||
math/x86/floorf.S \
|
||||
math/x86/fmodf.c \
|
||||
math/x86/sincos.S \
|
||||
math/x86/sincosf.S \
|
||||
math/x86/sinf.c \
|
||||
math/x86/tanf.c
|
||||
|
||||
@ -487,8 +487,8 @@ src_ucrtbase64=\
|
||||
math/fabsf.c \
|
||||
math/nextafterl.c \
|
||||
math/nexttoward.c math/nexttowardf.c \
|
||||
math/x86/sincos.S \
|
||||
math/x86/sincosf.S
|
||||
math/sincos.c \
|
||||
math/sincosf.c
|
||||
|
||||
# Files included in libucrt*.a on arm32
|
||||
src_ucrtbasearm32=\
|
||||
@ -1058,6 +1058,9 @@ src_libmingwex64=$(src_libmingwex_x86)
|
||||
|
||||
# these only go into the ARM32 version:
|
||||
src_libmingwexarm32=\
|
||||
math/sincos.c \
|
||||
math/sincosf.c \
|
||||
math/arm-common/sincosl.c \
|
||||
math/arm/s_rint.c math/arm/s_rintf.c
|
||||
|
||||
if ENABLE_SOFTMATH
|
||||
@ -1076,17 +1079,19 @@ src_libmingwexarm32+=\
|
||||
math/softmath/powl.c \
|
||||
math/softmath/remainder.c math/softmath/remainderf.c math/softmath/remainderl.c \
|
||||
math/softmath/remquo.c math/softmath/remquof.c math/softmath/remquol.c math/softmath/scalbn.c math/softmath/scalbnf.c \
|
||||
math/softmath/scalbnl.c math/softmath/sin.c math/softmath/sincos.c math/softmath/sincosf.c math/softmath/sincosl.c \
|
||||
math/softmath/scalbnl.c math/softmath/sin.c \
|
||||
math/softmath/sinf.c math/softmath/sinl.c math/softmath/tanf.c math/softmath/tanl.c
|
||||
else
|
||||
src_libmingwexarm32+=\
|
||||
math/arm-common/ldexpl.c math/arm/sincos.S math/arm/sincosf.S
|
||||
math/arm-common/ldexpl.c
|
||||
endif
|
||||
|
||||
# these only go into the ARM64 version:
|
||||
src_libmingwexarm64=\
|
||||
math/sincos.c \
|
||||
math/sincosf.c \
|
||||
math/arm-common/sincosl.c \
|
||||
math/arm64/rint.c math/arm64/rintf.c \
|
||||
math/arm64/sincos.S math/arm64/sincosf.S \
|
||||
math/arm-common/ldexpl.c
|
||||
|
||||
|
||||
|
13
mingw-w64-crt/math/arm-common/sincosl.c
Normal file
13
mingw-w64-crt/math/arm-common/sincosl.c
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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>
|
||||
|
||||
void sincosl(long double x, long double *s, long double *c)
|
||||
{
|
||||
*s = sinl(x);
|
||||
*c = cosl(x);
|
||||
}
|
@ -1,32 +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 "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
|
||||
vpush {d8}
|
||||
|
||||
mov r4, r0
|
||||
mov r5, r1
|
||||
vmov.f64 d8, d0
|
||||
bl sin
|
||||
vstr d0, [r4]
|
||||
|
||||
vmov.f64 d0, d8
|
||||
bl cos
|
||||
vstr d0, [r5]
|
||||
|
||||
vpop {d8}
|
||||
pop {r4, r5, r11, pc}
|
@ -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}
|
@ -1,34 +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 "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]
|
||||
stp x19, x20, [sp, #16]
|
||||
|
||||
mov x19, x0
|
||||
mov x20, x1
|
||||
fmov d8, d0
|
||||
bl sin
|
||||
str d0, [x19]
|
||||
|
||||
fmov d0, d8
|
||||
bl cos
|
||||
str d0, [x20]
|
||||
|
||||
ldp x19, x20, [sp, #16]
|
||||
ldr x30, [sp, #8]
|
||||
ldr d8, [sp], #32
|
||||
ret
|
@ -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
|
13
mingw-w64-crt/math/sincos.c
Normal file
13
mingw-w64-crt/math/sincos.c
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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>
|
||||
|
||||
void sincos(double x, double *s, double *c)
|
||||
{
|
||||
*s = sin(x);
|
||||
*c = cos(x);
|
||||
}
|
13
mingw-w64-crt/math/sincosf.c
Normal file
13
mingw-w64-crt/math/sincosf.c
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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>
|
||||
|
||||
void sincosf(float x, float *s, float *c)
|
||||
{
|
||||
*s = sinf(x);
|
||||
*c = cosf(x);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
This Software is provided under the Zope Public License (ZPL) Version 2.1.
|
||||
|
||||
Copyright (c) 2014 by the mingw-w64 project
|
||||
|
||||
See the AUTHORS file for the list of contributors to the mingw-w64 project.
|
||||
|
||||
This license has been certified as open source. It has also been designated
|
||||
as GPL compatible by the Free Software Foundation (FSF).
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions in source code must retain the accompanying copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the accompanying
|
||||
copyright notice, this list of conditions, and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Names of the copyright holders must not be used to endorse or promote
|
||||
products derived from this software without prior written permission
|
||||
from the copyright holders.
|
||||
4. The right to distribute this software or to use it for any purpose does
|
||||
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
|
||||
the copyright holders. Use of them is covered by separate agreement
|
||||
with the copyright holders.
|
||||
5. If any files are modified, you must cause the modified files to carry
|
||||
prominent notices stating that you changed the files and the date of
|
||||
any change.
|
||||
|
||||
Disclaimer
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "softmath_private.h"
|
||||
|
||||
void sincos(double x, double *s, double *c)
|
||||
{
|
||||
if (s) *s = sin(x);
|
||||
if (c) *c = cos(x);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
This Software is provided under the Zope Public License (ZPL) Version 2.1.
|
||||
|
||||
Copyright (c) 2014 by the mingw-w64 project
|
||||
|
||||
See the AUTHORS file for the list of contributors to the mingw-w64 project.
|
||||
|
||||
This license has been certified as open source. It has also been designated
|
||||
as GPL compatible by the Free Software Foundation (FSF).
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions in source code must retain the accompanying copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the accompanying
|
||||
copyright notice, this list of conditions, and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Names of the copyright holders must not be used to endorse or promote
|
||||
products derived from this software without prior written permission
|
||||
from the copyright holders.
|
||||
4. The right to distribute this software or to use it for any purpose does
|
||||
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
|
||||
the copyright holders. Use of them is covered by separate agreement
|
||||
with the copyright holders.
|
||||
5. If any files are modified, you must cause the modified files to carry
|
||||
prominent notices stating that you changed the files and the date of
|
||||
any change.
|
||||
|
||||
Disclaimer
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "softmath_private.h"
|
||||
|
||||
void sincosf(float x, float *s, float *c)
|
||||
{
|
||||
if (s) *s = sinf(x);
|
||||
if (c) *c = cosf(x);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
This Software is provided under the Zope Public License (ZPL) Version 2.1.
|
||||
|
||||
Copyright (c) 2014 by the mingw-w64 project
|
||||
|
||||
See the AUTHORS file for the list of contributors to the mingw-w64 project.
|
||||
|
||||
This license has been certified as open source. It has also been designated
|
||||
as GPL compatible by the Free Software Foundation (FSF).
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions in source code must retain the accompanying copyright
|
||||
notice, this list of conditions, and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the accompanying
|
||||
copyright notice, this list of conditions, and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
3. Names of the copyright holders must not be used to endorse or promote
|
||||
products derived from this software without prior written permission
|
||||
from the copyright holders.
|
||||
4. The right to distribute this software or to use it for any purpose does
|
||||
not give you the right to use Servicemarks (sm) or Trademarks (tm) of
|
||||
the copyright holders. Use of them is covered by separate agreement
|
||||
with the copyright holders.
|
||||
5. If any files are modified, you must cause the modified files to carry
|
||||
prominent notices stating that you changed the files and the date of
|
||||
any change.
|
||||
|
||||
Disclaimer
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "softmath_private.h"
|
||||
|
||||
void sincosl(long double x, long double *s, long double *c)
|
||||
{
|
||||
if (s) *s = sinl(x);
|
||||
if (c) *c = cosl(x);
|
||||
}
|
@ -1,47 +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 "sincos.S"
|
||||
.text
|
||||
.p2align 4
|
||||
.globl __MINGW_USYMBOL(sincos)
|
||||
.def __MINGW_USYMBOL(sincos); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincos):
|
||||
#ifdef __x86_64__
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
subq $56, %rsp
|
||||
movaps %xmm6, 32(%rsp)
|
||||
movq %r8, %rsi
|
||||
movq %rdx, %rdi
|
||||
movaps %xmm0, %xmm6
|
||||
call sin
|
||||
movsd %xmm0, (%rdi)
|
||||
movaps %xmm6, %xmm0
|
||||
call cos
|
||||
movsd %xmm0, (%rsi)
|
||||
movaps 32(%rsp), %xmm6
|
||||
addq $56, %rsp
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
retq
|
||||
#else
|
||||
subl $44, %esp
|
||||
fldl 48(%esp)
|
||||
fstl (%esp)
|
||||
fstpl 24(%esp)
|
||||
call _sin
|
||||
movl 56(%esp), %eax
|
||||
fstpl (%eax)
|
||||
fldl 24(%esp)
|
||||
fstpl (%esp)
|
||||
call _cos
|
||||
movl 60(%esp), %eax
|
||||
fstpl (%eax)
|
||||
addl $44, %esp
|
||||
ret
|
||||
#endif
|
@ -1,46 +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
|
||||
.p2align 4
|
||||
.globl __MINGW_USYMBOL(sincosf)
|
||||
.def __MINGW_USYMBOL(sincosf); .scl 2; .type 32; .endef
|
||||
__MINGW_USYMBOL(sincosf):
|
||||
#ifdef __x86_64__
|
||||
pushq %rsi
|
||||
pushq %rdi
|
||||
subq $56, %rsp
|
||||
movaps %xmm6, 32(%rsp)
|
||||
movq %r8, %rsi
|
||||
movq %rdx, %rdi
|
||||
movaps %xmm0, %xmm6
|
||||
call sinf
|
||||
movss %xmm0, (%rdi)
|
||||
movaps %xmm6, %xmm0
|
||||
call cosf
|
||||
movss %xmm0, (%rsi)
|
||||
movaps 32(%rsp), %xmm6
|
||||
addq $56, %rsp
|
||||
popq %rdi
|
||||
popq %rsi
|
||||
retq
|
||||
#else
|
||||
subl $28, %esp
|
||||
flds 32(%esp)
|
||||
fstps (%esp)
|
||||
call _sinf
|
||||
movl 36(%esp), %eax
|
||||
fstps (%eax)
|
||||
flds 32(%esp)
|
||||
fstps (%esp)
|
||||
call _cosf
|
||||
movl 40(%esp), %eax
|
||||
fstps (%eax)
|
||||
addl $28, %esp
|
||||
ret
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user