aboutsummaryrefslogtreecommitdiff
path: root/src/port/pg_bitutils.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2025-03-28 12:27:47 -0500
committerNathan Bossart <nathan@postgresql.org>2025-03-28 12:27:47 -0500
commit9ac6f7e7ceb6e7c9b168bbf02bbe4662782dfa6e (patch)
treee89b0d1e3a8ae0af6c8bd062ca3499b47276e60e /src/port/pg_bitutils.c
parenta5419bc72e22337a16655aa28e2e20ecb65f65c3 (diff)
downloadpostgresql-9ac6f7e7ceb6e7c9b168bbf02bbe4662782dfa6e.tar.gz
postgresql-9ac6f7e7ceb6e7c9b168bbf02bbe4662782dfa6e.zip
Rename TRY_POPCNT_FAST to TRY_POPCNT_X86_64.
This macro protects x86_64-specific code, and a subsequent commit will introduce AArch64-specific versions of that code. To prevent confusion, let's rename it to clearly indicate that it's for x86_64. We should likely move this code to its own file (perhaps merging it with the AVX-512 popcount code), but that is left as a future exercise. Reviewed-by: "Chiranmoy.Bhattacharya@fujitsu.com" <Chiranmoy.Bhattacharya@fujitsu.com> Reviewed-by: John Naylor <johncnaylorls@gmail.com> Discussion: https://postgr.es/m/010101936e4aaa70-b474ab9e-b9ce-474d-a3ba-a3dc223d295c-000000%40us-west-2.amazonses.com
Diffstat (limited to 'src/port/pg_bitutils.c')
-rw-r--r--src/port/pg_bitutils.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/port/pg_bitutils.c b/src/port/pg_bitutils.c
index 5677525693d..82be40e2fb4 100644
--- a/src/port/pg_bitutils.c
+++ b/src/port/pg_bitutils.c
@@ -108,7 +108,7 @@ static inline int pg_popcount64_slow(uint64 word);
static uint64 pg_popcount_slow(const char *buf, int bytes);
static uint64 pg_popcount_masked_slow(const char *buf, int bytes, bits8 mask);
-#ifdef TRY_POPCNT_FAST
+#ifdef TRY_POPCNT_X86_64
static bool pg_popcount_available(void);
static int pg_popcount32_choose(uint32 word);
static int pg_popcount64_choose(uint64 word);
@@ -123,9 +123,9 @@ int (*pg_popcount32) (uint32 word) = pg_popcount32_choose;
int (*pg_popcount64) (uint64 word) = pg_popcount64_choose;
uint64 (*pg_popcount_optimized) (const char *buf, int bytes) = pg_popcount_choose;
uint64 (*pg_popcount_masked_optimized) (const char *buf, int bytes, bits8 mask) = pg_popcount_masked_choose;
-#endif /* TRY_POPCNT_FAST */
+#endif /* TRY_POPCNT_X86_64 */
-#ifdef TRY_POPCNT_FAST
+#ifdef TRY_POPCNT_X86_64
/*
* Return true if CPUID indicates that the POPCNT instruction is available.
@@ -337,7 +337,7 @@ pg_popcount_masked_fast(const char *buf, int bytes, bits8 mask)
return popcnt;
}
-#endif /* TRY_POPCNT_FAST */
+#endif /* TRY_POPCNT_X86_64 */
/*
@@ -486,13 +486,13 @@ pg_popcount_masked_slow(const char *buf, int bytes, bits8 mask)
return popcnt;
}
-#ifndef TRY_POPCNT_FAST
+#ifndef TRY_POPCNT_X86_64
/*
* When the POPCNT instruction is not available, there's no point in using
* function pointers to vary the implementation between the fast and slow
* method. We instead just make these actual external functions when
- * TRY_POPCNT_FAST is not defined. The compiler should be able to inline
+ * TRY_POPCNT_X86_64 is not defined. The compiler should be able to inline
* the slow versions here.
*/
int
@@ -527,4 +527,4 @@ pg_popcount_masked_optimized(const char *buf, int bytes, bits8 mask)
return pg_popcount_masked_slow(buf, bytes, mask);
}
-#endif /* !TRY_POPCNT_FAST */
+#endif /* !TRY_POPCNT_X86_64 */