From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kw4lH-0001kS-IQ for qemu-devel@nongnu.org; Fri, 31 Oct 2008 20:54:43 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kw4lG-0001k6-TL for qemu-devel@nongnu.org; Fri, 31 Oct 2008 20:54:43 -0400 Received: from [199.232.76.173] (port=45979 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kw4lG-0001k3-Kt for qemu-devel@nongnu.org; Fri, 31 Oct 2008 20:54:42 -0400 Received: from hall.aurel32.net ([88.191.82.174]:35507) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kw4lH-0003EF-49 for qemu-devel@nongnu.org; Fri, 31 Oct 2008 20:54:43 -0400 Received: from [2a01:e35:2e45:a090:21e:8cff:feb0:693b] (helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Kw4lB-0007HF-Lo for qemu-devel@nongnu.org; Sat, 01 Nov 2008 01:54:37 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1Kw4l9-0004bE-VD for qemu-devel@nongnu.org; Sat, 01 Nov 2008 01:54:36 +0100 Date: Sat, 1 Nov 2008 01:54:35 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [5506] target-ppc: convert logical instructions to TCG Message-ID: <20081101005435.GA6083@volta.aurel32.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Oct 30, 2008 at 04:10:55AM +0100, andrzej zaborowski wrote: > Hi, > > 2008/10/21 Aurelien Jarno : > > -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