pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix compiler builtin usage in new pg_bitutils.c
Date: Fri, 15 Feb 2019 16:40:52 +0000
Message-ID: <E1gugXk-000276-Ht@gemulon.postgresql.org> (raw)

Fix compiler builtin usage in new pg_bitutils.c

Split out these new functions in three parts: one in a new file that
uses the compiler builtin and gets compiled with the -mpopcnt compiler
option if it exists; another one that uses the compiler builtin but not
the compiler option; and finally the fallback with open-coded
algorithms.

Split out the configure logic: in the original commit, it was selecting
to use the -mpopcnt compiler switch together with deciding whether to
use the compiler builtin, but those two things are really separate.
Split them out.  Also, expose whether the builtin exists to
Makefile.global, so that src/port's Makefile can decide whether to
compile the hw-optimized file.

Remove CPUID test for CTZ/CLZ.  Make pg_{right,left}most_ones use either
the compiler intrinsic or open-coded algo; trying to use the
HW-optimized version is a waste of time.  Make them static inline
functions.

Discussion: https://postgr.es/m/20190213221719.GA15976@alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fc6c72747ae6db6909fcd7d1adbc3d923ec1fffa

Modified Files
--------------
config/c-compiler.m4            |  22 +--
configure                       |  66 +++++--
configure.in                    |   6 +-
src/Makefile.global.in          |   3 +
src/include/port/pg_bitutils.h  | 176 ++++++++++++++++++-
src/port/Makefile               |  16 +-
src/port/pg_bitutils.c          | 378 +++++-----------------------------------
src/port/pg_bitutils_hwpopcnt.c |  36 ++++
8 files changed, 327 insertions(+), 376 deletions(-)



view thread (8+ messages)  latest in thread

Message-ID: <E1gugXk-000276-Ht@gemulon.postgresql.org>
Permalink:  ../E1gugXk-000276-Ht@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gugXk-000276-Ht@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Fix compiler builtin usage in new pg_bitutils.c
  In-Reply-To: <E1gugXk-000276-Ht@gemulon.postgresql.org>
  References: <E1gugXk-000276-Ht@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox