]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Centralize detection of x86 CPU features
authorJohn Naylor <john.naylor@postgresql.org>
Fri, 27 Feb 2026 13:30:41 +0000 (20:30 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Fri, 27 Feb 2026 13:30:41 +0000 (20:30 +0700)
commit16743db061e431d40522547c6436af6616026caa
tree0e363c7a3013e0c4311df559dc5a2a17ec504618
parentd6d9b96b4044e5c744bf2c6474b2c5c2de355f85
Centralize detection of x86 CPU features

We now maintain an array of booleans that indicate which features were
detected at runtime. When code wants to check for a given feature,
the array is automatically checked if it has been initialized and if
not, a single function checks all features at once.

Move all x86 feature detection to pg_cpu_x86.c, and move the CRC
function choosing logic to the file where the hardware-specific
functions are defined, consistent with more recent hardware-specific
files in src/port.

Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Discussion: https://postgr.es/m/CANWCAZbgEUFw7LuYSVeJ=Tj98R5HoOB1Ffeqk3aLvbw5rU5NTw@mail.gmail.com
src/include/port/pg_cpu.h [new file with mode: 0644]
src/port/pg_cpu_x86.c
src/port/pg_crc32c_sse42.c
src/port/pg_popcount_x86.c
src/tools/pgindent/typedefs.list