From d030017f77cbbffdb8d5ac5859e0957dc9651b70 Mon Sep 17 00:00:00 2001 From: Xing Li Date: Sat, 19 Aug 2023 11:25:31 +0800 Subject: [PATCH] Add LoongArch basic support --- build/cmake/TargetArch.cmake | 2 ++ cds/compiler/gcc/compiler_macro.h | 5 +++++ cds/details/defs.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/build/cmake/TargetArch.cmake b/build/cmake/TargetArch.cmake index 026eace07..308703593 100644 --- a/build/cmake/TargetArch.cmake +++ b/build/cmake/TargetArch.cmake @@ -39,6 +39,8 @@ set(archdetect_c_code " #error cmake_ARCH i386 #elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) #error cmake_ARCH x86_64 +#elif defined(__loongarch__) + #error cmake_ARCH LoongArch #elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) #error cmake_ARCH ia64 #elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\ diff --git a/cds/compiler/gcc/compiler_macro.h b/cds/compiler/gcc/compiler_macro.h index f954d6ca8..af8464ea0 100644 --- a/cds/compiler/gcc/compiler_macro.h +++ b/cds/compiler/gcc/compiler_macro.h @@ -122,6 +122,11 @@ # else # define CDS_BUILD_BITS 32 # endif +#elif defined(__loongarch__) +# define CDS_PROCESSOR_ARCH CDS_PROCESSOR_LOONGARCH +# define CDS_PROCESSOR__NAME "LOONGARCH" +# define CDS_PROCESSOR__NICK "loongarch" +# define CDS_BUILD_BITS 64 #else # if defined(CDS_USE_LIBCDS_ATOMIC) # error "Libcds does not support atomic implementation for the processor architecture. Try to use C++11-compatible compiler and remove CDS_USE_LIBCDS_ATOMIC flag from compiler command line" diff --git a/cds/details/defs.h b/cds/details/defs.h index 54095e5c2..ee8ffc7a0 100644 --- a/cds/details/defs.h +++ b/cds/details/defs.h @@ -222,6 +222,7 @@ namespace cds {} - CDS_PROCESSOR_PPC64 PowerPC64 - CDS_PROCESSOR_ARM7 ARM v7 - CDS_PROCESSOR_ARM8 ARM v8 + - CDS_PROCESSOR_LOONGARCH LoongArch - CDS_PROCESSOR_UNKNOWN undefined processor architecture CDS_PROCESSOR__NAME The name (string) of processor architecture @@ -278,6 +279,7 @@ namespace cds {} #define CDS_PROCESSOR_PPC64 5 // PowerPC 64bit #define CDS_PROCESSOR_ARM7 7 #define CDS_PROCESSOR_ARM8 8 +#define CDS_PROCESSOR_LOONGARCH 9 #define CDS_PROCESSOR_UNKNOWN -1 // Supported OS interfaces