Skip to content

Commit 4225276

Browse files
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 f78667b. Discussion: https://postgr.es/m/Zy5K5Qmlb3Z4dsd4%40nathan
1 parent b8df690 commit 4225276

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/port/pg_popcount_avx512.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
*/
1313
#include "c.h"
1414

15+
#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK
16+
1517
#if defined(HAVE__GET_CPUID) || defined(HAVE__GET_CPUID_COUNT)
1618
#include <cpuid.h>
1719
#endif
1820

19-
#ifdef USE_AVX512_POPCNT_WITH_RUNTIME_CHECK
2021
#include <immintrin.h>
21-
#endif
2222

2323
#if defined(HAVE__CPUID) || defined(HAVE__CPUIDEX)
2424
#include <intrin.h>
@@ -31,7 +31,7 @@
3131
* use AVX-512 intrinsics, but we check it anyway to be sure. We piggy-back on
3232
* the function pointers that are only used when TRY_POPCNT_FAST is set.
3333
*/
34-
#if defined(TRY_POPCNT_FAST) && defined(USE_AVX512_POPCNT_WITH_RUNTIME_CHECK)
34+
#ifdef TRY_POPCNT_FAST
3535

3636
/*
3737
* Does CPUID say there's support for XSAVE instructions?
@@ -219,5 +219,5 @@ pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask)
219219
return _mm512_reduce_add_epi64(accum);
220220
}
221221

222-
#endif /* TRY_POPCNT_FAST &&
223-
* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */
222+
#endif /* TRY_POPCNT_FAST */
223+
#endif /* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy