diff mbox series

[02/28] powerpc: fma using builtins

Message ID 20190329133529.22523-3-adhemerval.zanella@linaro.org
State New
Headers show
Series powerpc floating-point optimization refactor | expand

Commit Message

Adhemerval Zanella Netto March 29, 2019, 1:35 p.m. UTC
This patch just refactor the assembly implementation to use compiler
builtins instead.

Checked on powerpc-linux-gnu (built without --with-cpu, with
--with-cpu=power4 and with --with-cpu=power5+ and --disable-multi-arch),
powerpc64-linux-gnu (built without --with-cp and with --with-cpu=power5+
and --disable-multi-arch).

	* sysdeps/powerpc/fpu/s_fma.S: Remove file.
	* sysdeps/powerpc/fpu/s_fmaf.S: Likewise.
	* sysdeps/powerpc/fpu/s_fma.c: New file.
	* sysdeps/powerpc/fpu/s_fmaf.c: Likewise.
---
 sysdeps/powerpc/fpu/{s_fma.S => s_fma.c}   | 12 +++++-------
 sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} | 12 +++++-------
 2 files changed, 10 insertions(+), 14 deletions(-)
 rename sysdeps/powerpc/fpu/{s_fma.S => s_fma.c} (82%)
 rename sysdeps/powerpc/fpu/{s_fmaf.S => s_fmaf.c} (82%)

-- 
2.17.1

Comments

Joseph Myers April 1, 2019, 8:05 p.m. UTC | #1
On Fri, 29 Mar 2019, Adhemerval Zanella wrote:

> +double __fma (double x, double y, double z)


This is not a correctly formatted function definition (return type should 
be on its own line).

> +float __fmaf (float x, float y, float z)


Likewise.

-- 
Joseph S. Myers
joseph@codesourcery.com
Adhemerval Zanella Netto April 3, 2019, 1:06 a.m. UTC | #2
On 02/04/2019 03:05, Joseph Myers wrote:
> On Fri, 29 Mar 2019, Adhemerval Zanella wrote:

> 

>> +double __fma (double x, double y, double z)

> 

> This is not a correctly formatted function definition (return type should 

> be on its own line).


Fixed locally.

> 

>> +float __fmaf (float x, float y, float z)

> 

> Likewise.

> 


Ditto.
Gabriel F. T. Gomes April 15, 2019, 9:44 p.m. UTC | #3
On Wed, Apr 03 2019, Adhemerval Zanella wrote:
> 

> On 02/04/2019 03:05, Joseph Myers wrote:

> > On Fri, 29 Mar 2019, Adhemerval Zanella wrote:

> > 

> >> +double __fma (double x, double y, double z)

> > 

> > This is not a correctly formatted function definition (return type should 

> > be on its own line).

> 

> Fixed locally.

> 

> > 

> >> +float __fmaf (float x, float y, float z)

> > 

> > Likewise.

> > 

> 

> Ditto.


Looks good to me.
Joseph Myers April 17, 2019, 9:10 p.m. UTC | #4
On Wed, 3 Apr 2019, Adhemerval Zanella wrote:

> On 02/04/2019 03:05, Joseph Myers wrote:

> > On Fri, 29 Mar 2019, Adhemerval Zanella wrote:

> > 

> >> +double __fma (double x, double y, double z)

> > 

> > This is not a correctly formatted function definition (return type should 

> > be on its own line).

> 

> Fixed locally.

> 

> > 

> >> +float __fmaf (float x, float y, float z)

> > 

> > Likewise.

> > 

> 

> Ditto.


The committed changes appear to be the wrong version, as they still have 
the incorrect formatting.

-- 
Joseph S. Myers
joseph@codesourcery.com
Adhemerval Zanella Netto April 17, 2019, 9:28 p.m. UTC | #5
On 17/04/2019 18:10, Joseph Myers wrote:
> On Wed, 3 Apr 2019, Adhemerval Zanella wrote:

> 

>> On 02/04/2019 03:05, Joseph Myers wrote:

>>> On Fri, 29 Mar 2019, Adhemerval Zanella wrote:

>>>

>>>> +double __fma (double x, double y, double z)

>>>

>>> This is not a correctly formatted function definition (return type should 

>>> be on its own line).

>>

>> Fixed locally.

>>

>>>

>>>> +float __fmaf (float x, float y, float z)

>>>

>>> Likewise.

>>>

>>

>> Ditto.

> 

> The committed changes appear to be the wrong version, as they still have 

> the incorrect formatting.

> 


Sorry about that, I will fix.
diff mbox series

Patch

diff --git a/sysdeps/powerpc/fpu/s_fma.S b/sysdeps/powerpc/fpu/s_fma.c
similarity index 82%
rename from sysdeps/powerpc/fpu/s_fma.S
rename to sysdeps/powerpc/fpu/s_fma.c
index 92e08eb583..688f9badf5 100644
--- a/sysdeps/powerpc/fpu/s_fma.S
+++ b/sysdeps/powerpc/fpu/s_fma.c
@@ -1,5 +1,5 @@ 
 /* Compute x * y + z as ternary operation.  PowerPC version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
+   Copyright (C) 2019 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
@@ -19,10 +19,8 @@ 
 #include <sysdep.h>
 #include <libm-alias-double.h>
 
-ENTRY_TOCLESS(__fma)
-/* double [f1] fma (double [f1] x, double [f2] y, double [f3] z); */
-	fmadd	fp1,fp1,fp2,fp3
-	blr
-END(__fma)
-
+double __fma (double x, double y, double z)
+{
+  return __builtin_fma (x, y, z);
+}
 libm_alias_double (__fma, fma)
diff --git a/sysdeps/powerpc/fpu/s_fmaf.S b/sysdeps/powerpc/fpu/s_fmaf.c
similarity index 82%
rename from sysdeps/powerpc/fpu/s_fmaf.S
rename to sysdeps/powerpc/fpu/s_fmaf.c
index 9579e9492e..38b59e1f2f 100644
--- a/sysdeps/powerpc/fpu/s_fmaf.S
+++ b/sysdeps/powerpc/fpu/s_fmaf.c
@@ -1,5 +1,5 @@ 
 /* Compute x * y + z as ternary operation.  PowerPC version.
-   Copyright (C) 2010-2019 Free Software Foundation, Inc.
+   Copyright (C) 2019 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
@@ -19,10 +19,8 @@ 
 #include <sysdep.h>
 #include <libm-alias-float.h>
 
-ENTRY_TOCLESS(__fmaf)
-/* float [f1] fmaf (float [f1] x, float [f2] y, float [f3] z); */
-	fmadds	fp1,fp1,fp2,fp3
-	blr
-END(__fmaf)
-
+float __fmaf (float x, float y, float z)
+{
+  return __builtin_fmaf (x, y, z);
+}
 libm_alias_float (__fma, fma)