Text file
src/runtime/memclr_loong64.s
1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 #include "go_asm.h"
6 #include "textflag.h"
7
8 // func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
9 TEXT runtime·memclrNoHeapPointers<ABIInternal>(SB),NOSPLIT,$0-16
10 #ifndef GOEXPERIMENT_regabiargs
11 MOVV ptr+0(FP), R4
12 MOVV n+8(FP), R5
13 #endif
14 ADDV R4, R5, R6
15
16 // if less than 8 bytes, do one byte at a time
17 SGTU $8, R5, R8
18 BNE R8, out
19
20 // do one byte at a time until 8-aligned
21 AND $7, R4, R8
22 BEQ R8, words
23 MOVB R0, (R4)
24 ADDV $1, R4
25 JMP -4(PC)
26
27 words:
28 // do 8 bytes at a time if there is room
29 ADDV $-7, R6, R5
30
31 PCALIGN $16
32 SGTU R5, R4, R8
33 BEQ R8, out
34 MOVV R0, (R4)
35 ADDV $8, R4
36 JMP -4(PC)
37
38 out:
39 BEQ R4, R6, done
40 MOVB R0, (R4)
41 ADDV $1, R4
42 JMP -3(PC)
43 done:
44 RET
45
View as plain text