mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-10-28 18:07:12 +08:00
[libyuv] Use Armv8.5-A architecture flags for SME and SVE2 build targets
Update BUILD.gn, CMakeLists.txt, and BUILD.bazel to specify Armv8.5-A baseline architecture flags rather than Armv9: - BUILD.gn: update :libyuv_sve to -march=armv8.5-a+i8mm+sve2 and :libyuv_sme to -march=armv8.5-a+i8mm+sme. - CMakeLists.txt: update SME check and compile options to -march=armv8.5-a+i8mm+sme (SVE target already uses armv8.5-a). - BUILD.bazel: update ENABLE_SVE_COPTS to -march=armv8.5-a+i8mm+sve2. Using -march=armv9-a enabled baseline SVE in the compiler, causing Clang to emit non-streaming SVE instructions (such as cntd in function prologues prior to smstart) in SME translation units. On processors such as Apple M4/M5 that support SME but not SVE, executing these prologue instructions resulted in SIGILL crashes. Test: ninja -C out/arm64.release libyuv libyuv_unittest Bug: 558654023 Change-Id: Ic7f62842bc9bd71608cc78ad11fd5e2214ef5e8e TAG=agy CONV=a70f0e53-caf2-4fbe-a024-1616ed25ba9a Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8376021 Commit-Queue: Wan-Teh Chang <wtc@google.com> Reviewed-by: Wan-Teh Chang <wtc@google.com>
This commit is contained in:
parent
137e29972e
commit
fab11704cd
@ -36,7 +36,7 @@ SUPPORTS_SVE_COPTS = [
|
||||
]
|
||||
|
||||
ENABLE_SVE_COPTS = [
|
||||
"-march=armv9-a+i8mm+sve2",
|
||||
"-march=armv8.5-a+i8mm+sve2",
|
||||
]
|
||||
|
||||
SVE_COPTS = select({
|
||||
|
||||
9
BUILD.gn
9
BUILD.gn
@ -248,8 +248,8 @@ if (libyuv_use_sve) {
|
||||
# The -march arguments below are incompatible with libc++ modules.
|
||||
use_libcxx_modules = false
|
||||
|
||||
# SVE2 is an Armv9-A feature.
|
||||
cflags = [ "-march=armv9-a+i8mm+sve2" ]
|
||||
# SVE2 is an Armv9-A feature, but use Armv8.5-A for compatibility.
|
||||
cflags = [ "-march=armv8.5-a+i8mm+sve2" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -268,8 +268,9 @@ if (libyuv_use_sme) {
|
||||
# The -march arguments below are incompatible with libc++ modules.
|
||||
use_libcxx_modules = false
|
||||
|
||||
# SME is an Armv9-A feature.
|
||||
cflags = [ "-march=armv9-a+i8mm+sme" ]
|
||||
# SME is an Armv9-A feature, but use Armv8.5-A for compatibility with
|
||||
# processors like Apple M4/M5 that support SME without SVE.
|
||||
cflags = [ "-march=armv8.5-a+i8mm+sme" ]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,12 +114,12 @@ if(NOT MSVC)
|
||||
target_compile_options(${ly_lib_name}_sve PRIVATE -march=armv8.5-a+i8mm+sve2)
|
||||
list(APPEND ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_sve>)
|
||||
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(OLD_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=armv9-a+i8mm+sme")
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
# Check whether the compiler can compile SME functions; this fails
|
||||
# with Clang for Windows.
|
||||
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||
set(OLD_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -march=armv8.5-a+i8mm+sme")
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
check_c_source_compiles("
|
||||
__arm_locally_streaming void func(void) { }
|
||||
int main(void) { return 0; }
|
||||
@ -133,7 +133,7 @@ int main(void) { return 0; }
|
||||
${ly_src_dir}/rotate_sme.cc
|
||||
${ly_src_dir}/row_sme.cc
|
||||
${ly_src_dir}/scale_sme.cc)
|
||||
target_compile_options(${ly_lib_name}_sme PRIVATE -march=armv9-a+i8mm+sme)
|
||||
target_compile_options(${ly_lib_name}_sme PRIVATE -march=armv8.5-a+i8mm+sme)
|
||||
list(APPEND ly_lib_parts $<TARGET_OBJECTS:${ly_lib_name}_sme>)
|
||||
else()
|
||||
add_definitions(-DLIBYUV_DISABLE_SME)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user