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 ADDV R4, R5, R6
11
12 // if less than 8 bytes, do one byte at a time
13 SGTU $8, R5, R8
14 BNE R8, out
15
16 // do one byte at a time until 8-aligned
17 AND $7, R4, R8
18 BEQ R8, words
19 MOVB R0, (R4)
20 ADDV $1, R4
21 JMP -4(PC)
22
23 words:
24 // do 8 bytes at a time if there is room
25 ADDV $-7, R6, R5
26
27 PCALIGN $16
28 SGTU R5, R4, R8
29 BEQ R8, out
30 MOVV R0, (R4)
31 ADDV $8, R4
32 JMP -4(PC)
33
34 out:
35 BEQ R4, R6, done
36 MOVB R0, (R4)
37 ADDV $1, R4
38 JMP -3(PC)
39 done:
40 RET
41
View as plain text