Author: tkreuzer Date: Wed Jul 21 16:03:44 2010 New Revision: 48161
URL: http://svn.reactos.org/svn/reactos?rev=48161&view=rev Log: [CRT] - Add a number of amd64 specific math functions - add generic c versions of cos and sin - Remove leading underscores from amd64 symbols
Added: trunk/reactos/lib/sdk/crt/math/amd64/ (with props) trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/atan.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/atan2.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/ceil.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/exp.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/fabs.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/floor.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/floorf.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/fmod.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/log.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/log10.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/pow.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S (with props) trunk/reactos/lib/sdk/crt/math/amd64/tan.S (with props) trunk/reactos/lib/sdk/crt/math/cos.c (with props) trunk/reactos/lib/sdk/crt/math/cosf.c (with props) trunk/reactos/lib/sdk/crt/math/i386/ceilf.S (with props) trunk/reactos/lib/sdk/crt/math/i386/floorf.S (with props) trunk/reactos/lib/sdk/crt/math/i386/fmodf.c (with props) trunk/reactos/lib/sdk/crt/math/i386/sqrtf.c (with props) trunk/reactos/lib/sdk/crt/math/sin.c (with props) trunk/reactos/lib/sdk/crt/math/sinf.c (with props) Modified: trunk/reactos/lib/sdk/crt/crt.rbuild trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s trunk/reactos/lib/sdk/crt/except/amd64/seh.s trunk/reactos/lib/sdk/crt/libcntpr.rbuild
Modified: trunk/reactos/lib/sdk/crt/crt.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.rbuild?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -113,6 +113,7 @@ <file>adjust.c</file> <file>asin.c</file> <file>cabs.c</file> + <file>cosf.c</file> <file>cosh.c</file> <file>div.c</file> <file>fdivbug.c</file> @@ -123,6 +124,7 @@ <file>modf.c</file> <file>rand.c</file> <file>s_modf.c</file> + <file>sinf.c</file> <file>sinh.c</file> <file>tanh.c</file> <file>pow_asm.c</file> @@ -141,9 +143,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> @@ -156,7 +160,9 @@ <file>ci.c</file> <file>exp.c</file> <file>fmod.c</file> + <file>fmodf.c</file> <file>ldexp.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> @@ -164,11 +170,27 @@ <file>jn_yn.c</file>--> </if> <if property="ARCH" value="amd64"> - <directory name="i386"> - <file>atan2.c</file> - <file>exp.c</file> - <file>fmod.c</file> - <file>ldexp.c</file> + <file>cos.c</file> + <file>sin.c</file> + <directory name="amd64"> + <file>alldiv.S</file> + <file>atan.S</file> + <file>atan2.S</file> + <file>ceil.S</file> + <file>ceilf.S</file> + <file>exp.S</file> + <file>fabs.S</file> + <file>floor.S</file> + <file>floorf.S</file> + <file>fmod.S</file> + <file>fmodf.S</file> + <file>ldexp.S</file> + <file>log.S</file> + <file>log10.S</file> + <file>pow.S</file> + <file>sqrt.S</file> + <file>sqrtf.S</file> + <file>tan.S</file> </directory> <!-- FIXME: we don't actually implement these... they recursively call themselves through an alias --> <!--<file>j0_y0.c</file>
Modified: trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/ch... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/except/amd64/chkstk_asm.s [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -8,24 +8,23 @@
/* INCLUDES ******************************************************************/
-#include <ndk/amd64/asm.h> -#include <ndk/amd64/asmmacro.S> +#include <reactos/asm.h>
.intel_syntax noprefix
-.global _MsgUnimplemented -_MsgUnimplemented: +.global MsgUnimplemented +MsgUnimplemented: .asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n"
.proc _chkstk UNIMPLEMENTED chkstk ret -.endproc +.endp
.proc _alloca_probe UNIMPLEMENTED alloca_probe ret -.endproc +.endp
/* EOF */
Modified: trunk/reactos/lib/sdk/crt/except/amd64/seh.s URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/amd64/se... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/amd64/seh.s [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/except/amd64/seh.s [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -25,7 +25,7 @@
/* FUNCTIONS *****************************************************************/
-.func unwind_handler +.func _unwind_handler _unwind_handler: ret .endfunc
Modified: trunk/reactos/lib/sdk/crt/libcntpr.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/libcntpr.rbuild... ============================================================================== --- trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] Wed Jul 21 16:03:44 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> @@ -57,6 +58,26 @@ <file>sin_asm.s</file> <file>sqrt_asm.s</file> <file>tan_asm.s</file> + </directory> + </if> + <if property="ARCH" value="amd64"> + <file>cos.c</file> + <file>sin.c</file> + <directory name="amd64"> + <file>alldiv.S</file> + <file>atan.S</file> + <file>atan2.S</file> + <file>ceil.S</file> + <file>exp.S</file> + <file>fabs.S</file> + <file>floor.S</file> + <file>fmod.S</file> + <file>ldexp.S</file> + <file>log.S</file> + <file>log10.S</file> + <file>pow.S</file> + <file>sqrt.S</file> + <file>tan.S</file> </directory> </if> <file>abs.c</file>
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Jul 21 16:03:44 2010 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+)
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details.
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ ------------------------------------------------------------------------------ bugtraq:url = http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
Added: trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/alld... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,28 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of alldiv + * FILE: lib/sdk/crt/math/amd64/alldiv.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC _fltused +_fltused: + .long 0x9875 + +/* FUNCTIONS ****************************************************************/ + +.code64 + +.proc alldiv + UNIMPLEMENTED alldiv + ret + +.endp alldiv
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/alldiv.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/atan.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/atan... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/atan.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/atan.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of atan + * FILE: lib/sdk/crt/math/amd64/atan.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC atan +atan: + UNIMPLEMENTED atan + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/atan.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/atan2.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/atan... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/atan2.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/atan2.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of atan2 + * FILE: lib/sdk/crt/math/amd64/atan2.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC atan2 +atan2: + UNIMPLEMENTED atan2 + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/atan2.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/ceil.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ceil... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/ceil.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/ceil.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of ceil + * FILE: lib/sdk/crt/math/amd64/ceil.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC ceil +ceil: + UNIMPLEMENTED ceil + ret +
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ceil.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ceil... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,40 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/ceilf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC ceilf +ceilf: + /* Put parameter on the stack */ + movss [rsp - 0x10], xmm0 + fld dword ptr [rsp] + + /* Change fpu control word to round up */ + fstcw [rsp - 0x10] + mov eax, [rsp - 0x10] + or eax, 0x00800 + and eax, 0x0fbff + mov [rsp - 0x08], eax + fldcw [rsp - 0x08] + + /* Round to integer */ + frndint + + /* Restore fpu control word */ + fldcw [rsp - 0x10] + + fstp dword ptr [rsp - 0x10] + movss xmm0, [rsp - 0x10] + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ceilf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/exp.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/exp.... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/exp.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/exp.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of exp + * FILE: lib/sdk/crt/math/amd64/exp.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC exp +exp: + UNIMPLEMENTED exp + ret +
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/exp.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/fabs.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fabs... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/fabs.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/fabs.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,22 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fabs + * FILE: lib/sdk/crt/math/amd64/fabs.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC fabs +fabs: + UNIMPLEMENTED fabs + ret +
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/fabs.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/floor.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/floo... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/floor.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/floor.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of floor + * FILE: lib/sdk/crt/math/amd64/floor.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC floor +floor: + UNIMPLEMENTED floor + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/floor.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/floorf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/floo... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/floorf.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,40 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/floorf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* FUNCTIONS ****************************************************************/ + +.code64 + +PUBLIC floorf +floorf: + /* Put parameter on the stack */ + movss [rsp - 0x10], xmm0 + fld dword ptr [rsp] + + /* Change fpu control word to round down */ + fstcw [rsp - 0x10] + mov eax, [rsp - 0x10] + or eax, 0x00400 + and eax, 0x0f7ff + mov [rsp - 0x08], eax + fldcw [rsp - 0x08] + + /* Round to integer */ + frndint + + /* Restore fpu control word */ + fldcw [rsp - 0x10] + + fstp dword ptr [rsp - 0x10] + movss xmm0, [rsp - 0x10] + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/floorf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/fmod.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fmod... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/fmod.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/fmod.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fmod + * FILE: lib/sdk/crt/math/amd64/fmod.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC fmod +fmod: + UNIMPLEMENTED fmod + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/fmod.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/fmod... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of fmodf + * FILE: lib/sdk/crt/math/amd64/fmodf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC fmodf +fmodf: + UNIMPLEMENTED fmodf + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/fmodf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/ldex... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of ldexp + * FILE: lib/sdk/crt/math/amd64/ldexp.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC ldexp +ldexp: + UNIMPLEMENTED ldexp + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/ldexp.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/log.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/log.... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/log.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/log.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of log + * FILE: lib/sdk/crt/math/amd64/log.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC log +log: + UNIMPLEMENTED log + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/log.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/log10.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/log1... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/log10.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/log10.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,20 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of log10 + * FILE: lib/sdk/crt/math/amd64/log10.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC log10 +log10: + UNIMPLEMENTED log10 + ret +
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/log10.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/pow.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/pow.... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/pow.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/pow.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,20 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of pow + * FILE: lib/sdk/crt/math/amd64/pow.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC pow +pow: + UNIMPLEMENTED pow + ret +
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/pow.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/sqrt... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of sqrt + * FILE: lib/sdk/crt/math/amd64/sqrt.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC sqrt +sqrt: + UNIMPLEMENTED sqrt + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/sqrt.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/sqrt... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/sqrtf.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC sqrtf +sqrtf: + sqrtss xmm0, xmm0 + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/sqrtf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/amd64/tan.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/amd64/tan.... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/amd64/tan.S (added) +++ trunk/reactos/lib/sdk/crt/math/amd64/tan.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,19 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Implementation of tan + * FILE: lib/sdk/crt/math/amd64/tan.S + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +/* INCLUDES ******************************************************************/ + +#include <reactos/asm.h> +#include <ndk/amd64/asm.h> + +/* DATA *********************************************************************/ + +PUBLIC tan +tan: + UNIMPLEMENTED tan + ret
Propchange: trunk/reactos/lib/sdk/crt/math/amd64/tan.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/cos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/cos.c?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/cos.c (added) +++ trunk/reactos/lib/sdk/crt/math/cos.c [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/crt/math/cos.c + * PURPOSE: Generic C Implementation of cos + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#define PRECISION 9 +#define M_PI 3.141592653589793238462643 + +static double cos_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.}; +static double cos_sign_tbl[] = {1,-1,-1,1}; + +double +cos(double x) +{ + int quadrant; + double x2, result; + + /* Calculate the quadrant */ + quadrant = x * (2./M_PI); + + /* Get offset inside quadrant */ + x = x - quadrant * (M_PI/2.); + + /* Normalize quadrant to [0..3] */ + quadrant = quadrant & 0x3; + + /* Fixup value for the generic function */ + x += cos_off_tbl[quadrant]; + + /* Calculate the negative of the square of x */ + x2 = - (x * x); + + /* This is an unrolled taylor series using <PRECISION> iterations + * Example with 4 iterations: + * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + * To save multiplications and to keep the precision high, it's performed + * like this: + * result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!)))) + */ + + /* Start with 0, compiler will optimize this away */ + result = 0; + +#if (PRECISION >= 10) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20); + result *= x2; +#endif +#if (PRECISION >= 9) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18); + result *= x2; +#endif +#if (PRECISION >= 8) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16); + result *= x2; +#endif +#if (PRECISION >= 7) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14); + result *= x2; +#endif +#if (PRECISION >= 6) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12); + result *= x2; +#endif +#if (PRECISION >= 5) + result += 1./(1.*2*3*4*5*6*7*8*9*10); + result *= x2; +#endif + result += 1./(1.*2*3*4*5*6*7*8); + result *= x2; + + result += 1./(1.*2*3*4*5*6); + result *= x2; + + result += 1./(1.*2*3*4); + result *= x2; + + result += 1./(1.*2); + result *= x2; + + result += 1; + + /* Apply correct sign */ + result *= cos_sign_tbl[quadrant]; + + return result; +}
Propchange: trunk/reactos/lib/sdk/crt/math/cos.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/cosf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/cosf.c?rev... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/cosf.c (added) +++ trunk/reactos/lib/sdk/crt/math/cosf.c [iso-8859-1] Wed Jul 21 16:03:44 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: trunk/reactos/lib/sdk/crt/math/cosf.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/i386/ceilf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/ceilf... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/i386/ceilf.S (added) +++ trunk/reactos/lib/sdk/crt/math/i386/ceilf.S [iso-8859-1] Wed Jul 21 16:03:44 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: trunk/reactos/lib/sdk/crt/math/i386/ceilf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/i386/floorf.S URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/floor... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/i386/floorf.S (added) +++ trunk/reactos/lib/sdk/crt/math/i386/floorf.S [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,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
Propchange: trunk/reactos/lib/sdk/crt/math/i386/floorf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/i386/fmodf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/fmodf... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/i386/fmodf.c (added) +++ trunk/reactos/lib/sdk/crt/math/i386/fmodf.c [iso-8859-1] Wed Jul 21 16:03:44 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@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; +}
Propchange: trunk/reactos/lib/sdk/crt/math/i386/fmodf.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/i386/sqrtf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/i386/sqrtf... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/i386/sqrtf.c (added) +++ trunk/reactos/lib/sdk/crt/math/i386/sqrtf.c [iso-8859-1] Wed Jul 21 16:03:44 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: trunk/reactos/lib/sdk/crt/math/i386/sqrtf.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/sin.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/sin.c?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/sin.c (added) +++ trunk/reactos/lib/sdk/crt/math/sin.c [iso-8859-1] Wed Jul 21 16:03:44 2010 @@ -1,0 +1,89 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/crt/math/sin.c + * PURPOSE: Generic C Implementation of sin + * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) + */ + +#define PRECISION 9 +#define M_PI 3.141592653589793238462643 + +static double sin_off_tbl[] = {0.0, -M_PI/2., 0, -M_PI/2.}; +static double sin_sign_tbl[] = {1,-1,-1,1}; + +double +sin(double x) +{ + int quadrant; + double x2, result; + + /* Calculate the quadrant */ + quadrant = x * (2./M_PI); + + /* Get offset inside quadrant */ + x = x - quadrant * (M_PI/2.); + + /* Normalize quadrant to [0..3] */ + quadrant = (quadrant - 1) & 0x3; + + /* Fixup value for the generic function */ + x += sin_off_tbl[quadrant]; + + /* Calculate the negative of the square of x */ + x2 = - (x * x); + + /* This is an unrolled taylor series using <PRECISION> iterations + * Example with 4 iterations: + * result = 1 - x^2/2! + x^4/4! - x^6/6! + x^8/8! + * To save multiplications and to keep the precision high, it's performed + * like this: + * result = 1 - x^2 * (1/2! - x^2 * (1/4! - x^2 * (1/6! - x^2 * (1/8!)))) + */ + + /* Start with 0, compiler will optimize this away */ + result = 0; + +#if (PRECISION >= 10) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18*19*20); + result *= x2; +#endif +#if (PRECISION >= 9) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16*17*18); + result *= x2; +#endif +#if (PRECISION >= 8) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14*15*16); + result *= x2; +#endif +#if (PRECISION >= 7) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12*13*14); + result *= x2; +#endif +#if (PRECISION >= 6) + result += 1./(1.*2*3*4*5*6*7*8*9*10*11*12); + result *= x2; +#endif +#if (PRECISION >= 5) + result += 1./(1.*2*3*4*5*6*7*8*9*10); + result *= x2; +#endif + result += 1./(1.*2*3*4*5*6*7*8); + result *= x2; + + result += 1./(1.*2*3*4*5*6); + result *= x2; + + result += 1./(1.*2*3*4); + result *= x2; + + result += 1./(1.*2); + result *= x2; + + result += 1; + + /* Apply correct sign */ + result *= sin_sign_tbl[quadrant]; + + return result; +}
Propchange: trunk/reactos/lib/sdk/crt/math/sin.c ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/lib/sdk/crt/math/sinf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/sinf.c?rev... ============================================================================== --- trunk/reactos/lib/sdk/crt/math/sinf.c (added) +++ trunk/reactos/lib/sdk/crt/math/sinf.c [iso-8859-1] Wed Jul 21 16:03:44 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: trunk/reactos/lib/sdk/crt/math/sinf.c ------------------------------------------------------------------------------ svn:eol-style = native