This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH]: Optimization for strpbrk on PowerPC
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 04 Mar 2014 17:43:34 -0300
- Subject: Re: [PATCH]: Optimization for strpbrk on PowerPC
- Authentication-results: sourceware.org; auth=none
- References: <530F7D06 dot 4090309 at linux dot vnet dot ibm dot com> <20140227202420 dot GA20898 at domone dot podge> <530FA5D2 dot 7090208 at linux dot vnet dot ibm dot com> <530FA99B dot 3070500 at linux dot vnet dot ibm dot com> <5310A62D dot 40401 at linux dot vnet dot ibm dot com> <531468F0 dot 4000101 at linux dot vnet dot ibm dot com>
On 03-03-2014 08:35, Adhemerval Zanella wrote:
> +EALIGN (strpbrk, 4, 0)
> + CALL_MCOUNT 3
> +
> + /* The idea to speed up the algorithm is to create a lookup table
> + for fast check if input character should be considered. For ASCII
> + or ISO-8859-X character sets it has 256 positions. */
> + lbz r10,0(r4)
> +
> + /* First the table should be cleared and to avoid unaligned accesses
> + when using the VSX stores the table address is aligned to 16
> + bytes. */
> + xxlxor v0,v0,v0
> + addi r9,r1,-272 /* Allocates ALIGN(256 + 15, 8) bytes */
I realized that this stack allocation is not really align to 16, but rather allocation
256+16 bytes. Below it is a correct way to do it (I changed the patch for it):
@@ -33,7 +33,12 @@ EALIGN (strpbrk, 4, 0)
when using the VSX stores the table address is aligned to 16
bytes. */
xxlxor v0,v0,v0
- addi r9,r1,-272 /* Allocates ALIGN(256 + 15, 8) bytes */
+
+ /* PPC64 ELF ABI stack is aligned to 8 bytes, so allocates 264 bytes
+ (256 for the the table plus 8), and aligned it to 16 bytes. */
+ addi r9,r1,-264
+ rldicr r9,r9,0,59
+
li r5,16
li r6,32
li r8,48