[haiku-commits] r34652 - in haiku/trunk/src/system/libroot/posix/glibc/arch: generic m68k ppc x86

  • From: korli@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 13 Dec 2009 15:22:13 +0100 (CET)

Author: korli
Date: 2009-12-13 15:22:13 +0100 (Sun, 13 Dec 2009)
New Revision: 34652
Changeset: http://dev.haiku-os.org/changeset/34652/haiku
Ticket: http://dev.haiku-os.org/ticket/5114

Added:
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fma.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmal.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmax.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmin.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminf.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminl.c
   haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fma.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmal.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmax.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmin.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminf.S
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminl.S
Modified:
   haiku/trunk/src/system/libroot/posix/glibc/arch/m68k/Jamfile
   haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile
   haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile
Log:
added fmin, fma, fmax from glibc (ticket #5114).


Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fma.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fma.c             
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fma.c     
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c            
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaf.c    
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+float
+__fmaf (float x, float y, float z)
+{
+  return (x * y) + z;
+}
+weak_alias (__fmaf, fmaf)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmal.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmal.c            
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmal.c    
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+long double
+__fmal (long double x, long double y, long double z)
+{
+  return (x * y) + z;
+}
+weak_alias (__fmal, fmal)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmax.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmax.c            
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmax.c    
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c           
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxf.c   
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+float
+__fmaxf (float x, float y)
+{
+  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxf, fmaxf)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c           
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmaxl.c   
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+long double
+__fmaxl (long double x, long double y)
+{
+  return (isgreaterequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fmaxl, fmaxl)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmin.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmin.c            
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fmin.c    
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminf.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminf.c           
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminf.c   
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+float
+__fminf (float x, float y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminf, fminf)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminl.c
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminl.c           
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/generic/s_fminl.c   
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <math.h>
+
+
+long double
+__fminl (long double x, long double y)
+{
+  return (islessequal (x, y) || isnan (y)) ? x : y;
+}
+weak_alias (__fminl, fminl)

Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/m68k/Jamfile
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/m68k/Jamfile        
2009-12-13 13:28:28 UTC (rev 34651)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/m68k/Jamfile        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -72,6 +72,9 @@
        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

Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2009-12-13 
13:28:28 UTC (rev 34651)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2009-12-13 
14:22:13 UTC (rev 34652)
@@ -70,6 +70,7 @@
        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 @@
 
        e_sqrt.c e_sqrtf.c # e_sqrtl.c
        s_copysign.S s_copysignf.S # s_copysignl.S
+       s_fabs.S s_fabsf.S # s_fabsl.S
        s_fdim.c s_fdimf.c # s_fdiml.S
-       s_fabs.S s_fabsf.S # s_fabsl.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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmax.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <sysdep.h>
+
+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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmaxf.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -0,0 +1 @@
+/* __fmaxf is in s_fmax.c  */

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fmin.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <sysdep.h>
+
+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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/s_fminf.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -0,0 +1 @@
+/* __fminf is in s_fmin.c  */

Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile 2009-12-13 
13:28:28 UTC (rev 34651)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/Jamfile 2009-12-13 
14:22:13 UTC (rev 34652)
@@ -149,6 +149,9 @@
        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

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fma.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fma.S                 
        (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fma.S 2009-12-13 
14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaf.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmal.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmal.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmal.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmax.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmax.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmax.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxf.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmaxl.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmin.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmin.S                
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fmin.S        
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminf.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminf.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminf.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)

Added: haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminl.S
===================================================================
--- haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminl.S               
                (rev 0)
+++ haiku/trunk/src/system/libroot/posix/glibc/arch/x86/s_fminl.S       
2009-12-13 14:22:13 UTC (rev 34652)
@@ -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 <drepper@xxxxxxxxxx>, 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 <sysdep.h>
+
+       .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)


Other related posts:

  • » [haiku-commits] r34652 - in haiku/trunk/src/system/libroot/posix/glibc/arch: generic m68k ppc x86 - korli