pgsql: Auto-vectorize the varbit bitwise operators.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Auto-vectorize the varbit bitwise operators.
Date: 2026-09-03 21:11:18
Message-ID: E1x2EiL-00000003Mb6-233F@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Auto-vectorize the varbit bitwise operators.

Compile varbit.c with -ftree-vectorize where available, and adjust
the loops in bit_and(), bit_or(), bitxor(), and bitnot() so that
they are amenable to being auto-vectorized. (Mainly, that involves
reading the byte count into a local variable before the loop. As
written, the bound is recomputed from the varlena header on every
iteration, because the compiler must assume that the loop might
modify the header.)

Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/aphxrw6NkYkLMtZN%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9a40e39b1e8780ba75e014cb87860249c405c37e

Modified Files
--------------
src/backend/utils/adt/Makefile | 3 ++-
src/backend/utils/adt/meson.build | 9 ++++-----
src/backend/utils/adt/varbit.c | 26 +++++++++++++++++---------
3 files changed, 23 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2026-09-03 21:37:15 pgsql: Add non-MVCC index scan test module.
Previous Message Peter Geoghegan 2026-09-03 20:27:30 pgsql: Add index scan pgstat test coverage.