]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Check for __cpuidex and __get_cpuid_count separately
authorJohn Naylor <john.naylor@postgresql.org>
Thu, 2 Apr 2026 12:39:57 +0000 (19:39 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Thu, 2 Apr 2026 12:39:57 +0000 (19:39 +0700)
commiteffaa464afd355e8927bf430cfe6a0ddd2ee5695
tree5ba8677711248b0d284b262d39f30cda639662ff
parentbb6ae9707c1789c9d2036c9bbd35965a01e1b214
Check for __cpuidex and __get_cpuid_count separately

Previously we would only check for the availability of __cpuidex if
the related __get_cpuid_count was not available on a platform.

Future commits will need to access hypervisor information about
the TSC frequency of x86 CPUs. For that case __cpuidex is the only
viable option for accessing a high leaf (e.g. 0x40000000), since
__get_cpuid_count does not allow that.

__cpuidex is defined in cpuid.h for gcc/clang, but in intrin.h
for MSVC, so adjust tests to suite. We also need to cast the array
of unsigned ints to signed, since gcc (with -Wall) and clang emit
warnings otherwise.

Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: John Naylor <john.naylor@postgresql.org>
Discussion: https://postgr.es/m/CAP53PkyooCeR8YV0BUD_xC7oTZESHz8OdA=tP7pBRHFVQ9xtKg@mail.gmail.com
configure
configure.ac
meson.build
src/port/pg_cpu_x86.c