pgsql: Remove uses of popcount builtins. - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Remove uses of popcount builtins.
Date
Msg-id E1vuXpd-000qHq-2o@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Remove uses of popcount builtins.

This commit replaces the implementations of pg_popcount{32,64} with
branchless ones in plain C.  While these new implementations do not
make use of more sophisticated population count instructions
available on some CPUs, testing indicates they perform well,
especially now that they are inlined.  Newer versions of popular
compilers will automatically replace these with special
instructions if possible, anyway.  A follow-up commit will replace
various loops over these functions with calls to pg_popcount(),
leaving us little reason to worry about micro-optimizing them
further.

Since this commit removes the only uses of the popcount builtins,
we can also remove the corresponding configuration checks.

Suggested-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
configure                      | 38 -----------------------------
configure.ac                   |  1 -
meson.build                    |  1 -
src/include/pg_config.h.in     |  3 ---
src/include/port/pg_bitutils.h | 54 +++++++++++++++++-------------------------
src/port/pg_popcount_aarch64.c |  5 ----
6 files changed, 22 insertions(+), 80 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Translation updates
Next
From: Peter Eisentraut
Date:
Subject: pgsql: meson: allow disabling building/installation of static libraries