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 ·IndexByte(SB), NOSPLIT, $0-20
9 I64Load32U b_base+0(FP)
10 I32WrapI64
11 I32Load8U c+12(FP)
12 I64Load32U b_len+4(FP)
13 I32WrapI64
14 Call memchr<>(SB)
15 I64ExtendI32U
16 Set R0
17
18 Get SP
19 I64Const $-1
20 Get R0
21 I64Load32U b_base+0(FP)
22 I64Sub
23 Get R0
24 I64Eqz $0
25 Select
26 I64Store32 ret+16(FP)
27
28 RET
29
30 TEXT ·IndexByteString(SB), NOSPLIT, $0-16
31 Get SP
32 I64Load32U s_base+0(FP)
33 I32WrapI64
34 I32Load8U c+8(FP)
35 I64Load32U s_len+4(FP)
36 I32WrapI64
37 Call memchr<>(SB)
38 I64ExtendI32U
39 Set R0
40
41 I64Const $-1
42 Get R0
43 I64Load32U s_base+0(FP)
44 I64Sub
45 Get R0
46 I64Eqz $0
47 Select
48 I64Store32 ret+12(FP)
49
50 RET
51
52 #include "indexbyte_wasmx.h"
53
View as plain text