public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul E Murphy <murphyp@linux.ibm.com>
To: bmahi496@linux.ibm.com, libc-alpha@sourceware.org
Cc: bergner@linux.ibm.com
Subject: Re: [PATCH] powerpc64: Add optimized strcpy and stpcpy for POWER10
Date: Thu, 20 Jun 2024 16:40:05 -0500	[thread overview]
Message-ID: <f07225b4-d897-45f7-b80b-bffa92fc3313@linux.ibm.com> (raw)
In-Reply-To: <20240616114947.413012-1-bmahi496@linux.ibm.com>



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.


> +
> +
> +#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.


> +	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.

  parent reply	other threads:[~2024-06-20 22:27 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 [this message]
2024-06-24 12:10   ` MAHESH BODAPATI

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=f07225b4-d897-45f7-b80b-bffa92fc3313@linux.ibm.com \
    --to=murphyp@linux.ibm.com \
    --cc=bergner@linux.ibm.com \
    --cc=bmahi496@linux.ibm.com \
    --cc=libc-alpha@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).