- Implement x86 ceilf, floorf, fmodf (taken from mingw-w64)
- Implement cosf, sinf, sqrtf (simply wrappers)
- Fix missing definitions

svn path=/branches/ros-amd64-bringup/; revision=46536
This commit is contained in:
Timo Kreuzer 2010-03-28 23:18:31 +00:00
parent ed6508cf95
commit b8a5d2b45c
9 changed files with 190 additions and 2 deletions

View file

@ -26,6 +26,7 @@
<define name="_MSVCRT_" />
<define name="_MT" />
<define name="_CRTBLD" />
<define name="__CRT__NO_INLINE" />
<directory name="conio">
<file>cgets.c</file>
<file>cprintf.c</file>
@ -140,9 +141,11 @@
<file>aullrem_asm.s</file>
<file>aullshr_asm.s</file>
<file>ceil_asm.s</file>
<file>ceilf.S</file>
<file>cos_asm.s</file>
<file>fabs_asm.s</file>
<file>floor_asm.s</file>
<file>floorf.S</file>
<file>ftol_asm.s</file>
<file>log_asm.s</file>
<file>log10_asm.s</file>
@ -153,9 +156,13 @@
<file>atan2.c</file>
<file>ci.c</file>
<file>cosf.c</file>
<file>exp.c</file>
<file>fmod.c</file>
<file>fmodf.c</file>
<file>ldexp.c</file>
<file>sinf.c</file>
<file>sqrtf.c</file>
</directory>
<!-- FIXME: we don't actually implement these... they recursively call themselves through an alias -->
<!--<file>j0_y0.c</file>

View file

@ -25,7 +25,7 @@
#define _FPCLASS_PINF 0x0200 /* positive infinity */
#if __MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION < 3
//#if __MINGW32_MAJOR_VERSION < 3 || __MINGW32_MINOR_VERSION < 3
#define FP_SNAN 0x0001 // signaling NaN
#define FP_QNAN 0x0002 // quiet NaN
@ -38,7 +38,7 @@
#define FP_NNORM 0x0080 // negative normalized non-zero
#define FP_PNORM 0x0100 // positive normalized non-zero
#endif
//#endif
typedef int fpclass_t;

View file

@ -8,6 +8,7 @@
<define name="_NTDLLBUILD_" />
<define name="_LIBCNT_" />
<define name="_CRTBLD" />
<define name="__CRT__NO_INLINE" />
<if property="ARCH" value="i386">
<define name="__MINGW_IMPORT">"extern __attribute__ ((dllexport))"</define>
</if>

View file

@ -0,0 +1,55 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <_mingw_mac.h>
.file "ceilf.S"
.text
.align 4
.globl __MINGW_USYMBOL(ceilf)
.def __MINGW_USYMBOL(ceilf); .scl 2; .type 32; .endef
__MINGW_USYMBOL(ceilf):
#ifdef _WIN64
subq $24,%rsp
movss %xmm0,8(%rsp)
flds 8(%rsp)
fstcw 4(%rsp) /* store fpu control word */
movl $0x0800,%edx /* round towards +oo */
orl 4(%rsp),%edx
andl $0xfbff,%edx
movl %edx,(%rsp)
fldcw (%rsp) /* load modified control word */
frndint /* round */
fldcw 4(%rsp) /* restore original control word */
fstps 8(%rsp)
movss 8(%rsp),%xmm0
addq $24,%rsp
ret
#else
flds 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x0800,%edx /* round towards +oo */
orl 4(%esp),%edx
andl $0xfbff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -0,0 +1,11 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-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));
}

View file

@ -0,0 +1,63 @@
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*
* Changes for long double by Ulrich Drepper <drepper@cygnus.com>
*
* Removed header file dependency for use in libmingwex.a by
* Danny Smith <dannysmith@users.sourceforge.net>
*/
#include <_mingw_mac.h>
.file "floorf.S"
.text
#ifdef _WIN64
.align 8
#else
.align 4
#endif
.globl __MINGW_USYMBOL(floorf)
.def __MINGW_USYMBOL(floorf); .scl 2; .type 32; .endef
__MINGW_USYMBOL(floorf):
#ifdef _WIN64
subq $24,%rsp
movss %xmm0,8(%rsp)
flds 8(%rsp)
fstcw 4(%rsp) /* store fpu control word */
movl $0x400,%edx /* round towards -oo */
orl 4(%rsp),%edx
andl $0xf7ff,%edx
movl %edx,(%rsp)
fldcw (%rsp) /* load modified control word */
frndint /* round */
fldcw 4(%rsp) /* restore original control word */
fstps 8(%rsp)
movss 8(%rsp),%xmm0
addq $24,%rsp
ret
#else
flds 4(%esp)
subl $8,%esp
fstcw 4(%esp) /* store fpu control word */
/* We use here %edx although only the low 1 bits are defined.
But none of the operations should care and they are faster
than the 16 bit operations. */
movl $0x400,%edx /* round towards -oo */
orl 4(%esp),%edx
andl $0xf7ff,%edx
movl %edx,(%esp)
fldcw (%esp) /* load modified control word */
frndint /* round */
fldcw 4(%esp) /* restore original control word */
addl $8,%esp
ret
#endif

View file

@ -0,0 +1,28 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-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 ("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;
}

View file

@ -0,0 +1,11 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-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));
}

View file

@ -0,0 +1,12 @@
/**
* This file has no copyright assigned and is placed in the Public Domain.
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
#include <math.h>
float
sqrtf(float x)
{
return ((float)sqrt((double)x));
}