Black Lives Matter. Support the Equal Justice Initiative.

Text file src/internal/bytealg/indexbyte_mips64x.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 mips64 || mips64le
     6  // +build mips64 mips64le
     7  
     8  #include "go_asm.h"
     9  #include "textflag.h"
    10  
    11  TEXT ·IndexByte(SB),NOSPLIT,$0-40
    12  	MOVV	b_base+0(FP), R1
    13  	MOVV	b_len+8(FP), R2
    14  	MOVBU	c+24(FP), R3	// byte to find
    15  	MOVV	R1, R4		// store base for later
    16  	ADDV	R1, R2		// end
    17  	ADDV	$-1, R1
    18  
    19  loop:
    20  	ADDV	$1, R1
    21  	BEQ	R1, R2, notfound
    22  	MOVBU	(R1), R5
    23  	BNE	R3, R5, loop
    24  
    25  	SUBV	R4, R1		// remove base
    26  	MOVV	R1, ret+32(FP)
    27  	RET
    28  
    29  notfound:
    30  	MOVV	$-1, R1
    31  	MOVV	R1, ret+32(FP)
    32  	RET
    33  
    34  TEXT ·IndexByteString(SB),NOSPLIT,$0-32
    35  	MOVV	s_base+0(FP), R1
    36  	MOVV	s_len+8(FP), R2
    37  	MOVBU	c+16(FP), R3	// byte to find
    38  	MOVV	R1, R4		// store base for later
    39  	ADDV	R1, R2		// end
    40  	ADDV	$-1, R1
    41  
    42  loop:
    43  	ADDV	$1, R1
    44  	BEQ	R1, R2, notfound
    45  	MOVBU	(R1), R5
    46  	BNE	R3, R5, loop
    47  
    48  	SUBV	R4, R1		// remove base
    49  	MOVV	R1, ret+24(FP)
    50  	RET
    51  
    52  notfound:
    53  	MOVV	$-1, R1
    54  	MOVV	R1, ret+24(FP)
    55  	RET
    56  

View as plain text