Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7hK7-0008AE-Py for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2020 15:13:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7hK6-0006Id-GT for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Feb 2020 15:13:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7hK5-0006IW-Qw for pgsql-hackers@lists.postgresql.org; Fri, 28 Feb 2020 15:13:06 +0000 Received: from xvm-110-146.dc2.ghst.net ([46.226.110.146] helo=fetter.org) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1j7hK2-0000Ii-DD for pgsql-hackers@postgresql.org; Fri, 28 Feb 2020 15:13:05 +0000 Received: by fetter.org (Postfix, from userid 1001) id 6871440D56; Fri, 28 Feb 2020 16:13:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fetter.org; s=default; t=1582902780; bh=7PTnCjwlpgYza6LBLuG/cI55csK9KijoCX3urgZq6u4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q1z8UrdZOOvRGURQ19by4ZNlWDFMobPKhYV1zxIBmLzUt/xOWgidEpk0BoUIWqnQz kvM6PfIKhnE319WrjlJD38zAIPZZMWP0sFAuqEZdjE4ocKFJuFQo69aQxserNh2XFB fJvMDyjxhP6jzOaZkjbtywSnCdSL4V3uqotECr/hG+1xWricXU55d4sDKKJ6PoY1TI FwKXZ33CzkvhBVOzYxLOOi2okj0Sxjo/cVXm+BvoVn2EQmtYmxg8tRnFA4fSUP2siM TYm60ux/0iuXNKWrQJD/eAooCYpW7c4QLNYNcLDXczK8gX9ch4kjfCT2+tM5gAgAha hChz50n6KjOrg== Date: Fri, 28 Feb 2020 16:13:00 +0100 From: David Fetter To: John Naylor Cc: Jesse Zhang , PostgreSQL Development Subject: Re: Use compiler intrinsics for bit ops in hash Message-ID: <20200228151259.GM13804@fetter.org> References: <20200114173553.GE32763@fetter.org> <20200114220917.GG32763@fetter.org> <20200131155918.GI24870@fetter.org> <20200226081223.GI13804@fetter.org> <20200227055640.GL13804@fetter.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Feb 27, 2020 at 02:41:49PM +0800, John Naylor wrote: > On Thu, Feb 27, 2020 at 1:56 PM David Fetter wrote: > > [v6 set] > > Hi David, > > In 0002, the pg_bitutils functions have a test (input > 0), and the > new callers ceil_log2_* and next_power_of_2_* have asserts. That seems > backward to me. To me, too, now that you mention it. My thinking was a little fuzzed by trying to accommodate platforms with intrinsics where clz is defined for 0 inputs. > I imagine some callers of bitutils will already know the value > 0, > and it's probably good to keep that branch out of the lowest level > functions. What do you think? I don't know quite how smart compilers and CPUs are these days, so it's unclear to me how often that branch would actually happen. Anyhow, I'll get a revised patch set out later today. Best, David. -- David Fetter http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate