...

Text file src/internal/bytealg/equal_loong64.s

Documentation: internal/bytealg

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

View as plain text