[PATCH 2/2] powerpc: Align hot loops of some string functions

Christophe Leroy christophe.leroy at c-s.fr
Thu May 26 17:24:51 AEST 2016



Le 26/05/2016 à 00:39, Anton Blanchard via Linuxppc-dev a écrit :
> Align the hot loops in our assembly implementation of strncpy(),
> strncmp() and memchr().
Wouldn't it be better to add nops before the function entry in order to 
get the hot loop aligned, instead of adding nops in the middle of the 
function ?

Christophe
>
> Signed-off-by: Anton Blanchard <anton at samba.org>
> ---
>
> Index: linux.junk/arch/powerpc/lib/string.S
> ===================================================================
> --- linux.junk.orig/arch/powerpc/lib/string.S
> +++ linux.junk/arch/powerpc/lib/string.S
> @@ -24,6 +24,7 @@ _GLOBAL(strncpy)
>   	mtctr	r5
>   	addi	r6,r3,-1
>   	addi	r4,r4,-1
> +	.balign 16
>   1:	lbzu	r0,1(r4)
>   	cmpwi	0,r0,0
>   	stbu	r0,1(r6)
> @@ -42,6 +43,7 @@ _GLOBAL(strncmp)
>   	mtctr	r5
>   	addi	r5,r3,-1
>   	addi	r4,r4,-1
> +	.balign 16
>   1:	lbzu	r3,1(r5)
>   	cmpwi	1,r3,0
>   	lbzu	r0,1(r4)
> @@ -73,6 +75,7 @@ _GLOBAL(memchr)
>   	beq-	2f
>   	mtctr	r5
>   	addi	r3,r3,-1
> +	.balign 16
>   1:	lbzu	r0,1(r3)
>   	cmpw	0,r0,r4
>   	bdnzf	2,1b
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev



More information about the Linuxppc-dev mailing list