...

Text file src/internal/bytealg/count_mips64x.s

Documentation: internal/bytealg

     1// Copyright 2025 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
     7#include "go_asm.h"
     8#include "textflag.h"
     9
    10TEXT ·Count(SB),NOSPLIT,$0-40
    11	// R1 = b_base
    12	// R2 = b_len
    13	// R3 = byte to count
    14	MOVV	b_base+0(FP), R1
    15	MOVV	b_len+8(FP), R2
    16	MOVBU	c+24(FP), R3
    17	MOVV	R0, R5	// count
    18	ADDV	R1, R2	// end
    19
    20loop:
    21	BEQ	R1, R2, done
    22	MOVBU	(R1), R6
    23	ADDV	$1, R1
    24	BNE	R3, R6, loop
    25	ADDV	$1, R5
    26	JMP	loop
    27
    28done:
    29	MOVV	R5, ret+32(FP)
    30	RET
    31
    32TEXT ·CountString(SB),NOSPLIT,$0-32
    33	// R1 = s_base
    34	// R2 = s_len
    35	// R3 = byte to count
    36	MOVV	s_base+0(FP), R1
    37	MOVV	s_len+8(FP), R2
    38	MOVBU	c+16(FP), R3
    39	MOVV	R0, R5	// count
    40	ADDV	R1, R2	// end
    41
    42loop:
    43	BEQ	R1, R2, done
    44	MOVBU	(R1), R6
    45	ADDV	$1, R1
    46	BNE	R3, R6, loop
    47	ADDV	$1, R5
    48	JMP	loop
    49
    50done:
    51	MOVV	R5, ret+24(FP)
    52	RET

View as plain text