Optimize popcount functions with ARM Neon intrinsics.
Nathan Bossart <nathan@postgresql.org>
Optimize popcount functions with ARM Neon intrinsics.
This commit introduces Neon implementations of pg_popcount{32,64},
pg_popcount(), and pg_popcount_masked(). As in simd.h, we assume
that all available AArch64 hardware supports Neon, so we don't need
any new configure-time or runtime checks. Some compilers already
emit Neon instructions for these functions, but our hand-rolled
implementations for pg_popcount() and pg_popcount_masked()
performed better in testing, likely due to better instruction-level
parallelism.
Author: "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
Files
| Path | Change | +/− |
|---|---|---|
| src/include/port/pg_bitutils.h | modified | +9 −0 |
| src/port/Makefile | modified | +1 −0 |
| src/port/meson.build | modified | +1 −0 |
| src/port/pg_bitutils.c | modified | +16 −6 |
| src/port/pg_popcount_aarch64.c | added | +208 −0 |
Discussion
- [PATCH] SVE popcount support 35 messages · 2024-11-27 → 2025-03-28