diff --git a/BUILD.bazel b/BUILD.bazel index a033be0e7..e8ce1c262 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -36,7 +36,7 @@ SUPPORTS_SVE_COPTS = [ ] ENABLE_SVE_COPTS = [ - "-march=armv9-a+i8mm+sve2", + "-march=armv8.5-a+i8mm+sve2", ] SVE_COPTS = select({ diff --git a/BUILD.gn b/BUILD.gn index 9dc188345..e6913efdc 100644 --- a/BUILD.gn +++ b/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" ] } } diff --git a/CMakeLists.txt b/CMakeLists.txt index 17f6cbda9..1622b5c05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 $) - 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 $) else() add_definitions(-DLIBYUV_DISABLE_SME)