From: Chris Metcalf <cmetcalf@ezchip.com>
To: "Ondřej Bílka" <neleai@seznam.cz>, "Wilco Dijkstra" <wdijkstr@arm.com>
Cc: <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/*] Optimize generic strchrnul and strchr
Date: Thu, 28 May 2015 11:27:00 -0000 [thread overview]
Message-ID: <55663202.4050800@ezchip.com> (raw)
In-Reply-To: <20150527160237.GA3621@domone>
On 05/27/2015 12:02 PM, OndÅej BÃlka wrote:
>> The other thing is support for big-endian - this is generally tricky as
>> >the mask returned by the zero check won't work even if byte-reversed.
>> >
> Nice catch, didn't though about that. Short answer is that you need a
> more complicated expression that doesn't cause carry propagation like
>
> (((x | 128) - 127) ^ 128) & ~x & 128
>
> Then you could do byte reversal but its isnt needed as it would be
> faster to count leading zero bytes directly.
>
> So we will need add separate BIG_ENDIAN_EXPRESSION macro to support
> these. Possibly one could squeeze extra performance if he is more
> careful but I don't care that much.
>
> Then first_nonzero_byte would need some work to support that, you could
> do it directly without reversing.
>
See sysdeps/tile/tilegx/strchrnul.c, which uses a string-endian.h
header to manage bigendian mode.
--
Chris Metcalf, EZChip Semiconductor
http://www.ezchip.com
next prev parent reply other threads:[~2015-05-27 21:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-27 14:10 Wilco Dijkstra
2015-05-27 20:33 ` Ondřej Bílka
2015-05-28 11:27 ` Chris Metcalf [this message]
2015-05-28 18:05 ` Joseph Myers
2015-05-28 19:41 ` Ondřej Bílka
2015-05-28 20:36 ` Joseph Myers
-- strict thread matches above, loose matches on Subject: below --
2015-05-27 9:19 [PATCH 1/*] Generic string function optimization: Add skeleton Ondřej Bílka
2015-05-27 9:19 ` [PATCH 2/*] Optimize generic strchrnul and strchr Ondřej Bílka
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=55663202.4050800@ezchip.com \
--to=cmetcalf@ezchip.com \
--cc=libc-alpha@sourceware.org \
--cc=neleai@seznam.cz \
--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).