Skip to content

Commit 94fd378

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.5-bogner
1 parent 3b10e31 commit 94fd378

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

offload/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} s390x-ibm-linux-gnu")
207207
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} s390x-ibm-linux-gnu-LTO")
208208
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} riscv64-unknown-linux-gnu")
209209
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} riscv64-unknown-linux-gnu-LTO")
210+
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} loongarch64-unknown-linux-gnu")
211+
set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} loongarch64-unknown-linux-gnu-LTO")
210212

211213
# Once the plugins for the different targets are validated, they will be added to
212214
# the list of supported targets in the current system.

offload/plugins-nextgen/common/src/Utils/ELF.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ uint16_t utils::elf::getTargetMachine() {
4747
return EM_PPC64;
4848
#elif defined(__riscv)
4949
return EM_RISCV;
50+
#elif defined(__loongarch__)
51+
return EM_LOONGARCH;
5052
#else
5153
#warning "Unknown ELF compilation target architecture"
5254
return EM_NONE;

offload/plugins-nextgen/host/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x)
1+
set(supported_targets x86_64 aarch64 ppc64 ppc64le riscv64 s390x loongarch64)
22
if(NOT ${CMAKE_SYSTEM_PROCESSOR} IN_LIST supported_targets)
33
message(STATUS "Not building ${machine} NextGen offloading plugin")
44
return()
@@ -63,4 +63,8 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64$")
6363
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
6464
"riscv64-unknown-linux-gnu" "riscv64-unknown-linux-gnu-LTO")
6565
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
66+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "loongarch64$")
67+
list(APPEND LIBOMPTARGET_SYSTEM_TARGETS
68+
"loongarch64-unknown-linux-gnu" "loongarch64-unknown-linux-gnu-LTO")
69+
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
6670
endif()

offload/plugins-nextgen/host/dynamic_ffi/ffi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef enum ffi_abi {
4444
#if (defined(_M_X64) || defined(__x86_64__))
4545
FFI_DEFAULT_ABI = 2, // FFI_UNIX64.
4646
#elif defined(__aarch64__) || defined(__arm64__) || defined(_M_ARM64) || \
47-
defined(__riscv)
47+
defined(__riscv) || defined(__loongarch__)
4848
FFI_DEFAULT_ABI = 1, // FFI_SYSV.
4949
#elif defined(__powerpc64__)
5050
FFI_DEFAULT_ABI = 8, // FFI_LINUX.

offload/plugins-nextgen/host/src/rtl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,8 @@ struct GenELF64PluginTy final : public GenericPluginTy {
442442
#endif
443443
#elif defined(__riscv) && (__riscv_xlen == 64)
444444
return llvm::Triple::riscv64;
445+
#elif defined(__loongarch__) && (__loongarch_grlen == 64)
446+
return llvm::Triple::loongarch64;
445447
#else
446448
return llvm::Triple::UnknownArch;
447449
#endif

0 commit comments

Comments
 (0)