Author: tkreuzer
Date: Mon Mar 29 01:18:31 2010
New Revision: 46536
URL:
http://svn.reactos.org/svn/reactos?rev=46536&view=rev
Log:
[CRT]
- Implement x86 ceilf, floorf, fmodf (taken from mingw-w64)
- Implement cosf, sinf, sqrtf (simply wrappers)
- Fix missing definitions
Added:
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/ceilf.S (with props)
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/cosf.c (with props)
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/floorf.S (with props)
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/fmodf.c (with props)
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sinf.c (with props)
branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sqrtf.c (with props)
Modified:
branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild
branches/ros-amd64-bringup/reactos/lib/sdk/crt/float/fpclass.c
branches/ros-amd64-bringup/reactos/lib/sdk/crt/libcntpr.rbuild
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Mon Mar 29
01:18:31 2010
@@ -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>
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/float/fpclass.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/float/fpclass.c [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/float/fpclass.c [iso-8859-1] Mon Mar 29
01:18:31 2010
@@ -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;
Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/libcntpr.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1]
(original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] Mon Mar 29
01:18:31 2010
@@ -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>
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/ceilf.S
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/ceilf.S (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/ceilf.S [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,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
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/ceilf.S
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/cosf.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/cosf.c (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/cosf.c [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,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));
+}
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/cosf.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/floorf.S
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/floorf.S (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/floorf.S [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,0 +1,63 @@
+/*
+ * Written by J.T. Conklin <jtc(a)netbsd.org>rg>.
+ * Public domain.
+ *
+ * Changes for long double by Ulrich Drepper <drepper(a)cygnus.com>
+ *
+ * Removed header file dependency for use in libmingwex.a by
+ * Danny Smith <dannysmith(a)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
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/floorf.S
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/fmodf.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/fmodf.c (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/fmodf.c [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,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(a)netbsd.org>rg>.
+ * Public domain.
+ *
+ * Adapted for float type by Danny Smith
+ * <dannysmith(a)users.sourceforge.net>et>.
+ */
+
+#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;
+}
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/fmodf.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sinf.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sinf.c (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sinf.c [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,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));
+}
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sinf.c
------------------------------------------------------------------------------
svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sqrtf.c
URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/s…
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sqrtf.c (added)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sqrtf.c [iso-8859-1] Mon Mar
29 01:18:31 2010
@@ -1,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));
+}
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/i386/sqrtf.c
------------------------------------------------------------------------------
svn:eol-style = native