github.com/icodeface/tls@v0.0.0-20230910023335-34df9250cd12/internal/bytealg/equal_wasm.s (about) 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 #include "go_asm.h" 6 #include "textflag.h" 7 8 TEXT ·Equal(SB), NOSPLIT, $0-49 9 MOVD a_len+8(FP), R0 10 MOVD b_len+32(FP), R1 11 Get R0 12 Get R1 13 I64Eq 14 If 15 Get SP 16 I64Load a+0(FP) 17 I64Load b+24(FP) 18 Get R0 19 Call memeqbody<>(SB) 20 I64Store8 ret+48(FP) 21 Else 22 Get SP 23 I64Const $0 24 I64Store8 ret+48(FP) 25 End 26 RET 27 28 // memequal(p, q unsafe.Pointer, size uintptr) bool 29 TEXT runtime·memequal(SB), NOSPLIT, $0-25 30 Get SP 31 I64Load a+0(FP) 32 I64Load b+8(FP) 33 I64Load size+16(FP) 34 Call memeqbody<>(SB) 35 I64Store8 ret+24(FP) 36 RET 37 38 // memequal_varlen(a, b unsafe.Pointer) bool 39 TEXT runtime·memequal_varlen(SB), NOSPLIT, $0-17 40 Get SP 41 I64Load a+0(FP) 42 I64Load b+8(FP) 43 I64Load 8(CTXT) // compiler stores size at offset 8 in the closure 44 Call memeqbody<>(SB) 45 I64Store8 ret+16(FP) 46 RET 47 48 // params: a, b, len 49 // ret: 0/1 50 TEXT memeqbody<>(SB), NOSPLIT, $0-0 51 Get R0 52 Get R1 53 I64Eq 54 If 55 I64Const $1 56 Return 57 End 58 59 loop: 60 Loop 61 Get R2 62 I64Eqz 63 If 64 I64Const $1 65 Return 66 End 67 68 Get R0 69 I32WrapI64 70 I64Load8U $0 71 Get R1 72 I32WrapI64 73 I64Load8U $0 74 I64Ne 75 If 76 I64Const $0 77 Return 78 End 79 80 Get R0 81 I64Const $1 82 I64Add 83 Set R0 84 85 Get R1 86 I64Const $1 87 I64Add 88 Set R1 89 90 Get R2 91 I64Const $1 92 I64Sub 93 Set R2 94 95 Br loop 96 End 97 UNDEF