179894
commit 77d175e14e5f4cf24e9579c03eef5d006a286316
179894
Author: Naohiro Tamura <naohirot@jp.fujitsu.com>
179894
Date:   Wed May 12 09:26:40 2021 +0000
179894
179894
    config: Added HAVE_AARCH64_SVE_ASM for aarch64
179894
    
179894
    This patch checks if assembler supports '-march=armv8.2-a+sve' to
179894
    generate SVE code or not, and then define HAVE_AARCH64_SVE_ASM macro.
179894
179894
Conflicts:
179894
	config.h.in
179894
	  (missing PAC+BTI support downstream, missing other ports)
179894
179894
diff --git a/config.h.in b/config.h.in
179894
index 8520b0fa8d4668fb..94d5ea367e10f849 100644
179894
--- a/config.h.in
179894
+++ b/config.h.in
179894
@@ -112,6 +112,11 @@
179894
 /* AArch64 big endian ABI */
179894
 #undef HAVE_AARCH64_BE
179894
 
179894
+/* Assembler support ARMv8.2-A SVE.
179894
+   This macro becomes obsolete when glibc increased the minimum
179894
+   required version of GNU 'binutils' to 2.28 or later. */
179894
+#define HAVE_AARCH64_SVE_ASM 0
179894
+
179894
 /* RISC-V integer ABI for ld.so.  */
179894
 #undef RISCV_ABI_XLEN
179894
 
179894
diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure
179894
index f78a79338aba1e34..9fb713155d4ee6d8 100644
179894
--- a/sysdeps/aarch64/configure
179894
+++ b/sysdeps/aarch64/configure
179894
@@ -212,3 +212,31 @@ fi
179894
 $as_echo "$libc_cv_aarch64_variant_pcs" >&6; }
179894
 config_vars="$config_vars
179894
 aarch64-variant-pcs = $libc_cv_aarch64_variant_pcs"
179894
+
179894
+# Check if asm support armv8.2-a+sve
179894
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SVE support in assembler" >&5
179894
+$as_echo_n "checking for SVE support in assembler... " >&6; }
179894
+if ${libc_cv_asm_sve+:} false; then :
179894
+  $as_echo_n "(cached) " >&6
179894
+else
179894
+  cat > conftest.s <<\EOF
179894
+        ptrue p0.b
179894
+EOF
179894
+if { ac_try='${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&5'
179894
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
179894
+  (eval $ac_try) 2>&5
179894
+  ac_status=$?
179894
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
179894
+  test $ac_status = 0; }; }; then
179894
+  libc_cv_aarch64_sve_asm=yes
179894
+else
179894
+  libc_cv_aarch64_sve_asm=no
179894
+fi
179894
+rm -f conftest*
179894
+fi
179894
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_asm_sve" >&5
179894
+$as_echo "$libc_cv_asm_sve" >&6; }
179894
+if test $libc_cv_aarch64_sve_asm = yes; then
179894
+  $as_echo "#define HAVE_AARCH64_SVE_ASM 1" >>confdefs.h
179894
+
179894
+fi
179894
diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac
179894
index 7f13bfb93b60bfd7..0236cfcdf3c8d10d 100644
179894
--- a/sysdeps/aarch64/configure.ac
179894
+++ b/sysdeps/aarch64/configure.ac
179894
@@ -42,3 +42,18 @@ EOF
179894
   fi
179894
   rm -rf conftest.*])
179894
 LIBC_CONFIG_VAR([aarch64-variant-pcs], [$libc_cv_aarch64_variant_pcs])
179894
+
179894
+# Check if asm support armv8.2-a+sve
179894
+AC_CACHE_CHECK(for SVE support in assembler, libc_cv_asm_sve, [dnl
179894
+cat > conftest.s <<\EOF
179894
+        ptrue p0.b
179894
+EOF
179894
+if AC_TRY_COMMAND(${CC-cc} -c -march=armv8.2-a+sve conftest.s 1>&AS_MESSAGE_LOG_FD); then
179894
+  libc_cv_aarch64_sve_asm=yes
179894
+else
179894
+  libc_cv_aarch64_sve_asm=no
179894
+fi
179894
+rm -f conftest*])
179894
+if test $libc_cv_aarch64_sve_asm = yes; then
179894
+  AC_DEFINE(HAVE_AARCH64_SVE_ASM)
179894
+fi