Black Lives Matter. Support the Equal Justice Initiative.

Text file src/internal/bytealg/equal_mipsx.s

Documentation: internal/bytealg

     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  //go:build mips || mipsle
     6  // +build mips mipsle
     7  
     8  #include "go_asm.h"
     9  #include "textflag.h"
    10  
    11  #define	REGCTXT	R22
    12  
    13  // memequal(a, b unsafe.Pointer, size uintptr) bool
    14  TEXT runtime·memequal(SB),NOSPLIT,$0-13
    15  	MOVW	a+0(FP), R1
    16  	MOVW	b+4(FP), R2
    17  	BEQ	R1, R2, eq
    18  	MOVW	size+8(FP), R3
    19  	ADDU	R1, R3, R4
    20  loop:
    21  	BNE	R1, R4, test
    22  	MOVW	$1, R1
    23  	MOVB	R1, ret+12(FP)
    24  	RET
    25  test:
    26  	MOVBU	(R1), R6
    27  	ADDU	$1, R1
    28  	MOVBU	(R2), R7
    29  	ADDU	$1, R2
    30  	BEQ	R6, R7, loop
    31  
    32  	MOVB	R0, ret+12(FP)
    33  	RET
    34  eq:
    35  	MOVW	$1, R1
    36  	MOVB	R1, ret+12(FP)
    37  	RET
    38  
    39  // memequal_varlen(a, b unsafe.Pointer) bool
    40  TEXT runtime·memequal_varlen(SB),NOSPLIT,$0-9
    41  	MOVW	a+0(FP), R1
    42  	MOVW	b+4(FP), R2
    43  	BEQ	R1, R2, eq
    44  	MOVW	4(REGCTXT), R3	// compiler stores size at offset 4 in the closure
    45  	ADDU	R1, R3, R4
    46  loop:
    47  	BNE	R1, R4, test
    48  	MOVW	$1, R1
    49  	MOVB	R1, ret+8(FP)
    50  	RET
    51  test:
    52  	MOVBU	(R1), R6
    53  	ADDU	$1, R1
    54  	MOVBU	(R2), R7
    55  	ADDU	$1, R2
    56  	BEQ	R6, R7, loop
    57  
    58  	MOVB	R0, ret+8(FP)
    59  	RET
    60  eq:
    61  	MOVW	$1, R1
    62  	MOVB	R1, ret+8(FP)
    63  	RET
    64  

View as plain text