linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Anton Blanchard <anton@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>,
	acsawdey@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/2] powerpc: Align hot loops of some string functions
Date: Fri, 27 May 2016 01:26:53 -0500	[thread overview]
Message-ID: <20160527062653.GC4267@gate.crashing.org> (raw)
In-Reply-To: <91429364-b0f4-89c2-dc92-1cc40970d3e3@c-s.fr>

On Fri, May 27, 2016 at 07:45:18AM +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).
> >
> 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

  reply	other threads:[~2016-05-27  6:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 22:38 [PATCH 1/2] powerpc: Remove assembly versions of strcpy, strcat, strlen and strcmp Anton Blanchard
2016-05-25 22:39 ` [PATCH 2/2] powerpc: Align hot loops of some string functions Anton Blanchard
2016-05-26  7:24   ` Christophe Leroy
2016-05-26 19:37     ` Segher Boessenkool
2016-05-27  5:45       ` Christophe Leroy
2016-05-27  6:26         ` Segher Boessenkool [this message]
2016-06-15 12:39   ` [2/2] " Michael Ellerman
2016-06-15 12:39 ` [1/2] powerpc: Remove assembly versions of strcpy, strcat, strlen and strcmp Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160527062653.GC4267@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=acsawdey@linux.vnet.ibm.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).