From 6186cc683b6179ae3853be709158de402a553196 Mon Sep 17 00:00:00 2001 From: NicJA Date: Tue, 17 Apr 2018 01:04:49 +0000 Subject: [PATCH] add i386 arch specific overrides of appropriate math functions using the 387 fpu. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@55093 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/i386-all/stdc/fenv.c | 46 +++++++++++------ arch/i386-all/stdc/math/e_fmod.s | 61 +++++++++++++++++++++++ arch/i386-all/stdc/math/e_fmodf.s | 27 ++++++++++ arch/i386-all/stdc/math/e_fmodl.s | 57 +++++++++++++++++++++ arch/i386-all/stdc/math/e_log.s | 50 +++++++++++++++++++ arch/i386-all/stdc/math/e_log10.s | 50 +++++++++++++++++++ arch/i386-all/stdc/math/e_log10f.s | 20 ++++++++ arch/i386-all/stdc/math/e_logf.s | 20 ++++++++ arch/i386-all/stdc/math/e_remainder.s | 57 +++++++++++++++++++++ arch/i386-all/stdc/math/e_remainderf.s | 27 ++++++++++ arch/i386-all/stdc/math/e_remainderl.s | 61 +++++++++++++++++++++++ arch/i386-all/stdc/math/e_sqrt.s | 52 +++++++++++++++++++ arch/i386-all/stdc/math/e_sqrtf.s | 22 +++++++++ arch/i386-all/stdc/math/e_sqrtl.s | 51 +++++++++++++++++++ arch/i386-all/stdc/math/ld80/invtrig.c | 85 ++++++++++++++++++++++++++++++++ arch/i386-all/stdc/math/s_ceil.s | 64 ++++++++++++++++++++++++ arch/i386-all/stdc/math/s_ceilf.s | 34 +++++++++++++ arch/i386-all/stdc/math/s_ceill.s | 34 +++++++++++++ arch/i386-all/stdc/math/s_copysign.s | 60 ++++++++++++++++++++++ arch/i386-all/stdc/math/s_copysignf.s | 28 +++++++++++ arch/i386-all/stdc/math/s_copysignl.s | 30 +++++++++++ arch/i386-all/stdc/math/s_cos.s | 64 ++++++++++++++++++++++++ arch/i386-all/stdc/math/s_floor.s | 64 ++++++++++++++++++++++++ arch/i386-all/stdc/math/s_floorf.s | 34 +++++++++++++ arch/i386-all/stdc/math/s_floorl.s | 34 +++++++++++++ arch/i386-all/stdc/math/s_llrint.s | 43 ++++++++++++++++ arch/i386-all/stdc/math/s_llrintf.s | 43 ++++++++++++++++ arch/i386-all/stdc/math/s_llrintl.s | 43 ++++++++++++++++ arch/i386-all/stdc/math/s_logb.s | 45 +++++++++++++++++ arch/i386-all/stdc/math/s_logbf.s | 20 ++++++++ arch/i386-all/stdc/math/s_logbl.s | 50 +++++++++++++++++++ arch/i386-all/stdc/math/s_lrint.s | 42 ++++++++++++++++ arch/i386-all/stdc/math/s_lrintf.s | 42 ++++++++++++++++ arch/i386-all/stdc/math/s_lrintl.s | 42 ++++++++++++++++ arch/i386-all/stdc/math/s_remquo.s | 75 ++++++++++++++++++++++++++++ arch/i386-all/stdc/math/s_remquof.s | 75 ++++++++++++++++++++++++++++ arch/i386-all/stdc/math/s_remquol.s | 76 ++++++++++++++++++++++++++++ arch/i386-all/stdc/math/s_rint.s | 49 ++++++++++++++++++ arch/i386-all/stdc/math/s_rintf.s | 19 +++++++ arch/i386-all/stdc/math/s_rintl.s | 49 ++++++++++++++++++ arch/i386-all/stdc/math/s_scalbn.s | 57 +++++++++++++++++++++ arch/i386-all/stdc/math/s_scalbnf.s | 27 ++++++++++ arch/i386-all/stdc/math/s_scalbnl.s | 27 ++++++++++ arch/i386-all/stdc/math/s_significand.s | 50 +++++++++++++++++++ arch/i386-all/stdc/math/s_significandf.s | 20 ++++++++ arch/i386-all/stdc/math/s_sin.s | 62 +++++++++++++++++++++++ arch/i386-all/stdc/math/s_tan.s | 64 ++++++++++++++++++++++++ arch/i386-all/stdc/math/s_trunc.s | 33 +++++++++++++ arch/i386-all/stdc/math/s_truncf.s | 33 +++++++++++++ arch/i386-all/stdc/math/s_truncl.s | 33 +++++++++++++ arch/i386-all/stdc/mmakefile.src | 74 ++++++++++++++++++++++++++- 51 files changed, 2310 insertions(+), 15 deletions(-) create mode 100644 arch/i386-all/stdc/math/e_fmod.s create mode 100644 arch/i386-all/stdc/math/e_fmodf.s create mode 100644 arch/i386-all/stdc/math/e_fmodl.s create mode 100644 arch/i386-all/stdc/math/e_log.s create mode 100644 arch/i386-all/stdc/math/e_log10.s create mode 100644 arch/i386-all/stdc/math/e_log10f.s create mode 100644 arch/i386-all/stdc/math/e_logf.s create mode 100644 arch/i386-all/stdc/math/e_remainder.s create mode 100644 arch/i386-all/stdc/math/e_remainderf.s create mode 100644 arch/i386-all/stdc/math/e_remainderl.s create mode 100644 arch/i386-all/stdc/math/e_sqrt.s create mode 100644 arch/i386-all/stdc/math/e_sqrtf.s create mode 100644 arch/i386-all/stdc/math/e_sqrtl.s create mode 100644 arch/i386-all/stdc/math/ld80/invtrig.c create mode 100644 arch/i386-all/stdc/math/s_ceil.s create mode 100644 arch/i386-all/stdc/math/s_ceilf.s create mode 100644 arch/i386-all/stdc/math/s_ceill.s create mode 100644 arch/i386-all/stdc/math/s_copysign.s create mode 100644 arch/i386-all/stdc/math/s_copysignf.s create mode 100644 arch/i386-all/stdc/math/s_copysignl.s create mode 100644 arch/i386-all/stdc/math/s_cos.s create mode 100644 arch/i386-all/stdc/math/s_floor.s create mode 100644 arch/i386-all/stdc/math/s_floorf.s create mode 100644 arch/i386-all/stdc/math/s_floorl.s create mode 100644 arch/i386-all/stdc/math/s_llrint.s create mode 100644 arch/i386-all/stdc/math/s_llrintf.s create mode 100644 arch/i386-all/stdc/math/s_llrintl.s create mode 100644 arch/i386-all/stdc/math/s_logb.s create mode 100644 arch/i386-all/stdc/math/s_logbf.s create mode 100644 arch/i386-all/stdc/math/s_logbl.s create mode 100644 arch/i386-all/stdc/math/s_lrint.s create mode 100644 arch/i386-all/stdc/math/s_lrintf.s create mode 100644 arch/i386-all/stdc/math/s_lrintl.s create mode 100644 arch/i386-all/stdc/math/s_remquo.s create mode 100644 arch/i386-all/stdc/math/s_remquof.s create mode 100644 arch/i386-all/stdc/math/s_remquol.s create mode 100644 arch/i386-all/stdc/math/s_rint.s create mode 100644 arch/i386-all/stdc/math/s_rintf.s create mode 100644 arch/i386-all/stdc/math/s_rintl.s create mode 100644 arch/i386-all/stdc/math/s_scalbn.s create mode 100644 arch/i386-all/stdc/math/s_scalbnf.s create mode 100644 arch/i386-all/stdc/math/s_scalbnl.s create mode 100644 arch/i386-all/stdc/math/s_significand.s create mode 100644 arch/i386-all/stdc/math/s_significandf.s create mode 100644 arch/i386-all/stdc/math/s_sin.s create mode 100644 arch/i386-all/stdc/math/s_tan.s create mode 100644 arch/i386-all/stdc/math/s_trunc.s create mode 100644 arch/i386-all/stdc/math/s_truncf.s create mode 100644 arch/i386-all/stdc/math/s_truncl.s diff --git a/arch/i386-all/stdc/fenv.c b/arch/i386-all/stdc/fenv.c index 367507e421..5bcc63fe13 100644 --- a/arch/i386-all/stdc/fenv.c +++ b/arch/i386-all/stdc/fenv.c @@ -26,6 +26,7 @@ * $FreeBSD: src/lib/msun/i387/fenv.c,v 1.3 2007/01/05 07:15:26 das Exp $ */ +#define __BSD_VISIBLE 1 #include "fenv.h" const fenv_t __fe_dfl_env = { @@ -42,11 +43,14 @@ const fenv_t __fe_dfl_env = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff } }; +extern inline int feclearexcept(int __excepts); +extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); + int fesetexceptflag(const fexcept_t *flagp, int excepts) { fenv_t env; - int mxcsr; + uint32_t mxcsr; __fnstenv(&env); env.__status &= ~excepts; @@ -73,10 +77,14 @@ feraiseexcept(int excepts) return (0); } +extern inline int fetestexcept(int __excepts); +extern inline int fegetround(void); +extern inline int fesetround(int __round); + int fegetenv(fenv_t *envp) { - int mxcsr; + uint32_t mxcsr; __fnstenv(envp); /* @@ -94,7 +102,7 @@ fegetenv(fenv_t *envp) int feholdexcept(fenv_t *envp) { - int mxcsr; + uint32_t mxcsr; __fnstenv(envp); __fnclex(); @@ -108,12 +116,14 @@ feholdexcept(fenv_t *envp) return (0); } +extern inline int fesetenv(const fenv_t *__envp); + int feupdateenv(const fenv_t *envp) { - int mxcsr; - short status; - + uint32_t mxcsr; + uint16_t status; + __fnstsw(&status); if (__HAS_SSE()) __stmxcsr(&mxcsr); @@ -125,9 +135,10 @@ feupdateenv(const fenv_t *envp) } int -feenableexcept(int mask) +__feenableexcept(int mask) { - int mxcsr, control, omask; + uint32_t mxcsr, omask; + uint16_t control; mask &= FE_ALL_EXCEPT; __fnstcw(&control); @@ -135,20 +146,21 @@ feenableexcept(int mask) __stmxcsr(&mxcsr); else mxcsr = 0; - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control &= ~mask; __fldcw(control); if (__HAS_SSE()) { mxcsr &= ~(mask << _SSE_EMASK_SHIFT); __ldmxcsr(mxcsr); } - return (~omask); + return (omask); } int -fedisableexcept(int mask) +__fedisableexcept(int mask) { - int mxcsr, control, omask; + uint32_t mxcsr, omask; + uint16_t control; mask &= FE_ALL_EXCEPT; __fnstcw(&control); @@ -156,12 +168,18 @@ fedisableexcept(int mask) __stmxcsr(&mxcsr); else mxcsr = 0; - omask = (control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; + omask = ~(control | mxcsr >> _SSE_EMASK_SHIFT) & FE_ALL_EXCEPT; control |= mask; __fldcw(control); if (__HAS_SSE()) { mxcsr |= mask << _SSE_EMASK_SHIFT; __ldmxcsr(mxcsr); } - return (~omask); + return (omask); } + +AROS_MAKE_ASM_SYM(typeof(feenableexcept), feenableexcept, AROS_CSYM_FROM_ASM_NAME(feenableexcept), AROS_CSYM_FROM_ASM_NAME(__feenableexcept)); +AROS_EXPORT_ASM_SYM(AROS_CSYM_FROM_ASM_NAME(feenableexcept)); + +AROS_MAKE_ASM_SYM(typeof(fedisableexcept), fedisableexcept, AROS_CSYM_FROM_ASM_NAME(fedisableexcept), AROS_CSYM_FROM_ASM_NAME(__fedisableexcept)); +AROS_EXPORT_ASM_SYM(AROS_CSYM_FROM_ASM_NAME(fedisableexcept)); diff --git a/arch/i386-all/stdc/math/e_fmod.s b/arch/i386-all/stdc/math/e_fmod.s new file mode 100644 index 0000000000..18060f7000 --- /dev/null +++ b/arch/i386-all/stdc/math/e_fmod.s @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(fmod) + _FUNCTION(AROS_CDEFNAME(fmod)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 12 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(fmod): + /* Fetch the arguments off the stack. */ + fldl arg_y(%esp) + fldl arg_x(%esp) + +1: + fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + + ret diff --git a/arch/i386-all/stdc/math/e_fmodf.s b/arch/i386-all/stdc/math/e_fmodf.s new file mode 100644 index 0000000000..fb6547c9bf --- /dev/null +++ b/arch/i386-all/stdc/math/e_fmodf.s @@ -0,0 +1,27 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(fmodf) + _FUNCTION(AROS_CDEFNAME(fmodf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 8 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(fmodf): + flds arg_y(%esp) + flds arg_x(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/e_fmodl.s b/arch/i386-all/stdc/math/e_fmodl.s new file mode 100644 index 0000000000..e83a892e58 --- /dev/null +++ b/arch/i386-all/stdc/math/e_fmodl.s @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(fmodl) + _FUNCTION(AROS_CDEFNAME(fmodl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(fmodl): + fldt arg_y(%esp) + fldt arg_x(%esp) +1: fprem + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/e_log.s b/arch/i386-all/stdc/math/e_log.s new file mode 100644 index 0000000000..a3e20ecc50 --- /dev/null +++ b/arch/i386-all/stdc/math/e_log.s @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(log) + _FUNCTION(AROS_CDEFNAME(log)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(log): + fldln2 + fldl arg_x(%esp) + fyl2x + ret diff --git a/arch/i386-all/stdc/math/e_log10.s b/arch/i386-all/stdc/math/e_log10.s new file mode 100644 index 0000000000..18c91d45bd --- /dev/null +++ b/arch/i386-all/stdc/math/e_log10.s @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(log10) + _FUNCTION(AROS_CDEFNAME(log10)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(log10): + fldlg2 + fldl arg_x(%esp) + fyl2x + ret diff --git a/arch/i386-all/stdc/math/e_log10f.s b/arch/i386-all/stdc/math/e_log10f.s new file mode 100644 index 0000000000..eb6978e4b8 --- /dev/null +++ b/arch/i386-all/stdc/math/e_log10f.s @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(log10f) + _FUNCTION(AROS_CDEFNAME(log10f)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(log10f): + fldlg2 + flds arg_x(%esp) + fyl2x + ret diff --git a/arch/i386-all/stdc/math/e_logf.s b/arch/i386-all/stdc/math/e_logf.s new file mode 100644 index 0000000000..b96e0f80fe --- /dev/null +++ b/arch/i386-all/stdc/math/e_logf.s @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(logf) + _FUNCTION(AROS_CDEFNAME(logf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(logf): + fldln2 + flds arg_x(%esp) + fyl2x + ret diff --git a/arch/i386-all/stdc/math/e_remainder.s b/arch/i386-all/stdc/math/e_remainder.s new file mode 100644 index 0000000000..4363a439a4 --- /dev/null +++ b/arch/i386-all/stdc/math/e_remainder.s @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remainder) + _FUNCTION(AROS_CDEFNAME(remainder)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 12 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(remainder): + fldl arg_y(%esp) + fldl arg_x(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/e_remainderf.s b/arch/i386-all/stdc/math/e_remainderf.s new file mode 100644 index 0000000000..07e895f786 --- /dev/null +++ b/arch/i386-all/stdc/math/e_remainderf.s @@ -0,0 +1,27 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remainderf) + _FUNCTION(AROS_CDEFNAME(remainderf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 8 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(remainderf): + flds arg_y(%esp) + flds arg_x(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/e_remainderl.s b/arch/i386-all/stdc/math/e_remainderl.s new file mode 100644 index 0000000000..e2fe491c40 --- /dev/null +++ b/arch/i386-all/stdc/math/e_remainderl.s @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remainderl) + _FUNCTION(AROS_CDEFNAME(remainderl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(remainderl): + /* Fetch the arguments off the stack. */ + fldt arg_y(%esp) + fldt arg_x(%esp) + +1: + fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) + + ret diff --git a/arch/i386-all/stdc/math/e_sqrt.s b/arch/i386-all/stdc/math/e_sqrt.s new file mode 100644 index 0000000000..bc710db617 --- /dev/null +++ b/arch/i386-all/stdc/math/e_sqrt.s @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(sqrt) + _FUNCTION(AROS_CDEFNAME(sqrt)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(sqrt): + /* Fetch the argument off the stack. */ + fldl arg_x(%esp) + + fsqrt + + ret diff --git a/arch/i386-all/stdc/math/e_sqrtf.s b/arch/i386-all/stdc/math/e_sqrtf.s new file mode 100644 index 0000000000..ced3ff8861 --- /dev/null +++ b/arch/i386-all/stdc/math/e_sqrtf.s @@ -0,0 +1,22 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(sqrtf) + _FUNCTION(AROS_CDEFNAME(sqrtf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(sqrtf): + /* Fetch the arguments off the stack. */ + flds arg_x(%esp) + + fsqrt + + ret diff --git a/arch/i386-all/stdc/math/e_sqrtl.s b/arch/i386-all/stdc/math/e_sqrtl.s new file mode 100644 index 0000000000..1c40b72cf8 --- /dev/null +++ b/arch/i386-all/stdc/math/e_sqrtl.s @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(sqrtl) + _FUNCTION(AROS_CDEFNAME(sqrtl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(sqrtl): + fldt arg_x(%esp) + + fsqrt + + ret diff --git a/arch/i386-all/stdc/math/ld80/invtrig.c b/arch/i386-all/stdc/math/ld80/invtrig.c new file mode 100644 index 0000000000..fd090ff91d --- /dev/null +++ b/arch/i386-all/stdc/math/ld80/invtrig.c @@ -0,0 +1,85 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2008 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +#define STRUCT_DECLS +#include "invtrig.h" + +/* + * asinl() and acosl() + */ +const LONGDOUBLE +pS0 = { 0xaaaaaaaaaaaaaaa8ULL, 0x3ffcU }, /* 1.66666666666666666631e-01L */ +pS1 = { 0xd5271b6699b48bfaULL, 0xbffdU }, /* -4.16313987993683104320e-01L */ +pS2 = { 0xbcf67ca9e9f669cfULL, 0x3ffdU }, /* 3.69068046323246813704e-01L */ +pS3 = { 0x8b7baa3d15f9830dULL, 0xbffcU }, /* -1.36213932016738603108e-01L */ +pS4 = { 0x92154b093a3bff1cULL, 0x3ff9U }, /* 1.78324189708471965733e-02L */ +pS5 = { 0xe5dd76401964508cULL, 0xbff2U }, /* -2.19216428382605211588e-04L */ +pS6 = { 0xee69c5b0fdb76951ULL, 0xbfedU }, /* -7.10526623669075243183e-06L */ +qS1 = { 0xbcaa2159c01436a0ULL, 0xc000U }, /* -2.94788392796209867269e+00L */ +qS2 = { 0xd17a73d1e1564c29ULL, 0x4000U }, /* 3.27309890266528636716e+00L */ +qS3 = { 0xd767e411c9cf4c2cULL, 0xbfffU }, /* -1.68285799854822427013e+00L */ +qS4 = { 0xc809c0dfb9b0d0b7ULL, 0x3ffdU }, /* 3.90699412641738801874e-01L */ +qS5 = { 0x80c3a2197c8ced57ULL, 0xbffaU }; /* -3.14365703596053263322e-02L */ + +/* + * atanl() + */ +const LONGDOUBLE atanhi[] = { + { 0xed63382b0dda7b45ULL, 0x3ffdU }, /* 4.63647609000806116202e-01L */ + { 0xc90fdaa22168c235ULL, 0x3ffeU }, /* 7.85398163397448309628e-01L */ + { 0xfb985e940fb4d900ULL, 0x3ffeU }, /* 9.82793723247329067960e-01L */ + { 0xc90fdaa22168c235ULL, 0x3fffU }, /* 1.57079632679489661926e+00L */ +}; + +const LONGDOUBLE atanlo[] = { + { 0xdfc88bd978751a07ULL, 0x3fbcU }, /* 1.18469937025062860669e-20L */ + { 0xece675d1fc8f8cbbULL, 0xbfbcU }, /* -1.25413940316708300586e-20L */ + { 0xf10f5e197793c283ULL, 0x3fbdU }, /* 2.55232234165405176172e-20L */ + { 0xece675d1fc8f8cbbULL, 0xbfbdU }, /* -2.50827880633416601173e-20L */ +}; + +const LONGDOUBLE aT[] = { + { 0xaaaaaaaaaaaaaa9fULL, 0x3ffdU }, /* 3.33333333333333333017e-01L */ + { 0xcccccccccccc62bcULL, 0xbffcU }, /* -1.99999999999999632011e-01L */ + { 0x9249249248b81e3fULL, 0x3ffcU }, /* 1.42857142857046531280e-01L */ + { 0xe38e38e3316f3de5ULL, 0xbffbU }, /* -1.11111111100562372733e-01L */ + { 0xba2e8b8dc280726aULL, 0x3ffbU }, /* 9.09090902935647302252e-02L */ + { 0x9d89d5b4c6847ec4ULL, 0xbffbU }, /* -7.69230552476207730353e-02L */ + { 0x8888461d3099c677ULL, 0x3ffbU }, /* 6.66661718042406260546e-02L */ + { 0xf0e8ee0f5328dc29ULL, 0xbffaU }, /* -5.88158892835030888692e-02L */ + { 0xd73ea84d24bae54aULL, 0x3ffaU }, /* 5.25499891539726639379e-02L */ + { 0xc08fa381dcd9213aULL, 0xbffaU }, /* -4.70119845393155721494e-02L */ + { 0xa54a26f4095f2a3aULL, 0x3ffaU }, /* 4.03539201366454414072e-02L */ + { 0xeea2d8d059ef3ad6ULL, 0xbff9U }, /* -2.91303858419364158725e-02L */ + { 0xcc82292ab894b051ULL, 0x3ff8U }, /* 1.24822046299269234080e-02L */ +}; + +const LONGDOUBLE +pi_lo = { 0xece675d1fc8f8cbbULL, 0xbfbeU }; /* -5.01655761266833202345e-20L */ diff --git a/arch/i386-all/stdc/math/s_ceil.s b/arch/i386-all/stdc/math/s_ceil.s new file mode 100644 index 0000000000..f7a7ffac87 --- /dev/null +++ b/arch/i386-all/stdc/math/s_ceil.s @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(ceil) + _FUNCTION(AROS_CDEFNAME(ceil)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(ceil): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0800,%dx /* round towards +oo */ + andw $0xfbff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldl 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_ceilf.s b/arch/i386-all/stdc/math/s_ceilf.s new file mode 100644 index 0000000000..efd2b08937 --- /dev/null +++ b/arch/i386-all/stdc/math/s_ceilf.s @@ -0,0 +1,34 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(ceilf) + _FUNCTION(AROS_CDEFNAME(ceilf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(ceilf): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0800,%dx /* round towards +oo */ + andw $0xfbff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + flds 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_ceill.s b/arch/i386-all/stdc/math/s_ceill.s new file mode 100644 index 0000000000..743e816cce --- /dev/null +++ b/arch/i386-all/stdc/math/s_ceill.s @@ -0,0 +1,34 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(ceill) + _FUNCTION(AROS_CDEFNAME(ceill)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(ceill): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0800,%dx /* round towards +oo */ + andw $0xfbff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_copysign.s b/arch/i386-all/stdc/math/s_copysign.s new file mode 100644 index 0000000000..10f4478761 --- /dev/null +++ b/arch/i386-all/stdc/math/s_copysign.s @@ -0,0 +1,60 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(copysign) + _FUNCTION(AROS_CDEFNAME(copysign)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + .set FirstArg_lo, 8 /* Skip Return-Adress */ + .set arg_x_lo, FirstArg_lo + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(copysign): + movl arg_y(%esp),%edx + andl $0x80000000,%edx + movl arg_x_lo(%esp),%eax + andl $0x7fffffff,%eax + orl %edx,%eax + movl %eax,arg_x_lo(%esp) + fldl arg_x(%esp) + + ret diff --git a/arch/i386-all/stdc/math/s_copysignf.s b/arch/i386-all/stdc/math/s_copysignf.s new file mode 100644 index 0000000000..adc04c8906 --- /dev/null +++ b/arch/i386-all/stdc/math/s_copysignf.s @@ -0,0 +1,28 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(copysignf) + _FUNCTION(AROS_CDEFNAME(copysignf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 8 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(copysignf): + movl arg_y(%esp),%edx + andl $0x80000000,%edx + movl arg_x(%esp),%eax + andl $0x7fffffff,%eax + orl %edx,%eax + movl %eax,arg_x(%esp) + flds arg_x(%esp) + + ret diff --git a/arch/i386-all/stdc/math/s_copysignl.s b/arch/i386-all/stdc/math/s_copysignl.s new file mode 100644 index 0000000000..d4ae3d2c71 --- /dev/null +++ b/arch/i386-all/stdc/math/s_copysignl.s @@ -0,0 +1,30 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(copysignl) + _FUNCTION(AROS_CDEFNAME(copysignl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + .set FirstArg_lo, 12 /* Skip Return-Adress */ + .set arg_x_lo, FirstArg_lo + + .set SecondArg, 24 /* Skip FirstArg */ + .set arg_y, SecondArg + +AROS_CDEFNAME(copysignl): + movl arg_y(%esp),%edx + andl $0x8000,%edx + movl arg_x_lo(%esp),%eax + andl $0x7fff,%eax + orl %edx,%eax + movl %eax,arg_x_lo(%esp) + fldt arg_x(%esp) + + ret diff --git a/arch/i386-all/stdc/math/s_cos.s b/arch/i386-all/stdc/math/s_cos.s new file mode 100644 index 0000000000..19c3af5b3e --- /dev/null +++ b/arch/i386-all/stdc/math/s_cos.s @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1994 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(cos) + _FUNCTION(AROS_CDEFNAME(cos)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(cos): + fldl arg_x(%esp) + + fcos + fnstsw %ax + sahf + jp 1f + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem + fnstsw %ax + sahf + jp 2b + fstp %st(1) + fcos + + ret diff --git a/arch/i386-all/stdc/math/s_floor.s b/arch/i386-all/stdc/math/s_floor.s new file mode 100644 index 0000000000..cb584b8f2e --- /dev/null +++ b/arch/i386-all/stdc/math/s_floor.s @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(floor) + _FUNCTION(AROS_CDEFNAME(floor)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(floor): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0400,%dx /* round towards -oo */ + andw $0xf7ff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldl 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_floorf.s b/arch/i386-all/stdc/math/s_floorf.s new file mode 100644 index 0000000000..5f04a44038 --- /dev/null +++ b/arch/i386-all/stdc/math/s_floorf.s @@ -0,0 +1,34 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(floorf) + _FUNCTION(AROS_CDEFNAME(floorf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(floorf): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0400,%dx /* round towards -oo */ + andw $0xf7ff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + flds 8(%ebp); /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_floorl.s b/arch/i386-all/stdc/math/s_floorl.s new file mode 100644 index 0000000000..5a78a24c1b --- /dev/null +++ b/arch/i386-all/stdc/math/s_floorl.s @@ -0,0 +1,34 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(floorl) + _FUNCTION(AROS_CDEFNAME(floorl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(floorl): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0400,%dx /* round towards -oo */ + andw $0xf7ff,%dx + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_llrint.s b/arch/i386-all/stdc/math/s_llrint.s new file mode 100644 index 0000000000..c42ba484a6 --- /dev/null +++ b/arch/i386-all/stdc/math/s_llrint.s @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(llrint) + _FUNCTION(AROS_CDEFNAME(llrint)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(llrint): + fldl arg_x(%esp) + subl $8,%esp + fistpll (%esp) + popl %eax + popl %edx + ret diff --git a/arch/i386-all/stdc/math/s_llrintf.s b/arch/i386-all/stdc/math/s_llrintf.s new file mode 100644 index 0000000000..cf9334213c --- /dev/null +++ b/arch/i386-all/stdc/math/s_llrintf.s @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(llrintf) + _FUNCTION(AROS_CDEFNAME(llrintf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(llrintf): + flds arg_x(%esp) + subl $8,%esp + fistpll (%esp) + popl %eax + popl %edx + ret diff --git a/arch/i386-all/stdc/math/s_llrintl.s b/arch/i386-all/stdc/math/s_llrintl.s new file mode 100644 index 0000000000..3a95d2b50e --- /dev/null +++ b/arch/i386-all/stdc/math/s_llrintl.s @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(llrintl) + _FUNCTION(AROS_CDEFNAME(llrintl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(llrintl): + fldt arg_x(%esp) + subl $8,%esp + fistpll (%esp) + popl %eax + popl %edx + ret diff --git a/arch/i386-all/stdc/math/s_logb.s b/arch/i386-all/stdc/math/s_logb.s new file mode 100644 index 0000000000..ddcb9d5c0d --- /dev/null +++ b/arch/i386-all/stdc/math/s_logb.s @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(logb) + _FUNCTION(AROS_CDEFNAME(logb)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(logb): + fldl arg_x(%esp) + fxtract + fstp %st + ret diff --git a/arch/i386-all/stdc/math/s_logbf.s b/arch/i386-all/stdc/math/s_logbf.s new file mode 100644 index 0000000000..e0b5319196 --- /dev/null +++ b/arch/i386-all/stdc/math/s_logbf.s @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(logbf) + _FUNCTION(AROS_CDEFNAME(logbf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(logbf): + flds arg_x(%esp) + fxtract + fstp %st + ret diff --git a/arch/i386-all/stdc/math/s_logbl.s b/arch/i386-all/stdc/math/s_logbl.s new file mode 100644 index 0000000000..dbab07a9e6 --- /dev/null +++ b/arch/i386-all/stdc/math/s_logbl.s @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(logbl) + _FUNCTION(AROS_CDEFNAME(logbl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(logbl): + fldt arg_x(%esp) + fxtract + fstp %st + ret diff --git a/arch/i386-all/stdc/math/s_lrint.s b/arch/i386-all/stdc/math/s_lrint.s new file mode 100644 index 0000000000..75fd3d0163 --- /dev/null +++ b/arch/i386-all/stdc/math/s_lrint.s @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(lrint) + _FUNCTION(AROS_CDEFNAME(lrint)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(lrint): + fldl arg_x(%esp) + subl $4,%esp + fistpl (%esp) + popl %eax + ret diff --git a/arch/i386-all/stdc/math/s_lrintf.s b/arch/i386-all/stdc/math/s_lrintf.s new file mode 100644 index 0000000000..c272778e63 --- /dev/null +++ b/arch/i386-all/stdc/math/s_lrintf.s @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(lrintf) + _FUNCTION(AROS_CDEFNAME(lrintf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(lrintf): + flds arg_x(%esp) + subl $4,%esp + fistpl (%esp) + popl %eax + ret diff --git a/arch/i386-all/stdc/math/s_lrintl.s b/arch/i386-all/stdc/math/s_lrintl.s new file mode 100644 index 0000000000..3f9f3043ed --- /dev/null +++ b/arch/i386-all/stdc/math/s_lrintl.s @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2008 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(lrintl) + _FUNCTION(AROS_CDEFNAME(lrintl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(lrintl): + fldt arg_x(%esp) + subl $4,%esp + fistpl (%esp) + popl %eax + ret diff --git a/arch/i386-all/stdc/math/s_remquo.s b/arch/i386-all/stdc/math/s_remquo.s new file mode 100644 index 0000000000..20bff344c3 --- /dev/null +++ b/arch/i386-all/stdc/math/s_remquo.s @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Based on public-domain remainder routine by J.T. Conklin . + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remquo) + _FUNCTION(AROS_CDEFNAME(remquo)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + + .set ThirdArg, 16 /* Skip SecondArg */ + .set arg_quo, ThirdArg + +AROS_CDEFNAME(remquo): + fldl 12(%esp) + fldl 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) +/* Extract the three low-order bits of the quotient from C0,C3,C1. */ + shrl $6,%eax + movl %eax,%ecx + andl $0x108,%eax + rorl $7,%eax + orl %eax,%ecx + roll $4,%eax + orl %ecx,%eax + andl $7,%eax +/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ + movl 16(%esp),%ecx + xorl 8(%esp),%ecx + sarl $16,%ecx + sarl $16,%ecx + xorl %ecx,%eax + andl $1,%ecx + addl %ecx,%eax +/* Store the quotient and return. */ + movl 20(%esp),%ecx + movl %eax,(%ecx) + ret diff --git a/arch/i386-all/stdc/math/s_remquof.s b/arch/i386-all/stdc/math/s_remquof.s new file mode 100644 index 0000000000..529501a27b --- /dev/null +++ b/arch/i386-all/stdc/math/s_remquof.s @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 2005 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Based on public-domain remainder routine by J.T. Conklin . + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remquof) + _FUNCTION(AROS_CDEFNAME(remquof)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + + .set ThirdArg, 16 /* Skip SecondArg */ + .set arg_quo, ThirdArg + +AROS_CDEFNAME(remquof): + flds 8(%esp) + flds 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) +/* Extract the three low-order bits of the quotient from C0,C3,C1. */ + shrl $6,%eax + movl %eax,%ecx + andl $0x108,%eax + rorl $7,%eax + orl %eax,%ecx + roll $4,%eax + orl %ecx,%eax + andl $7,%eax +/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ + movl 8(%esp),%ecx + xorl 4(%esp),%ecx + sarl $16,%ecx + sarl $16,%ecx + xorl %ecx,%eax + andl $1,%ecx + addl %ecx,%eax +/* Store the quotient and return. */ + movl 12(%esp),%ecx + movl %eax,(%ecx) + ret diff --git a/arch/i386-all/stdc/math/s_remquol.s b/arch/i386-all/stdc/math/s_remquol.s new file mode 100644 index 0000000000..a22bc12bdc --- /dev/null +++ b/arch/i386-all/stdc/math/s_remquol.s @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2005-2008 David Schultz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Based on public-domain remainder routine by J.T. Conklin . + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(remquol) + _FUNCTION(AROS_CDEFNAME(remquol)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_y, SecondArg + + .set ThirdArg, 16 /* Skip SecondArg */ + .set arg_quo, ThirdArg + +AROS_CDEFNAME(remquol): + fldt 16(%esp) + fldt 4(%esp) +1: fprem1 + fstsw %ax + sahf + jp 1b + fstp %st(1) +/* Extract the three low-order bits of the quotient from C0,C3,C1. */ + shrl $6,%eax + movl %eax,%ecx + andl $0x108,%eax + rorl $7,%eax + orl %eax,%ecx + roll $4,%eax + orl %ecx,%eax + andl $7,%eax +/* Negate the quotient bits if x*y<0. Avoid using an unpredictable branch. */ + movl 24(%esp),%ecx + xorl 12(%esp),%ecx + movsx %cx,%ecx + sarl $16,%ecx + sarl $16,%ecx + xorl %ecx,%eax + andl $1,%ecx + addl %ecx,%eax +/* Store the quotient and return. */ + movl 28(%esp),%ecx + movl %eax,(%ecx) + ret diff --git a/arch/i386-all/stdc/math/s_rint.s b/arch/i386-all/stdc/math/s_rint.s new file mode 100644 index 0000000000..fe2ee52235 --- /dev/null +++ b/arch/i386-all/stdc/math/s_rint.s @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(rint) + _FUNCTION(AROS_CDEFNAME(rint)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(rint): + fldl arg_x(%esp) + frndint + ret diff --git a/arch/i386-all/stdc/math/s_rintf.s b/arch/i386-all/stdc/math/s_rintf.s new file mode 100644 index 0000000000..6fb8722d12 --- /dev/null +++ b/arch/i386-all/stdc/math/s_rintf.s @@ -0,0 +1,19 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(rintf) + _FUNCTION(AROS_CDEFNAME(rintf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(rintf): + flds arg_x(%esp) + frndint + ret diff --git a/arch/i386-all/stdc/math/s_rintl.s b/arch/i386-all/stdc/math/s_rintl.s new file mode 100644 index 0000000000..036e67b367 --- /dev/null +++ b/arch/i386-all/stdc/math/s_rintl.s @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(rintl) + _FUNCTION(AROS_CDEFNAME(rintl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(rintl): + fldt arg_x(%esp) + frndint + ret diff --git a/arch/i386-all/stdc/math/s_scalbn.s b/arch/i386-all/stdc/math/s_scalbn.s new file mode 100644 index 0000000000..ecefe62131 --- /dev/null +++ b/arch/i386-all/stdc/math/s_scalbn.s @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1994 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(scalbn) + _FUNCTION(AROS_CDEFNAME(scalbn)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 12 /* Skip FirstArg */ + .set arg_n, SecondArg + +AROS_CDEFNAME(scalbn): + fildl arg_n(%esp) + fldl arg_x(%esp) + fscale + fstp %st(1) + ret + +.globl AROS_CDEFNAME(ldexp) +.set AROS_CDEFNAME(ldexp),AROS_CDEFNAME(scalbn) diff --git a/arch/i386-all/stdc/math/s_scalbnf.s b/arch/i386-all/stdc/math/s_scalbnf.s new file mode 100644 index 0000000000..b235a92728 --- /dev/null +++ b/arch/i386-all/stdc/math/s_scalbnf.s @@ -0,0 +1,27 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(scalbnf) + _FUNCTION(AROS_CDEFNAME(scalbnf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 8 /* Skip FirstArg */ + .set arg_n, SecondArg + +AROS_CDEFNAME(scalbnf): + fildl arg_n(%esp) + flds arg_x(%esp) + fscale + fstp %st(1) /* bug fix for fp stack overflow */ + ret + +.globl AROS_CDEFNAME(ldexpf) +.set AROS_CDEFNAME(ldexpf),AROS_CDEFNAME(scalbnf) diff --git a/arch/i386-all/stdc/math/s_scalbnl.s b/arch/i386-all/stdc/math/s_scalbnl.s new file mode 100644 index 0000000000..6db96bdf24 --- /dev/null +++ b/arch/i386-all/stdc/math/s_scalbnl.s @@ -0,0 +1,27 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(scalbnl) + _FUNCTION(AROS_CDEFNAME(scalbnl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + + .set SecondArg, 16 /* Skip FirstArg */ + .set arg_n, SecondArg + +AROS_CDEFNAME(scalbnl): + fildl arg_n(%esp) + fldt arg_x(%esp) + fscale + fstp %st(1) + ret + +.globl AROS_CDEFNAME(ldexpl) +.set AROS_CDEFNAME(ldexpl),AROS_CDEFNAME(scalbnl) diff --git a/arch/i386-all/stdc/math/s_significand.s b/arch/i386-all/stdc/math/s_significand.s new file mode 100644 index 0000000000..712e87d84b --- /dev/null +++ b/arch/i386-all/stdc/math/s_significand.s @@ -0,0 +1,50 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(significand) + _FUNCTION(AROS_CDEFNAME(significand)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(significand): + fldl arg_x(%esp) + fxtract + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/s_significandf.s b/arch/i386-all/stdc/math/s_significandf.s new file mode 100644 index 0000000000..35ca2d4ddc --- /dev/null +++ b/arch/i386-all/stdc/math/s_significandf.s @@ -0,0 +1,20 @@ +/* + * Written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(significandf) + _FUNCTION(AROS_CDEFNAME(significandf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(significandf): + flds arg_x(%esp) + fxtract + fstp %st(1) + ret diff --git a/arch/i386-all/stdc/math/s_sin.s b/arch/i386-all/stdc/math/s_sin.s new file mode 100644 index 0000000000..19fa3ed2cf --- /dev/null +++ b/arch/i386-all/stdc/math/s_sin.s @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1994 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(sin) + _FUNCTION(AROS_CDEFNAME(sin)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(sin): + fldl arg_x(%esp) + fsin + fnstsw %ax + sahf + jp 1f + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem + fnstsw %ax + sahf + jp 2b + fstp %st(1) + fsin + ret diff --git a/arch/i386-all/stdc/math/s_tan.s b/arch/i386-all/stdc/math/s_tan.s new file mode 100644 index 0000000000..384abe0230 --- /dev/null +++ b/arch/i386-all/stdc/math/s_tan.s @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1994 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Written by: + * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(tan) + _FUNCTION(AROS_CDEFNAME(tan)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(tan): + fldl arg_x(%esp) + fptan + fnstsw %ax + sahf + jp 1f + fstp %st(0) + ret +1: fldpi + fadd %st(0) + fxch %st(1) +2: fprem + fnstsw %ax + sahf + jp 2b + fstp %st(1) + fptan + fstp %st(0) + ret diff --git a/arch/i386-all/stdc/math/s_trunc.s b/arch/i386-all/stdc/math/s_trunc.s new file mode 100644 index 0000000000..4f009ce9c3 --- /dev/null +++ b/arch/i386-all/stdc/math/s_trunc.s @@ -0,0 +1,33 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(trunc) + _FUNCTION(AROS_CDEFNAME(trunc)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(trunc): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0c00,%dx /* round towards -oo */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldl 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_truncf.s b/arch/i386-all/stdc/math/s_truncf.s new file mode 100644 index 0000000000..93368dd6e3 --- /dev/null +++ b/arch/i386-all/stdc/math/s_truncf.s @@ -0,0 +1,33 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(truncf) + _FUNCTION(AROS_CDEFNAME(truncf)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(truncf): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0c00,%dx /* round towards -oo */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + flds 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/math/s_truncl.s b/arch/i386-all/stdc/math/s_truncl.s new file mode 100644 index 0000000000..abde7f3ca2 --- /dev/null +++ b/arch/i386-all/stdc/math/s_truncl.s @@ -0,0 +1,33 @@ +/* + * Based on code written by J.T. Conklin . + * Public domain. + */ + + #include "aros/i386/asm.h" + + .text + _ALIGNMENT + .globl AROS_CDEFNAME(truncl) + _FUNCTION(AROS_CDEFNAME(truncl)) + + .set FirstArg, 4 /* Skip Return-Adress */ + .set arg_x, FirstArg + +AROS_CDEFNAME(truncl): + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + orw $0x0c00,%dx /* round towards -oo */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldt 8(%ebp) /* round */ + frndint + + fldcw -4(%ebp) /* restore original control word */ + + leave + ret diff --git a/arch/i386-all/stdc/mmakefile.src b/arch/i386-all/stdc/mmakefile.src index 6459b97109..f4658883ea 100644 --- a/arch/i386-all/stdc/mmakefile.src +++ b/arch/i386-all/stdc/mmakefile.src @@ -3,12 +3,84 @@ include $(SRCDIR)/config/aros.cfg +USER_CFLAGS := -I$(SRCDIR)/compiler/stdc/math/ld80 USER_AFLAGS := -I$(GENINCDIR) +STDC_I386_SSE_FILES := \ + sse + +STDC_I386_FILES := \ + fenv \ + $(STDC_I386_SSE_FILES) + +STDC_I386_ASMFILES := \ + longjmp \ + setjmp + +# Add replacement math functions .. +STDC_I386_FILES += \ + math/ld80/invtrig + +STDC_I386_ASMFILES += \ + math/e_exp \ + math/e_fmod \ + math/e_log \ + math/e_log10 \ + math/e_remainder \ + math/e_sqrt \ + math/s_ceil \ + math/s_copysign \ + math/s_floor \ + math/s_llrint \ + math/s_logb \ + math/s_lrint \ + math/s_remquo \ + math/s_rint \ + math/s_scalbn \ + math/s_significand \ + math/s_trunc + +# s_finite \ + +# float counterparts +STDC_I386_ASMFILES += \ + math/e_fmodf \ + math/e_log10f \ + math/e_logf \ + math/e_remainderf \ + math/e_sqrtf \ + math/s_ceilf \ + math/s_copysignf \ + math/s_floorf \ + math/s_llrintf \ + math/s_logbf \ + math/s_lrintf \ + math/s_remquof \ + math/s_rintf \ + math/s_scalbnf \ + math/s_significandf \ + math/s_truncf + +# long double counterparts +STDC_I386_ASMFILES += \ + math/e_fmodl \ + math/e_remainderl \ + math/e_sqrtl \ + math/s_ceill \ + math/s_copysignl \ + math/s_floorl \ + math/s_llrintl \ + math/s_logbl \ + math/s_lrintl \ + math/s_remquol \ + math/s_rintl \ + math/s_scalbnl \ + math/s_truncl + %build_archspecific \ mainmmake=compiler-stdc \ maindir=compiler/stdc \ arch=i386 \ - files="fenv sse" linklibfiles="sse" asmfiles="longjmp setjmp" + files="$(STDC_I386_FILES)" linklibfiles="$(STDC_I386_SSE_FILES)" asmfiles="$(STDC_I386_ASMFILES)" #MM- compiler-stdc-i386 : includes-asm_h-i386 -- 2.11.4.GIT