github.com/x04/go/src@v0.0.0-20200202162449-3d481ceb3525/runtime/memclr_riscv64.s (about) 1 // Copyright 2016 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 "textflag.h" 6 7 // void runtime·memclrNoHeapPointers(void*, uintptr) 8 TEXT runtime·memclrNoHeapPointers(SB),NOSPLIT,$0-16 9 MOV ptr+0(FP), T1 10 MOV n+8(FP), T2 11 ADD T1, T2, T4 12 13 // If less than eight bytes, do one byte at a time. 14 SLTU $8, T2, T3 15 BNE T3, ZERO, outcheck 16 17 // Do one byte at a time until eight-aligned. 18 JMP aligncheck 19 align: 20 MOVB ZERO, (T1) 21 ADD $1, T1 22 aligncheck: 23 AND $7, T1, T3 24 BNE T3, ZERO, align 25 26 // Do eight bytes at a time as long as there is room. 27 ADD $-7, T4, T5 28 JMP wordscheck 29 words: 30 MOV ZERO, (T1) 31 ADD $8, T1 32 wordscheck: 33 SLTU T5, T1, T3 34 BNE T3, ZERO, words 35 36 JMP outcheck 37 out: 38 MOVB ZERO, (T1) 39 ADD $1, T1 40 outcheck: 41 BNE T1, T4, out 42 43 done: 44 RET