[powerpc] Fix stpcpy performance for power8

Message ID 20150727124637.GA12017@domone
State Committed
Delegated to: Tulio Magno Quites Machado Filho
Headers

Commit Message

Ondrej Bilka July 27, 2015, 12:46 p.m. UTC
  Hi,

I decided to read powerpc code that according to statements only people
with good intuition could understand so I was curious what these experts
do to get good performance.

Here its most elementary problem, it wasn't turned on. Fixing that is
obvious, add implementation to ifunc. 

	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.
  

Comments

Adhemerval Zanella July 27, 2015, 1:25 p.m. UTC | #1
LGTM, thanks for checking on that.

On 27-07-2015 09:46, Ondřej Bílka wrote:
> Hi,
> 
> I decided to read powerpc code that according to statements only people
> with good intuition could understand so I was curious what these experts
> do to get good performance.
> 
> Here its most elementary problem, it wasn't turned on. Fixing that is
> obvious, add implementation to ifunc. 
> 
> 	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.
>  
> diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
> index a5e1c03..3a25cf8 100644
> --- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
> +++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
> @@ -24,10 +24,13 @@
>  
>  extern __typeof (__stpcpy) __stpcpy_ppc attribute_hidden;
>  extern __typeof (__stpcpy) __stpcpy_power7 attribute_hidden;
> +extern __typeof (__stpcpy) __stpcpy_power8 attribute_hidden;
>  
>  libc_ifunc (__stpcpy,
> -            (hwcap & PPC_FEATURE_HAS_VSX)
> -            ? __stpcpy_power7
> +            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
> +            ? __stpcpy_power8 :
> +              (hwcap & PPC_FEATURE_HAS_VSX)
> +              ? __stpcpy_power7
>              : __stpcpy_ppc);
>  
>  weak_alias (__stpcpy, stpcpy)
>
  
Tulio Magno Quites Machado Filho Aug. 5, 2015, 5:39 p.m. UTC | #2
Ondřej Bílka <neleai@seznam.cz> writes:

> 	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.

LGTM.

Thanks!!
  
Adhemerval Zanella Aug. 11, 2015, 1:13 p.m. UTC | #3
I pushed this upstream as 5011051da35a91577d262040791cbe5a868cffbd

On 05-08-2015 14:39, Tulio Magno Quites Machado Filho wrote:
> Ondřej Bílka <neleai@seznam.cz> writes:
> 
>> 	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c: Fix ifunc.
> 
> LGTM.
> 
> Thanks!!
>
  

Patch

diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
index a5e1c03..3a25cf8 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
@@ -24,10 +24,13 @@ 
 
 extern __typeof (__stpcpy) __stpcpy_ppc attribute_hidden;
 extern __typeof (__stpcpy) __stpcpy_power7 attribute_hidden;
+extern __typeof (__stpcpy) __stpcpy_power8 attribute_hidden;
 
 libc_ifunc (__stpcpy,
-            (hwcap & PPC_FEATURE_HAS_VSX)
-            ? __stpcpy_power7
+            (hwcap2 & PPC_FEATURE2_ARCH_2_07)
+            ? __stpcpy_power8 :
+              (hwcap & PPC_FEATURE_HAS_VSX)
+              ? __stpcpy_power7
             : __stpcpy_ppc);
 
 weak_alias (__stpcpy, stpcpy)