]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: optimize the implementation of lshVU on loong64
authorlimeidan <limeidan@loongson.cn>
Tue, 10 Feb 2026 11:31:23 +0000 (19:31 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 12 Feb 2026 18:17:33 +0000 (10:17 -0800)
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>
src/math/big/arith_loong64.s
src/math/big/internal/asmgen/loong64.go

index b2af9251245a7eff88b2047695c367eb687fce6d..ad92f0769003fbbcd9207b7c39ba9a341fadada6 100644 (file)
@@ -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
index e2d05690ab4de4901f72f2bc9a22df3cb7fdd74f..104439dacd8940b4a9e7f32354d263a955dac74b 100644 (file)
@@ -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",
 }