diff options
author | Nathan Bossart <nathan@postgresql.org> | 2024-11-08 14:25:28 -0600 |
---|---|---|
committer | Nathan Bossart <nathan@postgresql.org> | 2024-11-08 14:25:28 -0600 |
commit | 4225276e25403e70de623ca9afd2c061cba24ccc (patch) | |
tree | 36d60afcdef03618581bf42172c89114db934c59 | |
parent | b8df690492568d7852b799b4eff3274fbbd91e78 (diff) | |
download | postgresql-4225276e25403e70de623ca9afd2c061cba24ccc.tar.gz postgresql-4225276e25403e70de623ca9afd2c061cba24ccc.zip |
Move check for USE_AVX512_POPCNT_WITH_RUNTIME_CHECK.
Unlike TRY_POPCNT_FAST, which is defined in pg_bitutils.h, this
macro is defined in c.h (via pg_config.h), so we can check for it
earlier and avoid some unnecessary #includes on systems that lack
AVX-512 support.
Oversight in commit f78667bd91.
Discussion: https://postgr.es/m/Zy5K5Qmlb3Z4dsd4%40nathan
-rw-r--r-- | src/port/pg_popcount_avx512.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/port/pg_popcount_avx512.c b/src/port/pg_popcount_avx512.c index 1ab2847bf2d..c8a4f2b19fa 100644 --- a/src/port/pg_popcount_avx512.c +++ b/src/port/pg_popcount_avx512.c @@ -12,13 +12,13 @@ */ #include "c.h" +#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK + #if defined(HAVE__GET_CPUID) || defined(HAVE__GET_CPUID_COUNT) #include <cpuid.h> #endif -#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK #include <immintrin.h> -#endif #if defined(HAVE__CPUID) || defined(HAVE__CPUIDEX) #include <intrin.h> @@ -31,7 +31,7 @@ * use AVX-512 intrinsics, but we check it anyway to be sure. We piggy-back on * the function pointers that are only used when TRY_POPCNT_FAST is set. */ -#if defined(TRY_POPCNT_FAST) && defined(USE_AVX512_POPCNT_WITH_RUNTIME_CHECK) +#ifdef TRY_POPCNT_FAST /* * Does CPUID say there's support for XSAVE instructions? @@ -219,5 +219,5 @@ pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask) return _mm512_reduce_add_epi64(accum); } -#endif /* TRY_POPCNT_FAST && - * USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */ +#endif /* TRY_POPCNT_FAST */ +#endif /* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */ |