From: Anton Blanchard <hidden> Date: 2016-05-25 22:38:38
A number of our assembly implementations of string functions do not
align their hot loops. I was going to align them manually, but I
realised that they are are almost instruction for instruction
identical to what gcc produces, with the advantage that gcc does
align them.
In light of that, let's just remove the assembly versions.
Signed-off-by: Anton Blanchard <redacted>
---
index e40010a..da3cdff 100644
Index: linux.junk/arch/powerpc/include/asm/string.h
===================================================================
From: Anton Blanchard <hidden> Date: 2016-05-25 22:40:45
Align the hot loops in our assembly implementation of strncpy(),
strncmp() and memchr().
Signed-off-by: Anton Blanchard <redacted>
---
Index: linux.junk/arch/powerpc/lib/string.S
===================================================================
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
quoted hunk
Signed-off-by: Anton Blanchard <redacted>
---
Index: linux.junk/arch/powerpc/lib/string.S
===================================================================
On Thu, May 26, 2016 at 09:24:51AM +0200, Christophe Leroy wrote:
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 ?
Why would that be better? The nops are executed once per function call
in either case, there are the same number of nops in either case, and
on most CPUs nops aren't actually executed anyway (they are decoded and
the thrown away).
Segher
Le 26/05/2016 à 21:37, Segher Boessenkool a écrit :
On Thu, May 26, 2016 at 09:24:51AM +0200, Christophe Leroy wrote:
quoted
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 ?
Why would that be better? The nops are executed once per function call
in either case, there are the same number of nops in either case, and
on most CPUs nops aren't actually executed anyway (they are decoded and
the thrown away).
The idea was to not execute them:
|.balign 16 nop nop _GLOBAL(strcpy) addi r5,r3,-1 addi r4,r4,-1 1: lbzu
r0,1(r4) cmpwi 0,r0,0 stbu r0,1(r5) bne 1b blr |
Christophe
On Fri, May 27, 2016 at 07:45:18AM +0200, Christophe Leroy wrote:
quoted
quoted
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 ?
Why would that be better? The nops are executed once per function call
in either case, there are the same number of nops in either case, and
on most CPUs nops aren't actually executed anyway (they are decoded and
the thrown away).
The idea was to not execute them:
|.balign 16 nop nop _GLOBAL(strcpy) addi r5,r3,-1 addi r4,r4,-1 1:
lbzu r0,1(r4) cmpwi 0,r0,0 stbu r0,1(r5) bne 1b blr |
That performs _worse_ on most modern CPUs (the first decode will decode
less, so instructions are available for execution later). That's why
functions are aligned in the first place!
Segher
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-06-15 12:39:09
On Wed, 2016-25-05 at 22:38:13 UTC, Unknown sender due to SPF wrote:
A number of our assembly implementations of string functions do not
align their hot loops. I was going to align them manually, but I
realised that they are are almost instruction for instruction
identical to what gcc produces, with the advantage that gcc does
align them.
In light of that, let's just remove the assembly versions.
Signed-off-by: Anton Blanchard <redacted>