Text file src/internal/bytealg/equal_riscv64.s

     1  // Copyright 2019 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  #define	CTXT	S4
     9  
    10  // func memequal(a, b unsafe.Pointer, size uintptr) bool
    11  TEXT runtime·memequal(SB),NOSPLIT|NOFRAME,$0-25
    12  	MOV	a+0(FP), A1
    13  	MOV	b+8(FP), A2
    14  	BEQ	A1, A2, eq
    15  	MOV	size+16(FP), A3
    16  	ADD	A1, A3, A4
    17  loop:
    18  	BEQ	A1, A4, eq
    19  
    20  	MOVBU	(A1), A6
    21  	ADD	$1, A1
    22  	MOVBU	(A2), A7
    23  	ADD	$1, A2
    24  	BEQ	A6, A7, loop
    25  
    26  	MOVB	ZERO, ret+24(FP)
    27  	RET
    28  eq:
    29  	MOV	$1, A1
    30  	MOVB	A1, ret+24(FP)
    31  	RET
    32  
    33  // func memequal_varlen(a, b unsafe.Pointer) bool
    34  TEXT runtime·memequal_varlen(SB),NOSPLIT,$40-17
    35  	MOV	a+0(FP), A1
    36  	MOV	b+8(FP), A2
    37  	BEQ	A1, A2, eq
    38  	MOV	8(CTXT), A3    // compiler stores size at offset 8 in the closure
    39  	MOV	A1, 8(X2)
    40  	MOV	A2, 16(X2)
    41  	MOV	A3, 24(X2)
    42  	CALL	runtime·memequal(SB)
    43  	MOVBU	32(X2), A1
    44  	MOVB	A1, ret+16(FP)
    45  	RET
    46  eq:
    47  	MOV	$1, A1
    48  	MOVB	A1, ret+16(FP)
    49  	RET
    50  

View as plain text