github.com/icodeface/tls@v0.0.0-20230910023335-34df9250cd12/internal/bytealg/equal_mips64x.s (about)

     1  // Copyright 2018 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  // +build mips64 mips64le
     6  
     7  #include "go_asm.h"
     8  #include "textflag.h"
     9  
    10  #define	REGCTXT	R22
    11  
    12  TEXT ·Equal(SB),NOSPLIT,$0-49
    13  	MOVV	a_len+8(FP), R3
    14  	MOVV	b_len+32(FP), R4
    15  	BNE	R3, R4, noteq		// unequal lengths are not equal
    16  
    17  	MOVV	a_base+0(FP), R1
    18  	MOVV	b_base+24(FP), R2
    19  	ADDV	R1, R3		// end
    20  
    21  loop:
    22  	BEQ	R1, R3, equal		// reached the end
    23  	MOVBU	(R1), R6
    24  	ADDV	$1, R1
    25  	MOVBU	(R2), R7
    26  	ADDV	$1, R2
    27  	BEQ	R6, R7, loop
    28  
    29  noteq:
    30  	MOVB	R0, ret+48(FP)
    31  	RET
    32  
    33  equal:
    34  	MOVV	$1, R1
    35  	MOVB	R1, ret+48(FP)
    36  	RET
    37  
    38  // memequal(a, b unsafe.Pointer, size uintptr) bool
    39  TEXT runtime·memequal(SB),NOSPLIT|NOFRAME,$0-25
    40  	MOVV	a+0(FP), R1
    41  	MOVV	b+8(FP), R2
    42  	BEQ	R1, R2, eq
    43  	MOVV	size+16(FP), R3
    44  	ADDV	R1, R3, R4
    45  loop:
    46  	BNE	R1, R4, test
    47  	MOVV	$1, R1
    48  	MOVB	R1, ret+24(FP)
    49  	RET
    50  test:
    51  	MOVBU	(R1), R6
    52  	ADDV	$1, R1
    53  	MOVBU	(R2), R7
    54  	ADDV	$1, R2
    55  	BEQ	R6, R7, loop
    56  
    57  	MOVB	R0, ret+24(FP)
    58  	RET
    59  eq:
    60  	MOVV	$1, R1
    61  	MOVB	R1, ret+24(FP)
    62  	RET
    63  
    64  // memequal_varlen(a, b unsafe.Pointer) bool
    65  TEXT runtime·memequal_varlen(SB),NOSPLIT,$40-17
    66  	MOVV	a+0(FP), R1
    67  	MOVV	b+8(FP), R2
    68  	BEQ	R1, R2, eq
    69  	MOVV	8(REGCTXT), R3    // compiler stores size at offset 8 in the closure
    70  	MOVV	R1, 8(R29)
    71  	MOVV	R2, 16(R29)
    72  	MOVV	R3, 24(R29)
    73  	JAL	runtime·memequal(SB)
    74  	MOVBU	32(R29), R1
    75  	MOVB	R1, ret+16(FP)
    76  	RET
    77  eq:
    78  	MOVV	$1, R1
    79  	MOVB	R1, ret+16(FP)
    80  	RET