From e2e986e99a35bf91bc4591566711c561feae8603 Mon Sep 17 00:00:00 2001 From: tsingkong Date: Wed, 5 Mar 2025 20:09:16 +0800 Subject: [PATCH] added support for loongarch --- CMakeLists.txt | 2 ++ src/utils/src/cpu_info.cpp | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c6bd50783..90c5de696 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,6 +128,8 @@ else() if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm64") ucm_add_flags(C CXX "-march=native -mtune=generic") + elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "loongarch64") + ucm_add_flags(C CXX "-march=native -mtune=generic") else() ucm_add_flags(C CXX "-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt") if(KLOGG_GENERIC_CPU) diff --git a/src/utils/src/cpu_info.cpp b/src/utils/src/cpu_info.cpp index 4e5b316f3..fe87d3352 100644 --- a/src/utils/src/cpu_info.cpp +++ b/src/utils/src/cpu_info.cpp @@ -89,7 +89,8 @@ CpuInstructions supportedCpuInstructions() CpuInstructions supportedCpuInstructions() { CpuInstructions cpuInstructions = CpuInstructions::NONE; - +#if defined(__loongarch__) +#else if ( __builtin_cpu_supports( "avx512f" ) ) { cpuInstructions |= CpuInstructions::SSE2; cpuInstructions |= CpuInstructions::SSE3; @@ -134,6 +135,7 @@ CpuInstructions supportedCpuInstructions() if ( __builtin_cpu_supports( "popcnt" ) ) { cpuInstructions |= CpuInstructions::POPCNT; } +#endif return cpuInstructions; } #else