Re: vectorized CRC on ARM64
Haibo Yan <tristan.yim@gmail.com>
From: Haibo Yan <tristan.yim@gmail.com>
To: John Naylor <johncnaylorls@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-18T17:16:53Z
Lists: pgsql-hackers
On Tue, Mar 17, 2026 at 11:52 PM John Naylor <johncnaylorls@gmail.com> wrote: > On Wed, Mar 18, 2026 at 10:34 AM Haibo Yan <tristan.yim@gmail.com> wrote: > > > > Hi John > > > > Thank yo for working on this. I had one question about the mixed use of > intrinsics and inline asm here. > > > Since the implementation already uses NEON intrinsics such as vld1q_u64, > I was wondering why the pmull / pmull2 + eor helpers still need to be > inline asm rather than intrinsics. > > > > Is that due to compiler/toolchain support, or because the > intrinsic-based version produced noticeably worse code? > > I answered that in the email you replied to, re-quoted here: > > > To follow-up for curiosity's sake, [1] says that Apple chips can issue > > PMULL + EOR as a single uop if they are next to each other in the > > instruction stream. > > [1] https://dougallj.github.io/applecpu/firestorm.html > > I don't know if that's relevant for current server hardware, so it > could be pointless. I'm personally not a fan of inline assembly, but I > also didn't yet want to put in the effort to alter generated code. I > don't think it would be very hard to do, however. > Thanks, that makes sense as an explanation for why the inline asm is there today. But it also sounds like this is more of a temporary implementation choice than a conclusion that intrinsics are unsuitable. If so, I wonder whether it would be better to treat an intrinsics-based version as the preferred end state unless benchmarks show a clear regression. Regards Haibo
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