[x265] [PATCH] AArch64: Warn when compile time feature detection is unsupported

Hari Limaye hari.limaye at arm.com
Thu Aug 1 09:29:01 UTC 2024


Hi Chen,

Thank you for reviewing the SAD patches.

I am putting this patch up to handle emitting warnings for platforms
where compile time feature detection is not implemented - as this is
currently true for all the existing find_package(*) scripts for AArch64
feature detection.

Note: this patch is based on the `AArch64 SAD/SADxN Optimisations`
stack.

Many thanks,
Hari

---
As compile time feature detection for AArch64 platforms is currently
only supported on Linux and Darwin platforms, emit a warning message
when compiling for any other platform.
---
 source/CMakeLists.txt | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 8288fd234..55e4926c6 100755
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -265,25 +265,32 @@ if(GCC)
         set(CPU_HAS_NEON 1)
         add_definitions(-DX265_ARCH_ARM64=1 -DHAVE_NEON=1)
 
-        # Handle cross-compilation options.
-        if(CROSS_COMPILE_NEON_DOTPROD)
-            set(CPU_HAS_NEON_DOTPROD 1)
-        endif()
-        if(CROSS_COMPILE_SVE)
-            set(CPU_HAS_SVE 1)
-            # We impose the constraint that SVE implies Neon DotProd.
-            set(CPU_HAS_NEON_DOTPROD 1)
-        endif()
-        if(CROSS_COMPILE_SVE2)
-            set(CPU_HAS_SVE2 1)
-            # SVE2 implies SVE and Neon DotProd.
-            set(CPU_HAS_SVE 1)
-            set(CPU_HAS_NEON_DOTPROD 1)
+        if(CROSS_COMPILE_ARM64)
+            # Handle cross-compilation options.
+            if(CROSS_COMPILE_NEON_DOTPROD)
+                set(CPU_HAS_NEON_DOTPROD 1)
+            endif()
+            if(CROSS_COMPILE_SVE)
+                set(CPU_HAS_SVE 1)
+                # We impose the constraint that SVE implies Neon DotProd.
+                set(CPU_HAS_NEON_DOTPROD 1)
+            endif()
+            if(CROSS_COMPILE_SVE2)
+                set(CPU_HAS_SVE2 1)
+                # SVE2 implies SVE and Neon DotProd.
+                set(CPU_HAS_SVE 1)
+                set(CPU_HAS_NEON_DOTPROD 1)
+            endif()
+        else()
+            if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+                find_package(NEON_DOTPROD)
+                find_package(SVE)
+                find_package(SVE2)
+            else()
+                message(STATUS "Compile time feature detection unsupported on this platform")
+            endif()
         endif()
 
-        find_package(NEON_DOTPROD)
-        find_package(SVE)
-        find_package(SVE2)
         if(CPU_HAS_NEON_DOTPROD)
             # Neon DotProd is mandatory from Armv8.4.
             message(STATUS "Found Neon DotProd")
-- 
2.42.1

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-AArch64-Warn-when-compile-time-feature-detection-is-.patch
Type: text/x-patch
Size: 2937 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20240801/56bf5942/attachment.bin>


More information about the x265-devel mailing list