From a0c4e5366564427cfc1ee7a6a9982631e892c7ef Mon Sep 17 00:00:00 2001 From: James Zern Date: Thu, 2 May 2024 12:50:05 -0700 Subject: [PATCH] configure: Do more elaborate test of whether SVE can be compiled This is a port of the change in libaom: https://aomedia-review.googlesource.com/c/aom/+/189761 5ccdc66ab6 cpu.cmake: Do more elaborate test of whether SVE can be compiled For Windows targets, Clang will successfully compile simpler SVE functions, but if the function requires backing up and restoring SVE registers (as part of the AAPCS calling convention), Clang will fail to generate unwind data for this function, resulting in an error. This issue is tracked upstream in Clang in https://github.com/llvm/llvm-project/issues/80009. Check whether the compiler can compile such a function, and disable SVE if it is unable to handle that case. Change-Id: I8550248abd6a7876bd8ecf6ba66bc70518133566 (cherry picked from commit 35f0262c5e9dc9f69421b8d602e081311d3a18ea) --- build/make/configure.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/build/make/configure.sh b/build/make/configure.sh index b26878f360b..93643f3de37 100644 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -439,6 +439,22 @@ check_neon_sve_bridge_compiles() { #include EOF compile_result=$? + if [ ${compile_result} -eq 0 ]; then + # Check whether the compiler can compile SVE functions that require + # backup/restore of SVE registers according to AAPCS. Clang for Windows + # used to fail this, see + # https://github.com/llvm/llvm-project/issues/80009. + check_cc -march=armv8.2-a+dotprod+i8mm+sve < +void other(void); +svfloat32_t func(svfloat32_t a) { + other(); + return a; +} +EOF + compile_result=$? + fi + if [ ${compile_result} -ne 0 ]; then log_echo " disabling sve: arm_neon_sve_bridge.h not supported by compiler" disable_feature sve