Skip to content

Commit

Permalink
Add defines for mips and loongarch64 architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
tx00100xt committed Mar 16, 2024
1 parent ac09dca commit 8546e47
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions SamTFE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
message(STATUS "Architecture RISCV64, -march=rv64gc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
add_compile_options(-mpowerpc64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
add_compile_options(-march=loongarch64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
add_compile_options(-march=mips32r2)
else()
if(LOCAL_INSTALL)
add_compile_options(-march=native)
Expand Down Expand Up @@ -413,6 +417,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
add_compile_options(-ftree-vectorize)
add_compile_options(-fomit-frame-pointer)
message(STATUS "AARCH64, -march=armv8-a+crc+fp+simd")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
message(STATUS "Loongsoon 3 5000 series processor")
else()
message(FATAL_ERROR "Unknown ARM processor '${CMAKE_SYSTEM_PROCESSOR}'")
endif()
Expand Down
10 changes: 6 additions & 4 deletions SamTFE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ typedef uint32_t UINT;
#define PLATFORM_RISCV64 0
#endif

#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(__mips__) || defined(__s390x__) || defined(__s390__) \
#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(mips) || defined(__mips__) || defined(__mips) || defined(__s390x__) || defined(__s390__) \
|| defined(_powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) \
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__)
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)
#define PLATFORM_NOT_X86 1
#else
#define PLATFORM_NOT_X86 0
#endif

#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_ARCH_PPC64) \
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__)
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)

#define PLATFORM_64BIT 1

#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || defined(__POWERPC__) \
|| defined(_M_PPC) || defined(_ARCH_PPC)
|| defined(_M_PPC) || defined(_ARCH_PPC) || (defined(mips) && !defined(__LP64__)) || (defined(mips__) && !defined(__LP64__)) || (defined(__mips__) && !defined(__LP64__))

#define PLATFORM_32BIT 1

Expand Down
6 changes: 6 additions & 0 deletions SamTSE/Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
message(STATUS "Architecture RISCV64, -march=rv64gc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
add_compile_options(-mpowerpc64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
add_compile_options(-march=loongarch64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips|mips64|mipsel|mips64el")
add_compile_options(-march=mips32r2)
else()
if(LOCAL_INSTALL)
add_compile_options(-march=native)
Expand Down Expand Up @@ -413,6 +417,8 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_
add_compile_options(-ftree-vectorize)
add_compile_options(-fomit-frame-pointer)
message(STATUS "AARCH64, -march=armv8-a+crc+fp+simd")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64")
message(STATUS "Loongsoon 3 5000 series processor")
else()
message(FATAL_ERROR "Unknown ARM processor '${CMAKE_SYSTEM_PROCESSOR}'")
endif()
Expand Down
10 changes: 6 additions & 4 deletions SamTSE/Sources/Engine/Base/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,23 @@ typedef uint32_t UINT;
#define PLATFORM_RISCV64 0
#endif

#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(__mips__) || defined(__s390x__) || defined(__s390__) \
#if defined(__aarch64__) || defined(__arm__) || PLATFORM_RISCV64 || defined(mips) || defined(__mips__) || defined(__mips) || defined(__s390x__) || defined(__s390__) \
|| defined(_powerpc) || defined(__powerpc__) || defined(__powerpc64__) || defined(__POWERPC__) || defined(__ppc__) \
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__)
|| defined(__ppc64__) || defined(__PPC__) || defined(__PPC64__) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)
#define PLATFORM_NOT_X86 1
#else
#define PLATFORM_NOT_X86 0
#endif

#if defined(__x86_64__) || defined(_M_X64) || defined(__aarch64__) || defined(_ARCH_PPC64) \
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__)
|| defined(_M_IA64) || defined(__IA64__) || defined(__e2k__) || PLATFORM_RISCV64 || defined(__powerpc64__) || defined(__s390x__) || defined(__ppc64__) \
|| defined(__loongarch_lp64) || defined(__loongarch_double_float) || defined(__loongarch_single_float) || defined(__loongarch_soft_float)

#define PLATFORM_64BIT 1

#elif defined(__i386) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || defined(__POWERPC__) \
|| defined(_M_PPC) || defined(_ARCH_PPC)
|| defined(_M_PPC) || defined(_ARCH_PPC) || (defined(mips) && !defined(__LP64__)) || (defined(mips__) && !defined(__LP64__)) || (defined(__mips__) && !defined(__LP64__))

#define PLATFORM_32BIT 1

Expand Down

0 comments on commit 8546e47

Please sign in to comment.