pgsql: MSVC: Support building for AArch64.

From: Nathan Bossart <nathan(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: MSVC: Support building for AArch64.
Date: 2026-01-07 19:44:02
Message-ID: E1vdZRp-0059iN-2z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

MSVC: Support building for AArch64.

This commit does the following to get tests passing for
MSVC/AArch64:

* Implements spin_delay() with an ISB instruction (like we do for
gcc/clang on AArch64).

* Sets USE_ARMV8_CRC32C unconditionally. Vendor-supported versions
of Windows for AArch64 require at least ARMv8.1, which is where CRC
extension support became mandatory.

* Implements S_UNLOCK() with _InterlockedExchange(). The existing
implementation for MSVC uses _ReadWriteBarrier() (a compiler
barrier), which is insufficient for this purpose on non-TSO
architectures.

There are likely other changes required to take full advantage of
the hardware (e.g., atomics/arch-arm.h, simd.h,
pg_popcount_aarch64.c), but those can be dealt with later.

Author: Niyas Sait <niyas(dot)sait(at)linaro(dot)org>
Co-authored-by: Greg Burd <greg(at)burd(dot)me>
Co-authored-by: Dave Cramer <davecramer(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Reviewed-by: John Naylor <johncnaylorls(at)gmail(dot)com>
Reviewed-by: Peter Eisentraut <peter(at)eisentraut(dot)org>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Tested-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Discussion: https://postgr.es/m/A6152C7C-F5E3-4958-8F8E-7692D259FF2F%40greg.burd.me
Discussion: https://postgr.es/m/CAFPTBD-74%2BAEuN9n7caJ0YUnW5A0r-KBX8rYoEJWqFPgLKpzdg%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/installation.sgml | 3 ++-
meson.build | 6 +++++-
src/include/storage/s_lock.h | 30 +++++++++++++++++++++++++-----
src/port/pg_crc32c_armv8.c | 4 ++++
src/tools/msvc_gendef.pl | 8 ++++----
5 files changed, 40 insertions(+), 11 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-01-07 22:46:03 pgsql: Replace flaky CIC/RI isolation tests with a TAP test
Previous Message Peter Geoghegan 2026-01-07 17:54:44 pgsql: Fix nbtree skip array transformation comments.