public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@linux.ibm.com>
To: Amrita H S <amritahs@linux.vnet.ibm.com>
Cc: libc-alpha@sourceware.org, Paul E Murphy <murphyp@linux.ibm.com>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>
Subject: Re: [V3] powerpc: Optimized strncmp for power10
Date: Fri, 3 May 2024 16:31:27 -0500	[thread overview]
Message-ID: <a7381d88-d25d-4e0a-85cf-7193fdda0f41@linux.ibm.com> (raw)
In-Reply-To: <20240429095847.3541150-1-amritahs@linux.vnet.ibm.com>

On 4/29/24 4:58 AM, Amrita H S wrote:
> +++ b/sysdeps/powerpc/powerpc64/le/power10/strncmp.S
> @@ -0,0 +1,271 @@
> +/* Optimized strncmp implementation for PowerPC64/POWER10.
> +   Copyright (C) 2021-2023 Free Software Foundation, Inc.

This is a new file, so I believe the Copyright date should just be "2024".


> +++ b/sysdeps/powerpc/powerpc64/multiarch/strncmp-power10.S
> @@ -0,0 +1,25 @@
> +/* Copyright (C) 2016-2023 Free Software Foundation, Inc.

Likewise.



> +ENTRY_TOCLESS (STRNCMP, 4)
> +	/* Check if size is 0.  */
> +	cmpdi	 cr0,r5,0
> +	beq	 cr0,L(ret0)
> +	andi.   r7,r3,4095
> +	andi.   r8,r4,4095
> +	cmpldi  cr0,r7,4096-16
> +	cmpldi  cr1,r8,4096-16
> +	bgt     cr0,L(crosses)
> +	bgt     cr1,L(crosses)
> +	COMPARE_16(v4,v5,0)
> +	addi	r3,r3,16
> +	addi	r4,r4,16

This code looks like it assumes the kernel is using a 4k page size.
All distros that I know of and the default kernel config for ppc64
and ppc64le kernels is to use a 64K HW page size.  Is there a reason
we're not checking for a 64k cache boundary here?

Adhemerval, you seem to have added the first power8 strncmp.S optimized
routine (sysdeps/powerpc/powerpc64/power8/strncmp.S) and that also uses
a 4k page boundary.  Do you remember the history of why we checked for
a 4k page boundary rather than 64k?  Was is a matter of using 64k showed
no improvement over 4k and using 4k meant we didn't have to worry about
some system maybe running in 4k page size kernels?

Peter





  reply	other threads:[~2024-05-03 21:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  9:58 Amrita H S
2024-05-03 21:31 ` Peter Bergner [this message]
2024-05-06  6:13   ` Florian Weimer
2024-05-06 12:55     ` Peter Bergner
2024-05-06 13:01   ` Peter Bergner
2024-05-06 14:10     ` Peter Bergner
2024-05-06 13:04   ` Adhemerval Zanella Netto
2024-05-06 14:16     ` Peter Bergner

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=a7381d88-d25d-4e0a-85cf-7193fdda0f41@linux.ibm.com \
    --to=bergner@linux.ibm.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=amritahs@linux.vnet.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).