Author: tkreuzer Date: Sat May 16 06:10:16 2009 New Revision: 40935
URL: http://svn.reactos.org/svn/reactos?rev=40935&view=rev Log: Implement ceilf, floorf and sqrtf for x64 in assembly. Based on public domain code from netbsd.
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/ceilf.S (with props) branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/floorf.S (with props) branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/sqrtf.S (with props) Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/crt.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/sd... ============================================================================== --- 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] Sat May 16 06:10:16 2009 @@ -166,10 +166,12 @@ <file>atan.S</file> <file>atan2.S</file> <file>ceil.S</file> + <file>ceilf.S</file> <file>cos.S</file> <file>exp.S</file> <file>fabs.S</file> <file>floor.S</file> + <file>floorf.S</file> <file>fmod.S</file> <file>ldexp.S</file> <file>log.S</file> @@ -177,6 +179,7 @@ <file>pow.S</file> <file>sin.S</file> <file>sqrt.S</file> + <file>sqrtf.S</file> <file>tan.S</file> </directory> </if>
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/ceilf.S URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/sd... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/ceilf.S (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/ceilf.S [iso-8859-1] Sat May 16 06:10:16 2009 @@ -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 <ndk/amd64/asm.h> +#include <ndk/amd64/asmmacro.S> + +.intel_syntax noprefix + + +.proc 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 + +.endproc
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/ceilf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/floorf.S URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/sd... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/floorf.S (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/floorf.S [iso-8859-1] Sat May 16 06:10:16 2009 @@ -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 <ndk/amd64/asm.h> +#include <ndk/amd64/asmmacro.S> + +.intel_syntax noprefix + + +.proc 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 + +.endproc
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/floorf.S ------------------------------------------------------------------------------ svn:eol-style = native
Added: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/sqrtf.S URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/sd... ============================================================================== --- branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/sqrtf.S (added) +++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/sqrtf.S [iso-8859-1] Sat May 16 06:10:16 2009 @@ -1,0 +1,20 @@ +/* + * 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 <ndk/amd64/asm.h> +#include <ndk/amd64/asmmacro.S> + +.intel_syntax noprefix + + +.proc sqrtf + sqrtss xmm0, xmm0 + ret +.endproc
Propchange: branches/ros-amd64-bringup/reactos/lib/sdk/crt/math/amd64/sqrtf.S ------------------------------------------------------------------------------ svn:eol-style = native