Re: refactor architecture-specific popcount code

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: John Naylor <johncnaylorls(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: refactor architecture-specific popcount code
Date: 2026-01-15 19:07:18
Message-ID: aWk65qnA-wD0dOjp@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is a new patch set. Notably, I've added a 0004 that does the
following:

* Removes TRY_POPCNT_X86_64. We now assume that the required CPUID
intrinsics are available, as we have long done in some of the CRC-32C code.

* Moves the MSVC check for HAVE_X86_64_POPCNTQ to configuration-time. This
way, we set it for all relevant platforms in one place.

* Moves the #defines for USE_SSE2 and USE_NEON to c.h so that they can be
used elsewhere without simd.h. Consequently, we can remove POPCNT_AARCH64.

* Moves the #includes for pg_bitutils.h to below the system headers in
pg_popcount_{aarch64,x86}.c (since we no longer depend on macros defined in
pg_bitutils.h).

--
nathan

Attachment Content-Type Size
v2-0001-Rename-pg_popcount_avx512.c-to-pg_popcount_x86.c.patch text/plain 2.1 KB
v2-0002-Move-x86-popcount-code-to-pg_popcount_x86_64.c.patch text/plain 17.5 KB
v2-0003-Rename-fast-and-slow-popcount-functions.patch text/plain 9.7 KB
v2-0004-Refactor-some-SIMD-and-popcount-macros.patch text/plain 7.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2026-01-15 19:08:25 Re: Can we change pg_rewind used without wal_log_hints and data_checksums
Previous Message Robert Haas 2026-01-15 19:00:00 Re: Proposal to allow setting cursor options on Portals