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.89) (envelope-from ) id 1gu7qw-0007Ww-AI for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2019 03:38:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gu7qs-0000De-M9 for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Feb 2019 03:38:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gu7qs-00005d-AL for pgsql-hackers@lists.postgresql.org; Thu, 14 Feb 2019 03:38:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gu7qk-0001qF-JI for pgsql-hackers@lists.postgresql.org; Thu, 14 Feb 2019 03:38:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x1E3c5G6011320; Wed, 13 Feb 2019 22:38:05 -0500 From: Tom Lane To: Alvaro Herrera cc: Andrew Gierth , David Rowley , PostgreSQL Hackers , Thomas Munro Subject: Re: Using POPCNT and other advanced bit manipulation instructions In-reply-to: <27185.1550097476@sss.pgh.pa.us> References: <20190213221719.GA15976@alvherre.pgsql> <26998.1550097202@sss.pgh.pa.us> <27185.1550097476@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 13 Feb 2019 17:37:56 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11318.1550115484.1@sss.pgh.pa.us> Date: Wed, 13 Feb 2019 22:38:04 -0500 Message-ID: <11319.1550115484@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk And, while I'm complaining: why the devil is use of the compiler builtins gated by HAVE__GET_CPUID? This is unbelievably Intel-centric, because it prevents use of the builtins on other architectures. If the builtin exists, we should use it, full stop. There's no reason to expect that it would be slower than hand-rolled code, regardless of the architecture. I'd be inclined to rip out all of the run-time-detection logic here; I doubt any of it is buying anything that's worth the price of an indirect call. regards, tom lane