public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: MAHESH BODAPATI <bmahi496@linux.ibm.com>
To: Paul E Murphy <murphyp@linux.ibm.com>, libc-alpha@sourceware.org
Cc: bergner@linux.ibm.com
Subject: Re: [PATCH] powerpc64: Add optimized strcpy and stpcpy for POWER10
Date: Mon, 24 Jun 2024 17:40:24 +0530	[thread overview]
Message-ID: <83a467be-4602-4504-8815-b5ca4b9b8f88@linux.ibm.com> (raw)
In-Reply-To: <f07225b4-d897-45f7-b80b-bffa92fc3313@linux.ibm.com>


On 21/06/24 3:10 am, Paul E Murphy wrote:
>
>
> On 6/16/24 6:49 AM, bmahi496@linux.ibm.com wrote:
>
>> +/* Implements the function
>> +
>> +   char * [r3] strcpy (char *dest [r3], const char *src [r4])
>> +
>> +   or
>> +
>> +   char * [r3] stpcpy (char *dest [r3], const char *src [r4])
>> +
>> +   if USE_AS_STPCPY is defined.
>> +
>> +   The implementation can load bytes past a NULL terminator, but only
>> +   up to the next 16B/64B boundary, so it never crosses a page.  */
>
> I think this comment is confusing.  Maybe it suffices to say that it 
> never reads across a page boundary, but may read beyond the NUL 
> terminator.
>
>

I will update the comment.


>> +
>> +
>> +#define LXVP(xtp,dq,ra)        \
>> +    .long(((6)<<(32-6))        \
>> +          | ((((xtp)-32)>>1)<<(32-10)) \
>> +          | ((1)<<(32-11))         \
>> +          | ((ra)<<(32-16))        \
>> +          | dq)
>> +
>> +/* Load 4 quadwords, merge into one VR for speed and check for NULLs
>> +   and branch to label if NULL is found.  */
>> +#define CHECK_64B(offset,addr,label)      \
>> +    LXVP(v4+32,offset,addr);        \
>> +    LXVP(v6+32,offset+32,addr);     \
>
> Have you benchmarked using lxv vs lxvp here?  If the performance 
> difference is marginal, I think this implementation could be used for 
> P9 too.
>
>

No, I didn't check. I will do the bench-marking with lxv and update.


>> +    vminub    v14,v4,v5;        \
>> +    vminub    v15,v6,v7;        \
>> +    vminub    v16,v14,v15;          \
>> +    vcmpequb. v0,v16,v18;           \
>> +    beq     cr6,$+12;           \
>> +    li      r7,offset;          \
>> +    b       L(label);           \
>> +    stxv    32+v5,(offset+0)(r11);      \
>> +    stxv    32+v4,(offset+16)(r11);     \
>> +    stxv    32+v7,(offset+32)(r11);     \
>> +    stxv    32+v6,(offset+48)(r11)
>
> Otherwise, this LGTM with trivial comments addressed.

      reply	other threads:[~2024-06-25  3:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-16 11:49 bmahi496
2024-06-18 16:04 ` Paul E Murphy
2024-06-19  5:47   ` MAHESH BODAPATI
2024-06-20 21:40 ` Paul E Murphy
2024-06-24 12:10   ` MAHESH BODAPATI [this message]

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=83a467be-4602-4504-8815-b5ca4b9b8f88@linux.ibm.com \
    --to=bmahi496@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    --cc=murphyp@linux.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).