unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul E Murphy via Libc-alpha <libc-alpha@sourceware.org>
To: "Paul A. Clarke" <pc@us.ibm.com>
Cc: anton@ozlabs.org, libc-alpha@sourceware.org
Subject: Re: [PATCH] powerpc64le: add optimized strlen for P9
Date: Thu, 4 Jun 2020 08:55:42 -0500	[thread overview]
Message-ID: <efa18569-f82f-f850-2e9b-cfb02be4e3b6@linux.ibm.com> (raw)
In-Reply-To: <20200603204439.GA13031@oc3272150783.ibm.com>



On 6/3/20 3:44 PM, Paul A. Clarke wrote:
>> +	vctzlsbb  r3,v6
>> +	blr
>> +
>> +	/* Test 64B 16B at a time.  The 64B vector loop is optimized for
>> +	   longer strings.  Likewise, we check a multiple of 64B to avoid
>> +	   breaking the alignment calculation below.  */
>> +L(aligned):
>> +	add	  r4,r3,r9
>> +	rldicl.	  r5,r4,60,62  /* Determine the number of 48B loops needed for
>> +                                  alignment to 64B.  And test for zero.  */
> 
> Would it be bad to move the "rldicl." down...
> 
>> +
>> +	lxv	  v0+32,0(r4)
>> +	vcmpequb. v6,v0,v18
>> +	bne	  cr6,L(tail1)
>> +
>> +	lxv	  v0+32,16(r4)
>> +	vcmpequb. v6,v0,v18
>> +	bne 	  cr6,L(tail2)
>> +
>> +	lxv	  v0+32,32(r4)
>> +	vcmpequb. v6,v0,v18
>> +	bne 	  cr6,L(tail3)
>> +
>> +	lxv	  v0+32,48(r4)
>> +	vcmpequb. v6,v0,v18
>> +	bne 	  cr6,L(tail4)
> 
> ...to here, to avoid needlessly penalizing the cases above?

My thinking is the integer op is basically free while we're busy 
executing vector ops (similarly for li).  Likewise, this may put enough 
space between the conditional branch below to ease prediction.  I don't 
claim to have run this against a cycle accurate simulator, so it may not 
really matter.

Similarly, binutils 2.26 should support all P9 instructions here and in 
Anton's other patches.  I did check before pushing the rawmemchr/stpcpy.

  reply	other threads:[~2020-06-04 13:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 19:10 [PATCH] powerpc64le: add optimized strlen for P9 Paul E. Murphy via Libc-alpha
2020-05-21 20:41 ` Lucas A. M. Magalhaes via Libc-alpha
2020-05-27 16:45 ` Paul A. Clarke via Libc-alpha
2020-05-29 16:26   ` Paul E Murphy via Libc-alpha
2020-06-03 20:44     ` Paul A. Clarke via Libc-alpha
2020-06-04 13:55       ` Paul E Murphy via Libc-alpha [this message]
2020-06-05 20:39         ` Paul E Murphy via Libc-alpha

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

  List information: https://www.gnu.org/software/libc/involved.html

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

  git send-email \
    --in-reply-to=efa18569-f82f-f850-2e9b-cfb02be4e3b6@linux.ibm.com \
    --to=libc-alpha@sourceware.org \
    --cc=anton@ozlabs.org \
    --cc=murphyp@linux.ibm.com \
    --cc=pc@us.ibm.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).