From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] target-alpha: Special case cmpbge with zero
Date: Tue, 18 Aug 2015 09:14:51 -0700 [thread overview]
Message-ID: <55D359FB.2070709@twiddle.net> (raw)
In-Reply-To: <1439849015-11127-3-git-send-email-rth@twiddle.net>
On 08/17/2015 03:03 PM, Richard Henderson wrote:
> + uint64_t c = (a - 0x0101010101010101ULL) & ~a & 0x8080808080808080ULL;
Ho hum. I was mislead. This formulation is good for noticing *some* zero in a
word, but not which particular bytes contain zeros. This difference is hard to
spot in how alpha tends to use this instruction, but this did lead to
bizzare filesystem behaviour.
Failure occurs when a zero preceeds a byte with a one, e.g.
000000010022656d
0100016462687773
Avoiding the problem requires one extra operation. E.g.
uint64_t m = 0x7f7f7f7f7f7f7f7fULL;
uint64_t c = ~(((a & m) + m) | a | m);
Which equates to (1) clear high bit (2) carry non-zero into high bit (3)
remerge high bit from source, (4) set low bits and invert to make high bit
positive for found zero.
r~
prev parent reply other threads:[~2015-08-18 16:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-17 22:03 [Qemu-devel] [PATCH 0/2] Impove alpha cmpbge Richard Henderson
2015-08-17 22:03 ` [Qemu-devel] [PATCH 1/2] target-alpha: Rewrite helper_cmpbge using bit tests Richard Henderson
2015-08-17 22:03 ` [Qemu-devel] [PATCH 2/2] target-alpha: Special case cmpbge with zero Richard Henderson
2015-08-18 16:14 ` Richard Henderson [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=55D359FB.2070709@twiddle.net \
--to=rth@twiddle.net \
--cc=qemu-devel@nongnu.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 NNTP newsgroup(s).