From: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH] powerpc:strtok/strtok_r optimization
Date: Wed, 19 Nov 2014 13:23:00 -0000 [thread overview]
Message-ID: <546C99D7.4070000@linux.vnet.ibm.com> (raw)
In-Reply-To: <1415801018-52387-1-git-send-email-raji@linux.vnet.ibm.com>
Hi Raji,
Patch looks good in general, some comments below:
On 12-11-2014 12:03, Rajalakshmi Srinivasaraghavan wrote:
> diff --git a/string/strtok_r.c b/string/strtok_r.c
> index fb5ba8d..54c6cbd 100644
> --- a/string/strtok_r.c
> +++ b/string/strtok_r.c
> @@ -25,6 +25,16 @@
> #undef strtok_r
> #undef __strtok_r
>
> +#ifndef STRTOK_R
> +# ifdef weak_alias
> +# define STRTOK_R __strtok_r
> +weak_alias (__strtok_r, strtok_r)
> +# else
> +# define STRTOK_R strtok_r
> +# endif
> +#endif
> +
> +
> #ifndef _LIBC
> /* Get specification. */
> # include "strtok_r.h"
> @@ -43,7 +53,7 @@
> // s = "abc\0-def\0"
> */
> char *
> -__strtok_r (char *s, const char *delim, char **save_ptr)
> +STRTOK_R (char *s, const char *delim, char **save_ptr)
> {
> char *token;
>
> @@ -74,5 +84,4 @@ __strtok_r (char *s, const char *delim, char **save_ptr)
> }
> #ifdef weak_alias
> libc_hidden_def (__strtok_r)
> -weak_alias (__strtok_r, strtok_r)
> #endif
I think we can drop this modification and just redefine 'weak_alias' in strtok_r-ppc64.c
as:
#undef weak_alias
#define weak_alias(name, alias)
> +
> +/*Iniatliaze hash table with Zeroes in double indexed quadword accesses */
> + xxlxor v0, v0, v0 /* prepare for initializing hash */
> +
> + stxvd2x v0, r0, r9 /* initialize 1st quadword */
> + stxvd2x v0, r9, r12
> + stxvd2x v0, r9, r6
> + stxvd2x v0, r9, r8 /* initialize 4th quadword */
> +
> + addi r11, r9, 64 /* r11 is index to hash */
> +
> + stxvd2x v0, r0, r11 /* initialize 5th quadword */
> + stxvd2x v0, r11, r12
> + stxvd2x v0, r11, r6
> + stxvd2x v0, r11, r8 /* initialize 8th quadword */
> +
> + addi r11, r9, 128 /* r11 is index to hash */
> +
> + stxvd2x v0, r0, r11 /* initialize 9th quadword */
> + stxvd2x v0, r11, r12
> + stxvd2x v0, r11, r6
> + stxvd2x v0, r11, r8 /* initialize 12th quadword */
> +
> + addi r11, r9, 192 /* r11 is index to hash */
> +
> + stxvd2x v0, r0, r11 /* initialize 13th quadword */
> + stxvd2x v0, r11, r12
> + stxvd2x v0, r11, r6
> + stxvd2x v0, r11, r8 /* initialize 16th quadword */
I was thinking about this way of cleaning the hash table using 'stxvd2x' and I did some
testing and using some loop unrolling I see we can use 'std' instead without performance
penalty. It would make the algorithm not ISA 2.06/VSX exclusive and remove a lot of IFUNC
code. What do you think?
I am also thinking about changing it to strcspn, strspn, and strpbrk.
prev parent reply other threads:[~2014-11-19 13:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 14:05 Rajalakshmi Srinivasaraghavan
2014-11-19 13:23 ` Adhemerval Zanella [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=546C99D7.4070000@linux.vnet.ibm.com \
--to=azanella@linux.vnet.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).