public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Matt Turner <mattst88@gmail.com>
To: "Ondřej Bílka" <neleai@seznam.cz>
Cc: Wilco Dijkstra <wdijkstr@arm.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	 Richard henderson <rth@redhat.com>
Subject: Re: Optimized? strchr implementations.
Date: Tue, 26 May 2015 18:00:00 -0000	[thread overview]
Message-ID: <CAEdQ38FotH=A7aE78q=e790n-MwonaJST3YerWo-j4Xcy6ugQQ@mail.gmail.com> (raw)
In-Reply-To: <20150526143854.GA24529@domone>

On Tue, May 26, 2015 at 7:38 AM, Ondřej Bílka <neleai@seznam.cz> wrote:
> On Tue, May 26, 2015 at 01:23:36PM +0100, Wilco Dijkstra wrote:
>> > Ondřej Bílka wrote:
>> > On Sun, May 24, 2015 at 06:32:14PM +0200, Ondřej Bílka wrote:
>> > > Hi,
>> > > this is nontrivial optimization of string inlines.
>> > > First it decreases icache pressure as you don't need strchr.
>>
>> It's not obvious to me that is the right thing to do. Generally it is best
>> to use the standard C90/C99 functions rather than infrequently used
>> non-standard ones. A quick grep of GLIBC shows strchr is used a lot more
>> than strchrnul, and 9 targets have an optimized strchr vs 5 for strchrnul.
>>
> I looked at how architectures optimize strchr and that number is less.
>
> Some of these are not optimized implementations. If you do gcc
> string/strchr.c -S then you get assembly implementation. Several
> architectures don't exploit any hardware capabilities, just use same
> algorithm as generic so these could be deleted.
>
> I know that generic implementation could be improved and will post a
> patches.
>
> Only two that are real optimizations and don't have strchnul are armv6
> and alpha
> So could you adapt armv6 one?
>
> Richard as you added alpha could you adapt it to strchnul? And why you
> do a binary search there? Accoring to wiki alpha supports ctlz
> instruction that does exactly that.

It's because Alphas < EV67 don't have ctlz.

  reply	other threads:[~2015-05-26 16:58 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-24 22:51 [PATCH 1/*] Move string inlines to string/string-inlines.c Ondřej Bílka
2015-05-25  0:18 ` [PATCH 2/*] Remove pre-gcc 3.4 string inline optimizations Ondřej Bílka
2015-05-28 16:39   ` Joseph Myers
2015-06-08 10:30     ` Ondřej Bílka
2015-06-08 11:24       ` Joseph Myers
2015-05-25  1:02 ` [PATCH 3/*] Use strchrnul for strcspn (x, "c") Ondřej Bílka
2015-05-25  1:58 ` [PATCH 4/*] Redirect strchr to strchrnul Ondřej Bílka
2015-05-25  2:06   ` [PATCH 4/* v2] Optimize strchrnul more Ondřej Bílka
2015-05-26 13:24     ` Wilco Dijkstra
2015-05-26 15:13       ` Ondřej Bílka
2015-05-26 16:32       ` Optimized? strchr implementations Ondřej Bílka
2015-05-26 18:00         ` Matt Turner [this message]
2015-05-26 18:19           ` Ondřej Bílka
2015-05-26 18:48         ` Richard Henderson
2015-05-27 13:23         ` Wilco Dijkstra
2015-05-28 16:42     ` [PATCH 4/* v2] Optimize strchrnul more Joseph Myers
2015-05-28 16:27 ` [PATCH 1/*] Move string inlines to string/string-inlines.c Joseph Myers

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='CAEdQ38FotH=A7aE78q=e790n-MwonaJST3YerWo-j4Xcy6ugQQ@mail.gmail.com' \
    --to=mattst88@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=neleai@seznam.cz \
    --cc=rth@redhat.com \
    --cc=wdijkstr@arm.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).