Text file src/internal/bytealg/equal_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  #define	REGCTXT	R29
     9  
    10  // memequal(a, b unsafe.Pointer, size uintptr) bool
    11  TEXT runtime·memequal(SB),NOSPLIT|NOFRAME,$0-25
    12  	MOVV	a+0(FP), R4
    13  	MOVV	b+8(FP), R5
    14  	BEQ	R4, R5, eq
    15  	MOVV	size+16(FP), R6
    16  	ADDV	R4, R6, R7
    17  loop:
    18  	BNE	R4, R7, test
    19  	MOVV	$1, R4
    20  	MOVB	R4, ret+24(FP)
    21  	RET
    22  test:
    23  	MOVBU	(R4), R9
    24  	ADDV	$1, R4
    25  	MOVBU	(R5), R10
    26  	ADDV	$1, R5
    27  	BEQ	R9, R10, loop
    28  
    29  	MOVB	R0, ret+24(FP)
    30  	RET
    31  eq:
    32  	MOVV	$1, R4
    33  	MOVB	R4, ret+24(FP)
    34  	RET
    35  
    36  // memequal_varlen(a, b unsafe.Pointer) bool
    37  TEXT runtime·memequal_varlen(SB),NOSPLIT,$40-17
    38  	MOVV	a+0(FP), R4
    39  	MOVV	b+8(FP), R5
    40  	BEQ	R4, R5, eq
    41  	MOVV	8(REGCTXT), R6    // compiler stores size at offset 8 in the closure
    42  	MOVV	R4, 8(R3)
    43  	MOVV	R5, 16(R3)
    44  	MOVV	R6, 24(R3)
    45  	JAL	runtime·memequal(SB)
    46  	MOVBU	32(R3), R4
    47  	MOVB	R4, ret+16(FP)
    48  	RET
    49  eq:
    50  	MOVV	$1, R4
    51  	MOVB	R4, ret+16(FP)
    52  	RET
    53  

View as plain text