github.com/primecitizens/pcz/std@v0.2.1/core/mem/equal_mipsx.s (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // Copyright 2023 The Prime Citizens 3 // 4 // Copyright 2018 The Go Authors. All rights reserved. 5 // Use of this source code is governed by a BSD-style 6 // license that can be found in the LICENSE file. 7 8 //go:build pcz && (mips || mipsle) 9 10 #include "textflag.h" 11 12 #define REGCTXT R22 13 14 // Equal(a, b unsafe.Pointer, size uintptr) bool 15 TEXT ·Equal(SB),NOSPLIT,$0-13 16 MOVW a+0(FP), R1 17 MOVW b+4(FP), R2 18 BEQ R1, R2, eq 19 MOVW size+8(FP), R3 20 ADDU R1, R3, R4 21 loop: 22 BNE R1, R4, test 23 MOVW $1, R1 24 MOVB R1, ret+12(FP) 25 RET 26 test: 27 MOVBU (R1), R6 28 ADDU $1, R1 29 MOVBU (R2), R7 30 ADDU $1, R2 31 BEQ R6, R7, loop 32 33 MOVB R0, ret+12(FP) 34 RET 35 eq: 36 MOVW $1, R1 37 MOVB R1, ret+12(FP) 38 RET 39 40 // memequal_varlen(a, b unsafe.Pointer) bool 41 TEXT runtime·memequal_varlen(SB),NOSPLIT,$0-9 42 MOVW a+0(FP), R1 43 MOVW b+4(FP), R2 44 BEQ R1, R2, eq 45 MOVW 4(REGCTXT), R3 // compiler stores size at offset 4 in the closure 46 ADDU R1, R3, R4 47 loop: 48 BNE R1, R4, test 49 MOVW $1, R1 50 MOVB R1, ret+8(FP) 51 RET 52 test: 53 MOVBU (R1), R6 54 ADDU $1, R1 55 MOVBU (R2), R7 56 ADDU $1, R2 57 BEQ R6, R7, loop 58 59 MOVB R0, ret+8(FP) 60 RET 61 eq: 62 MOVW $1, R1 63 MOVB R1, ret+8(FP) 64 RET