From d0c195171329ed1c9897389d215ad9e6e5973284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Sun, 13 Dec 2009 14:22:13 +0000 Subject: [PATCH] added fmin, fma, fmax from glibc (ticket #5114). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34652 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../libroot/posix/glibc/arch/generic/s_fma.c | 33 ++++++++++++++ .../libroot/posix/glibc/arch/generic/s_fmaf.c | 28 ++++++++++++ .../libroot/posix/glibc/arch/generic/s_fmal.c | 28 ++++++++++++ .../libroot/posix/glibc/arch/generic/s_fmax.c | 33 ++++++++++++++ .../posix/glibc/arch/generic/s_fmaxf.c | 29 ++++++++++++ .../posix/glibc/arch/generic/s_fmaxl.c | 29 ++++++++++++ .../libroot/posix/glibc/arch/generic/s_fmin.c | 33 ++++++++++++++ .../posix/glibc/arch/generic/s_fminf.c | 29 ++++++++++++ .../posix/glibc/arch/generic/s_fminl.c | 29 ++++++++++++ .../libroot/posix/glibc/arch/m68k/Jamfile | 3 ++ .../libroot/posix/glibc/arch/ppc/Jamfile | 5 ++- .../libroot/posix/glibc/arch/ppc/s_fmax.S | 43 ++++++++++++++++++ .../libroot/posix/glibc/arch/ppc/s_fmaxf.S | 1 + .../libroot/posix/glibc/arch/ppc/s_fmin.S | 43 ++++++++++++++++++ .../libroot/posix/glibc/arch/ppc/s_fminf.S | 1 + .../libroot/posix/glibc/arch/x86/Jamfile | 3 ++ .../libroot/posix/glibc/arch/x86/s_fma.S | 31 +++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmaf.S | 31 +++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmal.S | 32 ++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmax.S | 44 +++++++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmaxf.S | 44 +++++++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmaxl.S | 44 +++++++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fmin.S | 44 +++++++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fminf.S | 44 +++++++++++++++++++ .../libroot/posix/glibc/arch/x86/s_fminl.S | 44 +++++++++++++++++++ 25 files changed, 727 insertions(+), 1 deletion(-) create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fma.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmaf.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmal.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmax.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fmin.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fminf.c create mode 100644 src/system/libroot/posix/glibc/arch/generic/s_fminl.c create mode 100644 src/system/libroot/posix/glibc/arch/ppc/s_fmax.S create mode 100644 src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S create mode 100644 src/system/libroot/posix/glibc/arch/ppc/s_fmin.S create mode 100644 src/system/libroot/posix/glibc/arch/ppc/s_fminf.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fma.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmaf.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmal.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmax.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fmin.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fminf.S create mode 100644 src/system/libroot/posix/glibc/arch/x86/s_fminl.S diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fma.c b/src/system/libroot/posix/glibc/arch/generic/s_fma.c new file mode 100644 index 0000000000..e5ff5a7228 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fma.c @@ -0,0 +1,33 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997, 2001 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +double +__fma (double x, double y, double z) +{ + return (x * y) + z; +} +weak_alias (__fma, fma) + +#ifdef NO_LONG_DOUBLE +strong_alias (__fma, __fmal) +weak_alias (__fmal, fmal) +#endif diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c b/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c new file mode 100644 index 0000000000..caa7f3afe8 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c @@ -0,0 +1,28 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +float +__fmaf (float x, float y, float z) +{ + return (x * y) + z; +} +weak_alias (__fmaf, fmaf) diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmal.c b/src/system/libroot/posix/glibc/arch/generic/s_fmal.c new file mode 100644 index 0000000000..b89e88b9a3 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmal.c @@ -0,0 +1,28 @@ +/* Compute x * y + z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +long double +__fmal (long double x, long double y, long double z) +{ + return (x * y) + z; +} +weak_alias (__fmal, fmal) diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmax.c b/src/system/libroot/posix/glibc/arch/generic/s_fmax.c new file mode 100644 index 0000000000..f93e14f28c --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmax.c @@ -0,0 +1,33 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +double +__fmax (double x, double y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmax, fmax) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmax, __fmaxl) +weak_alias (__fmax, fmaxl) +#endif diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c b/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c new file mode 100644 index 0000000000..6f368e18b0 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c @@ -0,0 +1,29 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +float +__fmaxf (float x, float y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxf, fmaxf) diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c b/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c new file mode 100644 index 0000000000..68c7060f42 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c @@ -0,0 +1,29 @@ +/* Return maximum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +long double +__fmaxl (long double x, long double y) +{ + return (isgreaterequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmaxl, fmaxl) diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fmin.c b/src/system/libroot/posix/glibc/arch/generic/s_fmin.c new file mode 100644 index 0000000000..78f02da74a --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fmin.c @@ -0,0 +1,33 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +double +__fmin (double x, double y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fmin, fmin) +#ifdef NO_LONG_DOUBLE +strong_alias (__fmin, __fminl) +weak_alias (__fmin, fminl) +#endif diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fminf.c b/src/system/libroot/posix/glibc/arch/generic/s_fminf.c new file mode 100644 index 0000000000..d6aa9ccf62 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fminf.c @@ -0,0 +1,29 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +float +__fminf (float x, float y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminf, fminf) diff --git a/src/system/libroot/posix/glibc/arch/generic/s_fminl.c b/src/system/libroot/posix/glibc/arch/generic/s_fminl.c new file mode 100644 index 0000000000..5c1610aa85 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/generic/s_fminl.c @@ -0,0 +1,29 @@ +/* Return minimum numeric value of X and Y. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + +long double +__fminl (long double x, long double y) +{ + return (islessequal (x, y) || isnan (y)) ? x : y; +} +weak_alias (__fminl, fminl) diff --git a/src/system/libroot/posix/glibc/arch/m68k/Jamfile b/src/system/libroot/posix/glibc/arch/m68k/Jamfile index 557db318da..d93cba6af2 100644 --- a/src/system/libroot/posix/glibc/arch/m68k/Jamfile +++ b/src/system/libroot/posix/glibc/arch/m68k/Jamfile @@ -72,6 +72,9 @@ local genericSources = s_fabs.c s_fabsf.c # s_fabsl.S s_finite.c s_finitef.c # s_finitel.c s_floor.c s_floorf.c # s_floorl.c + s_fma.c s_fmaf.c # s_fmal.c + s_fmax.c s_fmaxf.c # s_fmaxl.c + s_fmin.c s_fminf.c # s_fminl.c s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c s_frexp.c s_frexpf.c # s_frexpl.c s_ilogb.c s_ilogbf.c diff --git a/src/system/libroot/posix/glibc/arch/ppc/Jamfile b/src/system/libroot/posix/glibc/arch/ppc/Jamfile index 4750a7f34f..44ad8c5fc5 100644 --- a/src/system/libroot/posix/glibc/arch/ppc/Jamfile +++ b/src/system/libroot/posix/glibc/arch/ppc/Jamfile @@ -70,6 +70,7 @@ local genericSources = s_expm1f.c s_expm1.c s_finite.c s_finitef.c # s_finitel.c s_floor.c s_floorf.c # s_floorl.c + s_fma.c s_fmaf.c # s_fmal.c s_fpclassify.c s_fpclassifyf.c # s_fpclassifyl.c s_frexp.c s_frexpf.c # s_frexpl.c s_ilogb.c s_ilogbf.c @@ -135,8 +136,10 @@ MergeObject posix_gnu_arch_$(TARGET_ARCH)_other.o : e_sqrt.c e_sqrtf.c # e_sqrtl.c s_copysign.S s_copysignf.S # s_copysignl.S - s_fdim.c s_fdimf.c # s_fdiml.S s_fabs.S s_fabsf.S # s_fabsl.S + s_fdim.c s_fdimf.c # s_fdiml.S + s_fmax.S s_fmaxf.S # s_fmaxl.S + s_fmin.S s_fminf.S # s_fminl.S s_isnan.c s_isnanf.S s_rint.c s_rintf.c # s_rintl.c t_sqrt.c diff --git a/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S b/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S new file mode 100644 index 0000000000..8502c863b2 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S @@ -0,0 +1,43 @@ +/* Floating-point maximum. PowerPC version. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +ENTRY(__fmax) +/* double [f1] fmax (double [f1] x, double [f2] y); */ + fcmpu cr0,fp1,fp2 + blt cr0,0f /* if x < y, neither x nor y can be NaN... */ + bnulr+ cr0 +/* x and y are unordered, so one of x or y must be a NaN... */ + fcmpu cr1,fp2,fp2 + bunlr cr1 +0: fmr fp1,fp2 + blr +END(__fmax) + +weak_alias (__fmax,fmax) + +/* It turns out that it's safe to use this code even for single-precision. */ +strong_alias(__fmax,__fmaxf) +weak_alias (__fmax,fmaxf) + +#ifdef NO_LONG_DOUBLE +weak_alias (__fmax,__fmaxl) +weak_alias (__fmax,fmaxl) +#endif diff --git a/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S b/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S new file mode 100644 index 0000000000..3c2d62bb81 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S @@ -0,0 +1 @@ +/* __fmaxf is in s_fmax.c */ diff --git a/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S b/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S new file mode 100644 index 0000000000..5f788d06f3 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S @@ -0,0 +1,43 @@ +/* Floating-point minimum. PowerPC version. + Copyright (C) 1997, 1999 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + +ENTRY(__fmin) +/* double [f1] fmin (double [f1] x, double [f2] y); */ + fcmpu cr0,fp1,fp2 + bgt cr0,0f /* if x > y, neither x nor y can be NaN... */ + bnulr+ cr0 +/* x and y are unordered, so one of x or y must be a NaN... */ + fcmpu cr1,fp2,fp2 + bunlr cr1 +0: fmr fp1,fp2 + blr +END(__fmin) + +weak_alias (__fmin,fmin) + +/* It turns out that it's safe to use this code even for single-precision. */ +strong_alias(__fmin,__fminf) +weak_alias (__fmin,fminf) + +#ifdef NO_LONG_DOUBLE +weak_alias (__fmin,__fminl) +weak_alias (__fmin,fminl) +#endif diff --git a/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S b/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S new file mode 100644 index 0000000000..10ab7fe53c --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S @@ -0,0 +1 @@ +/* __fminf is in s_fmin.c */ diff --git a/src/system/libroot/posix/glibc/arch/x86/Jamfile b/src/system/libroot/posix/glibc/arch/x86/Jamfile index c63c9c5656..e3e3958006 100644 --- a/src/system/libroot/posix/glibc/arch/x86/Jamfile +++ b/src/system/libroot/posix/glibc/arch/x86/Jamfile @@ -149,6 +149,9 @@ MergeObject posix_gnu_arch_$(TARGET_ARCH)_s.o : s_fabs.S s_fabsf.S s_fabsl.S s_finite.S s_finitef.S s_finitel.S s_floor.S s_floorf.S s_floorl.S + s_fma.S s_fmaf.S s_fmal.S + s_fmax.S s_fmaxf.S s_fmaxl.S + s_fmin.S s_fminf.S s_fminl.S s_fpclassifyl.c s_frexp.S s_frexpf.S s_frexpl.S s_ilogb.S s_ilogbf.S diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fma.S b/src/system/libroot/posix/glibc/arch/x86/s_fma.S new file mode 100644 index 0000000000..db4959ccfc --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fma.S @@ -0,0 +1,31 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fma) + fldl 4(%esp) // x + fmull 12(%esp) // x * y + fldl 20(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fma) +weak_alias (__fma, fma) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S b/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S new file mode 100644 index 0000000000..5f875532a8 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S @@ -0,0 +1,31 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmaf) + flds 4(%esp) // x + fmuls 8(%esp) // x * y + flds 12(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fmaf) +weak_alias (__fmaf, fmaf) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmal.S b/src/system/libroot/posix/glibc/arch/x86/s_fmal.S new file mode 100644 index 0000000000..1837f848c0 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmal.S @@ -0,0 +1,32 @@ +/* Compute (X * Y) + Z as ternary operation. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmal) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + fmulp // x * y + fldt 28(%esp) // z : x * y + faddp // (x * y) + z + ret +END(__fmal) +weak_alias (__fmal, fmal) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmax.S b/src/system/libroot/posix/glibc/arch/x86/s_fmax.S new file mode 100644 index 0000000000..fd8cfae53d --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmax.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmax) + fldl 12(%esp) // y + fxam + fnstsw + fldl 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmax) +weak_alias (__fmax, fmax) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S b/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S new file mode 100644 index 0000000000..4e286f13a8 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmaxf) + flds 8(%esp) // y + fxam + fnstsw + flds 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmaxf) +weak_alias (__fmaxf, fmaxf) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S b/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S new file mode 100644 index 0000000000..4e3105bbb4 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S @@ -0,0 +1,44 @@ +/* Compute maximum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmaxl) + fldt 16(%esp) // y + fxam + fnstsw + fldt 4(%esp) // y : x + + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jnc 1f + + fxch %st(1) +1: fstp %st(1) + + ret +END(__fmaxl) +weak_alias (__fmaxl, fmaxl) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fmin.S b/src/system/libroot/posix/glibc/arch/x86/s_fmin.S new file mode 100644 index 0000000000..b8e72106d2 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fmin.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fmin) + fldl 4(%esp) // x + fldl 12(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fmin) +weak_alias (__fmin, fmin) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fminf.S b/src/system/libroot/posix/glibc/arch/x86/s_fminf.S new file mode 100644 index 0000000000..a81f8c9e13 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fminf.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fminf) + flds 4(%esp) // x + flds 8(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fminf) +weak_alias (__fminf, fminf) diff --git a/src/system/libroot/posix/glibc/arch/x86/s_fminl.S b/src/system/libroot/posix/glibc/arch/x86/s_fminl.S new file mode 100644 index 0000000000..baf15f64c5 --- /dev/null +++ b/src/system/libroot/posix/glibc/arch/x86/s_fminl.S @@ -0,0 +1,44 @@ +/* Compute minimum of two numbers, regarding NaN as missing argument. + Copyright (C) 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include + + .text +ENTRY(__fminl) + fldt 4(%esp) // x + fldt 16(%esp) // x : y + + fxam + fnstsw + andb $0x45, %ah + cmpb $0x01, %ah + je 1f // y == NaN + + fucom %st(1) + fnstsw + sahf + jc 2f + +1: fxch %st(1) +2: fstp %st(1) + + ret +END(__fminl) +weak_alias (__fminl, fminl)