From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [5506] target-ppc: convert logical instructions to TCG
Date: Sat, 1 Nov 2008 01:54:35 +0100 [thread overview]
Message-ID: <20081101005435.GA6083@volta.aurel32.net> (raw)
In-Reply-To: <fb249edb0810292010p4b30785i2ba816b404635562@mail.gmail.com>
On Thu, Oct 30, 2008 at 04:10:55AM +0100, andrzej zaborowski wrote:
> Hi,
>
> 2008/10/21 Aurelien Jarno <aurelien@aurel32.net>:
> > -void do_popcntb (void)
> > +target_ulong helper_popcntb (target_ulong val)
> > {
> > uint32_t ret;
> > int i;
> >
> > ret = 0;
> > for (i = 0; i < 32; i += 8)
> > - ret |= ctpop8((T0 >> i) & 0xFF) << i;
> > - T0 = ret;
> > + ret |= ctpop8((val >> i) & 0xFF) << i;
> > + return ret;
> > }
> >
> > #if defined(TARGET_PPC64)
> > -void do_popcntb_64 (void)
> > +target_ulong helper_popcntb_64 (target_ulong val)
> > {
> > uint64_t ret;
> > int i;
> >
> > ret = 0;
> > for (i = 0; i < 64; i += 8)
> > - ret |= ctpop8((T0 >> i) & 0xFF) << i;
> > - T0 = ret;
> > + ret |= ctpop8((val >> i) & 0xFF) << i;
> > + return ret;
>
> Just noting, before I forget how ctpopXX() works, that the 8
> iterations here can be replaced with one ctpop64 if you take only the
> first 3 lines of it, i.e.
>
> val = (val & 0x5555555555555555ULL) + ((val >> 1) & 0x5555555555555555ULL);
> val = (val & 0x3333333333333333ULL) + ((val >> 2) & 0x3333333333333333ULL);
> val = (val & 0x0f0f0f0f0f0f0f0fULL) + ((val >> 4) & 0x0f0f0f0f0f0f0f0fULL);
>
> stores the ctpop8() value for each byte in the same byte. Similarly
> the 4 iterations above and ctpop32().
>
Thanks, I applied you suggestion.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
prev parent reply other threads:[~2008-11-01 0:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 11:31 [Qemu-devel] [5506] target-ppc: convert logical instructions to TCG Aurelien Jarno
2008-10-30 3:10 ` andrzej zaborowski
2008-11-01 0:54 ` Aurelien Jarno [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=20081101005435.GA6083@volta.aurel32.net \
--to=aurelien@aurel32.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).