...

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

View as plain text