]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Compute CRC32C on ARM using the Crypto Extension where available
authorJohn Naylor <john.naylor@postgresql.org>
Sat, 4 Apr 2026 13:47:01 +0000 (20:47 +0700)
committerJohn Naylor <john.naylor@postgresql.org>
Sat, 4 Apr 2026 13:47:01 +0000 (20:47 +0700)
commitfbc57f2bc2ee498958a4c5326002af39dd99c90b
treeedcc1ea2f2cf1c2ac3ce661c44e62375ea7f744c
parent5e13b0f240397b210a0af11f83204d0b4f1713c2
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
config/c-compiler.m4
configure
configure.ac
meson.build
src/include/pg_config.h.in
src/include/port/pg_crc32c.h
src/port/meson.build
src/port/pg_crc32c_armv8.c
src/port/pg_crc32c_armv8_choose.c