]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: add regABI support in memclr and memmove functions on loong64
authorGuoqi Chen <chenguoqi@loongson.cn>
Wed, 16 Aug 2023 01:05:30 +0000 (09:05 +0800)
committerGopher Robot <gobot@golang.org>
Tue, 21 Nov 2023 19:22:16 +0000 (19:22 +0000)
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I55c78bab5c697ea6c30f9d81f5f8fb75abb3987c
Reviewed-on: https://go-review.googlesource.com/c/go/+/521786
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/runtime/memclr_loong64.s
src/runtime/memmove_loong64.s

index 7bb6f3dfc903af95f9ed1ce4f2b03556bee45027..313e4d4f3379547920f38f15bb4f6921122dc4d6 100644 (file)
@@ -6,37 +6,39 @@
 #include "textflag.h"
 
 // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
-TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16
-       MOVV    ptr+0(FP), R6
-       MOVV    n+8(FP), R7
-       ADDV    R6, R7, R4
+TEXT runtime·memclrNoHeapPointers<ABIInternal>(SB),NOSPLIT,$0-16
+#ifndef GOEXPERIMENT_regabiargs
+       MOVV    ptr+0(FP), R4
+       MOVV    n+8(FP), R5
+#endif
+       ADDV    R4, R5, R6
 
        // if less than 8 bytes, do one byte at a time
-       SGTU    $8, R7, R8
+       SGTU    $8, R5, R8
        BNE     R8, out
 
        // do one byte at a time until 8-aligned
-       AND     $7, R6, R8
+       AND     $7, R4, R8
        BEQ     R8, words
-       MOVB    R0, (R6)
-       ADDV    $1, R6
+       MOVB    R0, (R4)
+       ADDV    $1, R4
        JMP     -4(PC)
 
 words:
        // do 8 bytes at a time if there is room
-       ADDV    $-7, R4, R7
+       ADDV    $-7, R6, R5
 
        PCALIGN $16
-       SGTU    R7, R6, R8
+       SGTU    R5, R4, R8
        BEQ     R8, out
-       MOVV    R0, (R6)
-       ADDV    $8, R6
+       MOVV    R0, (R4)
+       ADDV    $8, R4
        JMP     -4(PC)
 
 out:
-       BEQ     R6, R4, done
-       MOVB    R0, (R6)
-       ADDV    $1, R6
+       BEQ     R4, R6, done
+       MOVB    R0, (R4)
+       ADDV    $1, R4
        JMP     -3(PC)
 done:
        RET
index 0f139bcc13dfe2da61cb5e987ffb6b5de17989a3..5b7aeba698c372fc1975ca3ab9c7ce6e6987db53 100644 (file)
@@ -7,10 +7,12 @@
 // See memmove Go doc for important implementation constraints.
 
 // func memmove(to, from unsafe.Pointer, n uintptr)
-TEXT runtime·memmove(SB), NOSPLIT|NOFRAME, $0-24
+TEXT runtime·memmove<ABIInternal>(SB), NOSPLIT|NOFRAME, $0-24
+#ifndef GOEXPERIMENT_regabiargs
        MOVV    to+0(FP), R4
        MOVV    from+8(FP), R5
        MOVV    n+16(FP), R6
+#endif
        BNE     R6, check
        RET