- Add #pragma function to a number of intrisics that we implement to avoid a compiler error of MSVC
- Add a workaround to prevent some functions from being inlined
- Move sqrtf out of i386 directory
- Convert a number of inline assembly functions to raw assembly
svn path=/branches/cmake-bringup/; revision=49534
math/logf.c
math/modf.c
math/rand.c
+ math/sqrtf.c
math/s_modf.c
math/sinf.c
math/sinh.c
math/i386/sin_asm.s
math/i386/sqrt_asm.s
math/i386/tan_asm.s
- math/i386/atan2.c
+ math/i386/atan2_asm.s
math/i386/ci.c
- math/i386/exp.c
- math/i386/fmod.c
- math/i386/fmodf.c
+ math/i386/exp_asm.s
+ math/i386/fmod_asm.s
+ math/i386/fmodf_asm.s
math/i386/ldexp.c
- math/i386/sqrtf.c
mem/i386/memchr_asm.s
mem/i386/memmove_asm.s
mem/i386/memset_asm.s
#include <math.h>
+#ifdef _MSC_VER
+#pragma function(acos)
+#endif
double acos(double __x)
{
#include <math.h>
+#ifdef _MSC_VER
+#pragma function(asin)
+#endif
double asin(double __x)
{
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#define cosf _dummy_cosf
#include <math.h>
+#undef cosf
float cosf(float _X)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
+#ifdef _MSC_VER
+#pragma function(cosh)
+#endif
/*
* @implemented
+++ /dev/null
-
-#include <math.h>
-
-double atan2 (double __y, double __x);
-
-/*
- * @implemented
- */
-double atan2 (double __y, double __x)
-{
- register double __val;
-#ifdef __GNUC__
- __asm __volatile__
- ("fpatan\n\t"
- "fld %%st(0)"
- : "=t" (__val) : "0" (__x), "u" (__y));
-#else
- __asm
- {
- fld __y
- fld __x
- fpatan
- fstp __val
- }
-#endif /*__GNUC__*/
- return __val;
-}
--- /dev/null
+
+#include <reactos/asm.h>
+
+PUBLIC _atan2
+
+.code
+_atan2:
+ push ebp
+ mov ebp, esp
+
+ fld qword ptr [ebp + 8]
+ fld qword ptr [ebp + 16]
+ fpatan
+
+ pop ebp
+ retn
+
+END
+++ /dev/null
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <math.h>
-
-double exp (double __x);
-
-double exp (double __x)
-{
-#ifdef __GNUC__
- register double __value, __exponent;
- __asm __volatile__
- ("fldl2e # e^x = 2^(x * log2(e))\n\t"
- "fmul %%st(1) # x * log2(e)\n\t"
- "fst %%st(1)\n\t"
- "frndint # int(x * log2(e))\n\t"
- "fxch\n\t"
- "fsub %%st(1) # fract(x * log2(e))\n\t"
- "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
- : "=t" (__value), "=u" (__exponent) : "0" (__x));
- __value += 1.0;
- __asm __volatile__
- ("fscale"
- : "=t" (__value) : "0" (__value), "u" (__exponent));
-
- return __value;
-#else
- register double __val;
- __asm
- {
- fld1 // store 1.0 for later use
- fld __x
- fldl2e // e^x = 2^(x * log2(e))
- fmul st,st(1) // x * log2(e)
- fld st(0)
- frndint // int(x * log2(e))
- fsub st,st(1) // fract(x * log2(e))
- fxch
- f2xm1 // 2^(fract(x * log2(e))) - 1
- fadd st,st(3) // + 1.0
- fscale
- fstp __val
- }
- return __val;
-#endif /*__GNUC__*/
-}
--- /dev/null
+
+#include <reactos/asm.h>
+
+PUBLIC _exp
+
+/* FUNCTIONS ***************************************************************/
+.code
+
+_exp:
+ push ebp
+ mov ebp, esp
+
+ fld qword ptr [ebp + 8]
+ fldl2e
+ fmul st, st(1)
+ fst st(1)
+ frndint
+ fxch st(1)
+ fsub st, st(1)
+ f2xm1
+ fld1
+ faddp st(1), st
+ fscale
+ fstp st(1)
+
+ pop ebp
+ retn
+
+END
+++ /dev/null
-/* Math functions for i387.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by John C. Bowman <bowman@ipp-garching.mpg.de>, 1995.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include <math.h>
-
-double fmod (double __x, double __y);
-
-double fmod (double __x, double __y)
-{
- register double __val;
-#ifdef __GNUC__
- __asm __volatile__
- ("1: fprem\n\t"
- "fstsw %%ax\n\t"
- "sahf\n\t"
- "jp 1b"
- : "=t" (__val) : "0" (__x), "u" (__y) : "ax", "cc");
-#else
- __asm
- {
- fld __y
- fld __x
-L1: fprem1
- fstsw ax
- sahf
- jp L1
- fstp __val
- }
-#endif /*__GNUC__*/
- return __val;
-}
--- /dev/null
+
+#include <reactos/asm.h>
+
+PUBLIC _fmod
+
+/* FUNCTIONS ***************************************************************/
+.code
+
+_fmod:
+ push ebp
+ mov ebp, esp
+
+ fld qword ptr [ebp + 8]
+ fld qword ptr [ebp + 16]
+ fxch st(1)
+l1:
+ fprem
+ fstsw ax
+ sahf
+ jp l1
+ fstp st(1)
+
+ pop ebp
+ ret
+
+END
+++ /dev/null
-/**
- * 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;
-}
--- /dev/null
+
+#include <reactos/asm.h>
+
+PUBLIC _fmodf
+
+/* FUNCTIONS ***************************************************************/
+.code
+
+_fmodf:
+ push ebp
+ mov ebp, esp
+
+ fld dword ptr [esp + 4]
+ fld dword ptr [esp + 8]
+ fxch st(1)
+l1:
+ fprem
+ fstsw ax
+ sahf
+ jp l1
+ fstp st(1)
+
+ pop ebp
+ ret
+
+END
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#define logf _dummy_logf
#include <math.h>
+#undef logf
float logf(float _X)
{
* is preserved.
* ====================================================
*/
-
+#define modfl _dummy_modfl
#include <precomp.h>
+#undef modfl
//static const double one = 1.0;
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER.PD within this package.
*/
+#define sinf _dummy_sinf
#include <math.h>
+#undef sinf
float sinf(float _X)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <math.h>
+#ifdef _MSC_VER
+#pragma function(sinh)
+#endif
+
/*
* @implemented
*/
#include <math.h>
float
-sqrtf(float x)
+_sqrtf(float x)
{
return ((float)sqrt((double)x));
}
#include <math.h>
+#ifdef _MSC_VER
+#pragma function(tanh)
+#endif
+
/*
* @implemented
*/