[1/5] config: Added HAVE_SVE_ASM_SUPPORT for aarch64

Message ID 20210317023344.323099-1-naohirot@fujitsu.com
State Superseded
Delegated to: Szabolcs Nagy
Headers
Series Added optimized memcpy/memmove/memset for A64FX |

Commit Message

Naohiro Tamura March 17, 2021, 2:33 a.m. UTC
  From: Naohiro Tamura <naohirot@jp.fujitsu.com>

This patch checks if assembler supports '-march=armv8.2-a+sve' to
generate SVE code or not, and then define HAVE_SVE_ASM_SUPPORT macro.
---
 config.h.in                  |  3 +++
 sysdeps/aarch64/configure    | 28 ++++++++++++++++++++++++++++
 sysdeps/aarch64/configure.ac | 15 +++++++++++++++
 3 files changed, 46 insertions(+)
  

Comments

Szabolcs Nagy March 29, 2021, 12:11 p.m. UTC | #1
The 03/17/2021 02:33, Naohiro Tamura wrote:
> From: Naohiro Tamura <naohirot@jp.fujitsu.com>
> 
> This patch checks if assembler supports '-march=armv8.2-a+sve' to
> generate SVE code or not, and then define HAVE_SVE_ASM_SUPPORT macro.
> ---
>  config.h.in                  |  3 +++
>  sysdeps/aarch64/configure    | 28 ++++++++++++++++++++++++++++
>  sysdeps/aarch64/configure.ac | 15 +++++++++++++++
>  3 files changed, 46 insertions(+)
> 
> diff --git a/config.h.in b/config.h.in
> index f21bf04e47..2073816af8 100644
> --- a/config.h.in
> +++ b/config.h.in
> @@ -118,6 +118,9 @@
>  /* AArch64 PAC-RET code generation is enabled.  */
>  #define HAVE_AARCH64_PAC_RET 0
>  
> +/* Assembler support ARMv8.2-A SVE */
> +#define HAVE_SVE_ASM_SUPPORT 0
> +

i prefer to use HAVE_AARCH64_ prefix for aarch64 specific
macros in the global config.h, e.g. HAVE_AARCH64_SVE_ASM

and i'd like to have a comment here or in configue.ac with the
binutils version where this becomes obsolete (binutils 2.28 i
think). right now the minimum required version is 2.25, but
glibc may increase that soon to above 2.28.

> diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
> index 66f755078a..389a0b4e8d 100644
> --- a/sysdeps/aarch64/configure.ac
> +++ b/sysdeps/aarch64/configure.ac
> @@ -90,3 +90,18 @@ EOF
>    fi
>    rm -rf conftest.*])
>  LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
> +
> +# Check if asm support armv8.2-a+sve
> +AC_CACHE_CHECK(for SVE support in assembler, libc_cv_asm_sve, [dnl
> +cat > conftest.s <<\EOF
> +        ptrue p0.b
> +EOF
> +if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
> +  libc_cv_asm_sve=yes
> +else
> +  libc_cv_asm_sve=no
> +fi
> +rm -f conftest*])
> +if test $libc_cv_asm_sve = yes; then
> +  AC_DEFINE(HAVE_SVE_ASM_SUPPORT)
> +fi

i would use libc_cv_aarch64_sve_asm to make it obvious
that it's aarch64 specific setting.

otherwise OK.
  
Naohiro Tamura March 30, 2021, 6:19 a.m. UTC | #2
Szabolcs-san,

Thank you for your review.

> > +/* Assembler support ARMv8.2-A SVE */ #define
> HAVE_SVE_ASM_SUPPORT 0
> > +
> 
> i prefer to use HAVE_AARCH64_ prefix for aarch64 specific macros in the global
> config.h, e.g. HAVE_AARCH64_SVE_ASM

OK, I'll change it to HAVE_AARCH64_SVE_ASM.

> and i'd like to have a comment here or in configue.ac with the binutils version
> where this becomes obsolete (binutils 2.28 i think). right now the minimum
> required version is 2.25, but glibc may increase that soon to above 2.28.

I'll add the comment in config.h.in like this:

+/* Assembler support ARMv8.2-A SVE.
+   This macro becomes obsolete when glibc increased the minimum
+   required version of GNU 'binutils' to 2.28 or later. */
+#define HAVE_AARCH64_SVE_ASM 0

> > diff --git a/sysdeps/aarch64/configure.ac
> > b/sysdeps/aarch64/configure.ac index 66f755078a..389a0b4e8d 100644
> > --- a/sysdeps/aarch64/configure.ac
> > +++ b/sysdeps/aarch64/configure.ac
...
> > +if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s
> > +1>&AS_MESSAGE_LOG_FD); then
> > +  libc_cv_asm_sve=yes
> > +else
> > +  libc_cv_asm_sve=no
> > +fi
> > +rm -f conftest*])
> > +if test $libc_cv_asm_sve = yes; then
> > +  AC_DEFINE(HAVE_SVE_ASM_SUPPORT)
> > +fi
> 
> i would use libc_cv_aarch64_sve_asm to make it obvious that it's aarch64 specific
> setting.

OK, I'll change it to libc_cv_aarch64_sve_asm.

Thanks.
Naohiro
  

Patch

diff --git a/config.h.in b/config.h.in
index f21bf04e47..2073816af8 100644
--- a/config.h.in
+++ b/config.h.in
@@ -118,6 +118,9 @@ 
 /* AArch64 PAC-RET code generation is enabled.  */
 #define HAVE_AARCH64_PAC_RET 0
 
+/* Assembler support ARMv8.2-A SVE */
+#define HAVE_SVE_ASM_SUPPORT 0
+
 /* ARC big endian ABI */
 #undef HAVE_ARC_BE
 
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
index 83c3a23e44..ac16250f8a 100644
--- a/sysdeps/aarch64/configure
+++ b/sysdeps/aarch64/configure
@@ -304,3 +304,31 @@  fi
 $as_echo "$libc_cv_aarch64_variant_pcs" >&6; }
 config_vars="$config_vars
 aarch64-variant-pcs = $libc_cv_aarch64_variant_pcs"
+
+# Check if asm support armv8.2-a+sve
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVE support in assembler" >&5
+$as_echo_n "checking for SVE support in assembler... " >&6; }
+if ${libc_cv_asm_sve+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.s <<\EOF
+        ptrue p0.b
+EOF
+if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+  libc_cv_asm_sve=yes
+else
+  libc_cv_asm_sve=no
+fi
+rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_sve" >&5
+$as_echo "$libc_cv_asm_sve" >&6; }
+if test $libc_cv_asm_sve = yes; then
+  $as_echo "#define HAVE_SVE_ASM_SUPPORT 1" >>confdefs.h
+
+fi
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
index 66f755078a..389a0b4e8d 100644
--- a/sysdeps/aarch64/configure.ac
+++ b/sysdeps/aarch64/configure.ac
@@ -90,3 +90,18 @@  EOF
   fi
   rm -rf conftest.*])
 LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
+
+# Check if asm support armv8.2-a+sve
+AC_CACHE_CHECK(for SVE support in assembler, libc_cv_asm_sve, [dnl
+cat > conftest.s <<\EOF
+        ptrue p0.b
+EOF
+if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
+  libc_cv_asm_sve=yes
+else
+  libc_cv_asm_sve=no
+fi
+rm -f conftest*])
+if test $libc_cv_asm_sve = yes; then
+  AC_DEFINE(HAVE_SVE_ASM_SUPPORT)
+fi