From 62f9753de57154c7fb8cbc7aafe99d08800a965f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 18 May 2005 22:19:35 +0000 Subject: [PATCH] Added public domain versions of sin() and cos() (taken from glibc). Not yet used, though - we probably need to rearrange the source files a bit. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12727 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../libroot/posix/math/arch/x86/Jamfile | 10 ++++--- src/system/libroot/posix/math/arch/x86/cos.S | 30 +++++++++++++++++++ src/system/libroot/posix/math/arch/x86/sin.S | 30 +++++++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 src/system/libroot/posix/math/arch/x86/cos.S create mode 100644 src/system/libroot/posix/math/arch/x86/sin.S diff --git a/src/system/libroot/posix/math/arch/x86/Jamfile b/src/system/libroot/posix/math/arch/x86/Jamfile index 93ed03e951..5096fdc836 100644 --- a/src/system/libroot/posix/math/arch/x86/Jamfile +++ b/src/system/libroot/posix/math/arch/x86/Jamfile @@ -1,10 +1,12 @@ SubDir OBOS_TOP src system libroot posix math arch x86 ; KernelMergeObject posix_math_arch_$(OBOS_ARCH).o : - <$(SOURCE_GRIST)>fabs.S - <$(SOURCE_GRIST)>frexp.c - <$(SOURCE_GRIST)>isinf.c - <$(SOURCE_GRIST)>ldexp.c + cos.S + fabs.S + frexp.c + isinf.c + ldexp.c + sin.S : -fPIC -DPIC ; diff --git a/src/system/libroot/posix/math/arch/x86/cos.S b/src/system/libroot/posix/math/arch/x86/cos.S new file mode 100644 index 0000000000..6681d35d83 --- /dev/null +++ b/src/system/libroot/posix/math/arch/x86/cos.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#define FUNCTION(x) .global x; .type x,@function; x +#define FUNCTION_END(x) +#define WEAK_ALIAS(original, alias) .weak original; original = alias + +FUNCTION(__cos): + fldl 4(%esp) + fcos + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align 4 +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fcos + ret +FUNCTION_END(__cos) + +WEAK_ALIAS(__cos, cos) diff --git a/src/system/libroot/posix/math/arch/x86/sin.S b/src/system/libroot/posix/math/arch/x86/sin.S new file mode 100644 index 0000000000..f9340245a6 --- /dev/null +++ b/src/system/libroot/posix/math/arch/x86/sin.S @@ -0,0 +1,30 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + +#define FUNCTION(x) .global x; .type x,@function; x +#define FUNCTION_END(x) +#define WEAK_ALIAS(original, alias) .weak original; original = alias + +FUNCTION(__sin): + fldl 4(%esp) + fsin + fnstsw %ax + testl $0x400,%eax + jnz 1f + ret + .align 4 +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem1 + fnstsw %ax + testl $0x400,%eax + jnz 2b + fstp %st(1) + fsin + ret +FUNCTION_END(__sin) + +WEAK_ALIAS(__sin, sin)