Skip to content

Commit

Permalink
configure: Do more elaborate test of whether SVE can be compiled
Browse files Browse the repository at this point in the history
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
llvm/llvm-project#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 35f0262)
  • Loading branch information
jzern committed May 3, 2024
1 parent e44918b commit a0c4e53
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions build/make/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,22 @@ check_neon_sve_bridge_compiles() {
#include <arm_neon_sve_bridge.h>
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 <<EOF
#include <arm_sve.h>
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
Expand Down

0 comments on commit a0c4e53

Please sign in to comment.