aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Weinstein <jake@aospa.co>2022-12-21 09:02:54 +0900
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2023-01-10 16:43:05 +0000
commitcd28f3c4253257027f9834eb7b17db047346a267 (patch)
tree469497dcb5b13b38e0b081d702385f87a307c063
parent7c1d7a24c9e2ea5ba846a6311d24df2eb0154ea0 (diff)
downloadarm-optimized-routines-cd28f3c4253257027f9834eb7b17db047346a267.tar.gz
string: Compile memcpy-sve.S for aarch64 if compiler supports it
This is a partial revert of b7e368fb. If SVE assembly is guarded by __ARM_FEATURE_SVE, it cannot build when SVE is not enabled by the build system. This is ok on AOR, but because Android (bionic) uses ifuncs to select the appropriate assembly at runtime, these need to compile regardless of if the target actually supports the instructions. Check for AArch64 and GCC >= 8 or Clang >= 5 so that SVE is not used on compilers that do not support it. This condition will always be true on future builds of Android for AArch64.
-rw-r--r--string/aarch64/asmdefs.h9
-rw-r--r--string/aarch64/memcpy-sve.S7
2 files changed, 14 insertions, 2 deletions
diff --git a/string/aarch64/asmdefs.h b/string/aarch64/asmdefs.h
index b5ad6fb..18c331b 100644
--- a/string/aarch64/asmdefs.h
+++ b/string/aarch64/asmdefs.h
@@ -80,4 +80,13 @@ GNU_PROPERTY (FEATURE_1_AND, FEATURE_1_BTI|FEATURE_1_PAC)
#define SIZE_ARG(n)
#endif
+/* Compiler supports SVE instructions */
+#ifndef HAVE_SVE
+# if __aarch64__ && (__GNUC__ >= 8 || __clang_major__ >= 5)
+# define HAVE_SVE 1
+# else
+# define HAVE_SVE 0
+# endif
+#endif
+
#endif
diff --git a/string/aarch64/memcpy-sve.S b/string/aarch64/memcpy-sve.S
index b82510a..f74d4a9 100644
--- a/string/aarch64/memcpy-sve.S
+++ b/string/aarch64/memcpy-sve.S
@@ -11,10 +11,12 @@
*
*/
-#if __ARM_FEATURE_SVE
-
#include "asmdefs.h"
+#ifdef HAVE_SVE
+
+.arch armv8-a+sve
+
#define dstin x0
#define src x1
#define count x2
@@ -177,4 +179,5 @@ L(return):
ret
END (__memcpy_aarch64_sve)
+
#endif