Re: vectorized CRC on ARM64
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-01T15:24:40Z
Lists: pgsql-hackers
On Wed, Apr 01, 2026 at 06:48:10PM +0700, John Naylor wrote:
> I don't think appending +crypto would work everywhere IIUC -- if the
> packager set +crc in the CFLAGS, then CFLAGS_CRC="" so there is no
> existing -march to put it on, and the PMULL check would fail. Maybe
> that's okay if we call that out in the release notes, since that's
> probably rare. Then we could check both with and without +crypto
> tacked on.
>
> I tried appending the new -march value, and that works since last one
> wins. But that might have the same problem as above if the packager
> put something special in CFLAGS for -march, that would get wiped out
> by our new one.
The other idea I had was to always add +crypto in the existing tests
(unless we're not setting CFLAGS_CRC), and then to just do the PMULL check
with whatever CFLAGS_CRC is set to, not bothering to try different values.
That doesn't fix the problem you mentioned in the quoted text, but maybe
it's a little sturdier.
... or maybe we should just use __attribute__((target("..."))) for the
PMULL stuff. That wouldn't work well for clang versions before 16, but it
at least wouldn't regress anything. They just wouldn't get PMULL support.
--
nathan
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use C11 alignas instead of pg_attribute_aligned
- 182f6944d3d0 19 (unreleased) landed
- 8061bfd15abe master landed
-
Add missing guard for __builtin_constant_p
- 936d8974c3bc 18.4 landed
- 676626426285 19 (unreleased) landed
-
Exit early from pg_comp_crc32c_pmull for small inputs
- 948ef7cdc499 19 (unreleased) landed
-
Fix unused function warning on Arm platforms
- 2849fe4c9785 19 (unreleased) landed
-
Compute CRC32C on ARM using the Crypto Extension where available
- fbc57f2bc2ee 19 (unreleased) landed