Remove specialized word-length popcount implementations.
The uses of these functions do not justify the level of
micro-optimization we've done and may even hurt performance in some
cases (e.g., due to using function pointers). This commit removes
all architecture-specific implementations of pg_popcount{32,64} and
converts the portable ones to inlined functions in pg_bitutils.h.
These inlined versions should produce the same code as before (but
inlined), so in theory this is a net gain for many machines. A
follow-up commit will replace the remaining loops over these
word-length popcount functions with calls to pg_popcount(), further
reducing the need for architecture-specific implementations.
Suggested-by: John Naylor <[email protected]>
Reviewed-by: John Naylor <[email protected]>
Reviewed-by: Greg Burd <[email protected]>
Discussion:
https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/a4688988835f1f5e607040c8d89e52cbfba9369b
Modified Files
--------------
src/include/port/pg_bitutils.h | 75 ++++++++++++++++++++++++++++--------------
src/port/pg_bitutils.c | 65 ++----------------------------------
src/port/pg_popcount_aarch64.c | 20 +++--------
src/port/pg_popcount_x86.c | 43 +-----------------------
4 files changed, 59 insertions(+), 144 deletions(-)