Unverified Commit af229eb4 authored by ZangRuochen's avatar ZangRuochen Committed by GitHub
Browse files

Add LoongArch architecture LSX support. (#4467)



LoongArch is a new architecture, already supported by linux-6.1, gcc-12.
Signed-off-by: default avatarZang Ruochen <zangruochen@loongson.cn>
Co-authored-by: default avatarZang Ruochen <zangruochen@loongson.cn>
parent faee23a2
...@@ -48,6 +48,11 @@ if ("${TARGET_ARCH}" MATCHES "ppc") ...@@ -48,6 +48,11 @@ if ("${TARGET_ARCH}" MATCHES "ppc")
set(PPC ON) set(PPC ON)
add_definitions(-D__PPC__=1) add_definitions(-D__PPC__=1)
endif() endif()
if ("${TARGET_ARCH}" MATCHES "loongarch64")
set(LOONGARCH64 ON)
add_definitions(-D__LOONGARCH64__=1 -mlsx)
endif()
# Where to install # Where to install
IF(WIN32) IF(WIN32)
......
...@@ -87,6 +87,8 @@ set(archdetect_c_code " ...@@ -87,6 +87,8 @@ set(archdetect_c_code "
#else #else
#error cmake_ARCH ppc #error cmake_ARCH ppc
#endif #endif
#elif defined(__loongarch64)
#error cmake_ARCH loongarch64
#endif #endif
#error cmake_ARCH unknown #error cmake_ARCH unknown
......
...@@ -94,7 +94,7 @@ static int getNumProcessors() { ...@@ -94,7 +94,7 @@ static int getNumProcessors() {
#define cpuid __cpuid #define cpuid __cpuid
#else #else
#if !defined(__ANDROID__) && !defined(__PNACL__) && !defined(__PPC__) \ #if !defined(__ANDROID__) && !defined(__PNACL__) && !defined(__PPC__) \
&& !defined(__ARM__) && !defined(__ARM64__) && !defined(__ARM__) && !defined(__ARM64__) && !defined(__LOONGARCH64__)
static void cpuid(int cpuInfo[4], int infoType) { static void cpuid(int cpuInfo[4], int infoType) {
#ifdef __LP64__ #ifdef __LP64__
__asm__ __volatile__ ( __asm__ __volatile__ (
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment