pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Naylor <john.naylor@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Compute CRC32C on ARM using the Crypto Extension where available
Date: Sat, 04 Apr 2026 13:51:18 +0000
Message-ID: <E1w91PB-002utu-2n@gemulon.postgresql.org> (raw)

Compute CRC32C on ARM using the Crypto Extension where available

In similar vein to commit 3c6e8c123, the ARMv8 cryptography extension
has 64x64 -> 128-bit carryless multiplication instructions suitable
for computing CRC. This was tested to be around twice as fast as
scalar CRC instructions for longer inputs.

We now do a runtime check, even for builds that target "armv8-a+crc",
but those builds can still use a direct call for constant inputs,
which we assume are short.

As for x86, the MIT-licensed implementation was generated with the
"generate" program from

https://github.com/corsix/fast-crc32/

Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/CANWCAZaKhE+RD5KKouUFoxx1EbUNrNhcduM1VQ=DkSDadNEFng@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fbc57f2bc2ee498958a4c5326002af39dd99c90b

Modified Files
--------------
config/c-compiler.m4              |  38 +++++++++++
configure                         |  64 ++++++++++++++++++-
configure.ac                      |  13 +++-
meson.build                       |  33 ++++++++++
src/include/pg_config.h.in        |   3 +
src/include/port/pg_crc32c.h      |  22 +++++--
src/port/meson.build              |   1 +
src/port/pg_crc32c_armv8.c        | 128 ++++++++++++++++++++++++++++++++++++++
src/port/pg_crc32c_armv8_choose.c |  38 ++++++++++-
9 files changed, 329 insertions(+), 11 deletions(-)



Message-ID: <E1w91PB-002utu-2n@gemulon.postgresql.org>
Permalink:  ../E1w91PB-002utu-2n@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w91PB-002utu-2n@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: john.naylor@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Compute CRC32C on ARM using the Crypto Extension where available
  In-Reply-To: <E1w91PB-002utu-2n@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox