aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorlimeidan <limeidan@loongson.cn>2026-02-10 19:31:23 +0800
committerGopher Robot <gobot@golang.org>2026-02-12 10:17:33 -0800
commit287451f09ccd6e744473c35d2b7fe41985b7f789 (patch)
tree382c74566e5ff9b0a348b923f64ff97d72b38655 /src/math
parent71232268768eab3002d2ae473b49f74b74e89cdf (diff)
downloadgo-287451f09ccd6e744473c35d2b7fe41985b7f789.tar.xz
math/big: optimize the implementation of lshVU on loong64
Change-Id: I1aac166aea4f907a7fb93028a39ef9d1e3888c9c Reviewed-on: https://go-review.googlesource.com/c/go/+/743800 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Diffstat (limited to 'src/math')
-rw-r--r--src/math/big/arith_loong64.s6
-rw-r--r--src/math/big/internal/asmgen/loong64.go2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/math/big/arith_loong64.s b/src/math/big/arith_loong64.s
index b2af925124..ad92f07690 100644
--- a/src/math/big/arith_loong64.s
+++ b/src/math/big/arith_loong64.s
@@ -162,10 +162,8 @@ TEXT ·lshVU(SB), NOSPLIT, $0
MOVV x_base+24(FP), R6
MOVV z_base+0(FP), R7
// run loop backward
- SLLV $3, R4, R8
- ADDVU R8, R6
- SLLV $3, R4, R8
- ADDVU R8, R7
+ ALSLV $3, R4, R6, R6
+ ALSLV $3, R4, R7, R7
// shift first word into carry
MOVV -8(R6), R8
MOVV $64, R9
diff --git a/src/math/big/internal/asmgen/loong64.go b/src/math/big/internal/asmgen/loong64.go
index e2d05690ab..104439dacd 100644
--- a/src/math/big/internal/asmgen/loong64.go
+++ b/src/math/big/internal/asmgen/loong64.go
@@ -40,6 +40,8 @@ var ArchLoong64 = &Arch{
or: "OR",
xor: "XOR",
+ addWords: "ALSLV $3, %[1]s, %[2]s, %[3]s",
+
jmpZero: "BEQ %s, %s",
jmpNonZero: "BNE %s, %s",
}