summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/platform.nim5
-rw-r--r--lib/system.nim2
-rw-r--r--lib/system/platforms.nim4
-rw-r--r--tools/nim.zsh-completion1
-rw-r--r--tools/niminst/buildsh.nimf2
-rw-r--r--tools/niminst/makefile.nimf3
6 files changed, 13 insertions, 4 deletions
diff --git a/compiler/platform.nim b/compiler/platform.nim
index eb1398677..4e6054d5c 100644
--- a/compiler/platform.nim
+++ b/compiler/platform.nim
@@ -202,7 +202,7 @@ type
     cpuPowerpc64el, cpuSparc, cpuVm, cpuHppa, cpuIa64, cpuAmd64, cpuMips,
     cpuMipsel, cpuArm, cpuArm64, cpuJS, cpuNimVM, cpuAVR, cpuMSP430,
     cpuSparc64, cpuMips64, cpuMips64el, cpuRiscV32, cpuRiscV64, cpuEsp, cpuWasm32,
-    cpuE2k
+    cpuE2k, cpuLoongArch64
 
 type
   TInfoCPU* = tuple[name: string, intSize: int, endian: Endianness,
@@ -238,7 +238,8 @@ const
     (name: "riscv64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
     (name: "esp", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
     (name: "wasm32", intSize: 32, endian: littleEndian, floatSize: 64, bit: 32),
-    (name: "e2k", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64)]
+    (name: "e2k", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64),
+    (name: "loongarch64", intSize: 64, endian: littleEndian, floatSize: 64, bit: 64)]
 
 type
   Target* = object
diff --git a/lib/system.nim b/lib/system.nim
index 012aefe6a..c424cbc1b 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -1126,7 +1126,7 @@ const
     ## Possible values:
     ## `"i386"`, `"alpha"`, `"powerpc"`, `"powerpc64"`, `"powerpc64el"`,
     ## `"sparc"`, `"amd64"`, `"mips"`, `"mipsel"`, `"arm"`, `"arm64"`,
-    ## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`.
+    ## `"mips64"`, `"mips64el"`, `"riscv32"`, `"riscv64"`, '"loongarch64"'.
 
   seqShallowFlag = low(int)
   strlitFlag = 1 shl (sizeof(int)*8 - 2) # later versions of the codegen \
diff --git a/lib/system/platforms.nim b/lib/system/platforms.nim
index 5bca8cb1c..b4c9f1f06 100644
--- a/lib/system/platforms.nim
+++ b/lib/system/platforms.nim
@@ -36,7 +36,8 @@ type
     riscv32,                   ## RISC-V 32-bit processor
     riscv64,                   ## RISC-V 64-bit processor
     wasm32,                    ## WASM, 32-bit
-    e2k                        ## MCST Elbrus 2000
+    e2k,                       ## MCST Elbrus 2000
+    loongarch64                ## LoongArch 64-bit processor
 
   OsPlatform* {.pure.} = enum ## the OS this program will run on.
     none, dos, windows, os2, linux, morphos, skyos, solaris,
@@ -95,5 +96,6 @@ const
                elif defined(riscv64): CpuPlatform.riscv64
                elif defined(wasm32): CpuPlatform.wasm32
                elif defined(e2k): CpuPlatform.e2k
+               elif defined(loongarch64): CpuPlatform.loongarch64
                else: CpuPlatform.none
     ## the CPU this program will run on.
diff --git a/tools/nim.zsh-completion b/tools/nim.zsh-completion
index 07a221e9c..45477d860 100644
--- a/tools/nim.zsh-completion
+++ b/tools/nim.zsh-completion
@@ -95,6 +95,7 @@ _nim() {
     '*--cpu=sparc64[compile for SPARC64 architecture]' \
     '*--cpu=vm[compile for Nim VM]' \
     '*--cpu=wasm32[compile to WASM 32]' \
+    '*--cpu=loongarch64[compile for LoongArch64 architecture]' \
     '*--gc=refc[use reference counting garbage collection]' \
     '*--gc=arc[use ARC garbage collection]' \
     '*--gc=orc[use ORC garbage collection]' \
diff --git a/tools/niminst/buildsh.nimf b/tools/niminst/buildsh.nimf
index b81ac731f..464c70abf 100644
--- a/tools/niminst/buildsh.nimf
+++ b/tools/niminst/buildsh.nimf
@@ -229,6 +229,8 @@ case $ucpu in
     mycpu="riscv64" ;;
   *e2k* )
     mycpu="e2k" ;;
+  *loongarch64* )
+    mycpu="loongarch64" ;;
   *)
     echo 2>&1 "Error: unknown processor: $ucpu"
     exit 1
diff --git a/tools/niminst/makefile.nimf b/tools/niminst/makefile.nimf
index c4f2f0e79..a1f3fa977 100644
--- a/tools/niminst/makefile.nimf
+++ b/tools/niminst/makefile.nimf
@@ -169,6 +169,9 @@ endif
 ifeq ($(ucpu),e2k)
   mycpu = e2k
 endif
+ifeq ($(ucpu),loongarch64)
+  mycpu = loongarch64
+endif
 ifndef mycpu
   $(error unknown CPU architecture: $(ucpu) See makefile.nimf)
 endif