[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [5506] target-ppc: convert logical instructions to TCG
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] [5506] target-ppc: convert logical instructions to TCG |
Date: |
Sat, 1 Nov 2008 01:54:35 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Thu, Oct 30, 2008 at 04:10:55AM +0100, andrzej zaborowski wrote:
> Hi,
>
> 2008/10/21 Aurelien Jarno <address@hidden>:
> > -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
`. `' address@hidden | address@hidden
`- people.debian.org/~aurel32 | www.aurel32.net