Re: [PATCH] Add native windows on arm64 support - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [PATCH] Add native windows on arm64 support
Date
Msg-id e567e1df-ad6e-9295-2592-a5cda4d76c50@eisentraut.org
Whole thread Raw
In response to Re: [PATCH] Add native windows on arm64 support  (Niyas Sait <niyas.sait@linaro.org>)
List 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?




pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: BufferUsage counters' values have changed
Next
From: Andres Freund
Date:
Subject: Re: BufferUsage counters' values have changed