Re: [PATCH] Add native windows on arm64 support

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Niyas Sait <niyas(dot)sait(at)linaro(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Add native windows on arm64 support
Date: 2023-09-13 19:09:12
Message-ID: e567e1df-ad6e-9295-2592-a5cda4d76c50@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02.05.23 09:51, Niyas Sait wrote:
> diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
> index cbc70a039c..2ecd5fcf38 100644
> --- a/doc/src/sgml/install-windows.sgml
> +++ b/doc/src/sgml/install-windows.sgml
> @@ -352,7 +352,8 @@ $ENV{MSBFLAGS}="/m";
> <title>Special Considerations for 64-Bit Windows</title>
>
> <para>
> - PostgreSQL will only build for the x64 architecture on 64-bit Windows.
> + PostgreSQL will only build for the x64 and ARM64 architectures on 64-bit
> + Windows.
> </para>

Are there other possible architectures besides x64 and ARM64? Itanium?
Or should we just delete this sentence?

> diff --git a/meson.build b/meson.build
> index 096044628c..6cca212fae 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2045,8 +2045,11 @@ int main(void)
> elif host_cpu == 'arm' or host_cpu == 'aarch64'
>
> prog = '''
> +#ifdef _MSC_VER
> +#include <intrin.h>
> +#else
> #include <arm_acle.h>
> -
> +#endif

Maybe keep the whitespace here.

> - if cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd without -march=armv8-a+crc',
> + if cc.get_id() == 'msvc'
> + cdata.set('USE_ARMV8_CRC32C', false)
> + cdata.set('USE_ARMV8_CRC32C_WITH_RUNTIME_CHECK', 1)
> + have_optimized_crc = true
> + elif cc.links(prog, name: '__crc32cb, __crc32ch, __crc32cw, and __crc32cd without -march=armv8-a+crc',

Add a comment here.

> diff --git a/src/port/pg_crc32c_armv8.c b/src/port/pg_crc32c_armv8.c
> index d8fae510cf..3d7eb748ff 100644
> --- a/src/port/pg_crc32c_armv8.c
> +++ b/src/port/pg_crc32c_armv8.c
> @@ -14,7 +14,9 @@
> */
> #include "c.h"
>
> +#ifndef _MSC_VER
> #include <arm_acle.h>
> +#endif

Also add a comment here.

>
> #include "port/pg_crc32c.h"
>
> diff --git a/src/tools/msvc/gendef.pl b/src/tools/msvc/gendef.pl
> index e7cbefcbc3..934dc17b96 100644
> --- a/src/tools/msvc/gendef.pl
> +++ b/src/tools/msvc/gendef.pl
> @@ -120,9 +120,9 @@ sub writedef
> {
> my $isdata = $def->{$f} eq 'data';
>
> - # Strip the leading underscore for win32, but not x64
> + # Strip the leading underscore for win32, but not x64 and aarch64

Is x64 the opposite of win32? Does this make sense? Should we reverse
the logic here and single out the one variant where the stripping is
necessary?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-09-13 19:10:30 Re: BufferUsage counters' values have changed
Previous Message Andres Freund 2023-09-13 18:59:39 Re: BufferUsage counters' values have changed