[PATCH][BZ #3268] use soft-fp fma in powerpc32/nofpu

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][BZ #3268] use soft-fp fma in powerpc32/nofpu

Steven Munroe
This patch overrides s_fma.c and s_fmaf.c in powerpc32/nofpu to call the __fmadf4()/__fmasf4() soft-fp fma functions.  I also added __fmadf4/__fmasf4 to the Versions file to export them from libc.so so s_fma.c/s_fmaf.c (in libm.so) can call them.

This patch has been updated and verified on powerpc32 with todays CVS.




2007-04-03  Steven Munroe  <[hidden email]>

        [BZ #3268]
        * sysdeps/powerpc/nofpu/Versions (libc): Add __fmasf4 and __fmadf4
        for version GLIBC_2.5.
        * sysdeps/powerpc/nofpu/s_fma.c: New file.
        * sysdeps/powerpc/nofpu/s_fmaf.c: New file.

diff -urN libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/Versions libc25/ports/sysdeps/powerpc/nofpu/Versions
--- libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/Versions 2006-11-22 09:13:11.000000000 -0600
+++ libc25/ports/sysdeps/powerpc/nofpu/Versions 2007-03-30 15:30:12.000000000 -0500
@@ -17,4 +17,7 @@
     __gtdf2; __gtsf2;
     __ltdf2; __ltsf2;
   }
+  GLIBC_2.5 {
+    __fmasf4; __fmadf4;
+  }
 }
diff -urN libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/s_fma.c libc25/ports/sysdeps/powerpc/nofpu/s_fma.c
--- libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/s_fma.c Wed Dec 31 18:00:00 1969
+++ libc25/ports/sysdeps/powerpc/nofpu/s_fma.c Fri Mar 30 15:30:12 2007
@@ -0,0 +1,37 @@
+/* soft-fp x * y + z as ternary operation.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Steven Munroe <[hidden email]>, 2006.
+
+   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>
+
+extern double __fmadf4 (double, double, double);
+
+/* Compute floating point multiply-add with higher (quad) precision.  */
+double
+__fma (double a, double b, double c)
+{
+    return __fmadf4 (a, b, c);
+}
+weak_alias (__fma, fma)
+
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fma, __fmal)
+weak_alias (__fmal, fmal)
+#endif
+
diff -urN libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/s_fmaf.c libc25/ports/sysdeps/powerpc/nofpu/s_fmaf.c
--- libc25-cvstip-20070320/ports/sysdeps/powerpc/nofpu/s_fmaf.c Wed Dec 31 18:00:00 1969
+++ libc25/ports/sysdeps/powerpc/nofpu/s_fmaf.c Fri Mar 30 15:30:12 2007
@@ -0,0 +1,32 @@
+/* soft-fp x * y + z as ternary operation.
+   Copyright (C) 2007 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Steven Munroe <[hidden email]>, 2006.
+
+   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>
+
+extern float __fmasf4 (float, float, float);
+
+/* Compute floating point multiply-add with higher (double) precision.  */
+float
+__fmaf (float a, float b, float c)
+{
+    return __fmasf4 (a, b, c);
+}
+weak_alias (__fmaf, fmaf)
+
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH][BZ #3268] use soft-fp fma in powerpc32/nofpu

Daniel Jacobowitz-2
On Tue, Apr 03, 2007 at 03:12:10PM -0500, Steven Munroe wrote:
> This patch overrides s_fma.c and s_fmaf.c in powerpc32/nofpu to call the __fmadf4()/__fmasf4() soft-fp fma functions.  I also added __fmadf4/__fmasf4 to the Versions file to export them from libc.so so s_fma.c/s_fmaf.c (in libm.so) can call them.
>
> This patch has been updated and verified on powerpc32 with todays CVS.

Are there existing users of the new symbols with the GLIBC_2.5
version?  Otherwise, at this point I suppose the right version would
be GLIBC_2.7.

--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH][BZ #3268] use soft-fp fma in powerpc32/nofpu

Steven Munroe
Daniel Jacobowitz wrote:

>On Tue, Apr 03, 2007 at 03:12:10PM -0500, Steven Munroe wrote:
>  
>
>>This patch overrides s_fma.c and s_fmaf.c in powerpc32/nofpu to call the __fmadf4()/__fmasf4() soft-fp fma functions.  I also added __fmadf4/__fmasf4 to the Versions file to export them from libc.so so s_fma.c/s_fmaf.c (in libm.so) can call them.
>>
>>This patch has been updated and verified on powerpc32 with todays CVS.
>>    
>>
>
>Are there existing users of the new symbols with the GLIBC_2.5
>version?  Otherwise, at this point I suppose the right version would
>be GLIBC_2.7.
>
>  
>
No users that I know of. I'll resubmit doe 2.7