$30 GRAYBYTE WORDPRESS FILE MANAGER $15

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/usr/lib/golang/src/internal/bytealg/

HOME
Current File : /usr/lib/golang/src/internal/bytealg//index_amd64.s
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include "go_asm.h"
#include "textflag.h"

TEXT ·Index(SB),NOSPLIT,$0-56
	MOVQ a_base+0(FP), DI
	MOVQ a_len+8(FP), DX
	MOVQ b_base+24(FP), R8
	MOVQ b_len+32(FP), AX
	MOVQ DI, R10
	LEAQ ret+48(FP), R11
	JMP  indexbody<>(SB)

TEXT ·IndexString(SB),NOSPLIT,$0-40
	MOVQ a_base+0(FP), DI
	MOVQ a_len+8(FP), DX
	MOVQ b_base+16(FP), R8
	MOVQ b_len+24(FP), AX
	MOVQ DI, R10
	LEAQ ret+32(FP), R11
	JMP  indexbody<>(SB)

// AX: length of string, that we are searching for
// DX: length of string, in which we are searching
// DI: pointer to string, in which we are searching
// R8: pointer to string, that we are searching for
// R11: address, where to put return value
// Note: We want len in DX and AX, because PCMPESTRI implicitly consumes them
TEXT indexbody<>(SB),NOSPLIT,$0
	CMPQ AX, DX
	JA fail
	CMPQ DX, $16
	JAE sse42
no_sse42:
	CMPQ AX, $2
	JA   _3_or_more
	MOVW (R8), R8
	LEAQ -1(DI)(DX*1), DX
	PCALIGN $16
loop2:
	MOVW (DI), SI
	CMPW SI,R8
	JZ success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop2
	JMP fail
_3_or_more:
	CMPQ AX, $3
	JA   _4_or_more
	MOVW 1(R8), BX
	MOVW (R8), R8
	LEAQ -2(DI)(DX*1), DX
loop3:
	MOVW (DI), SI
	CMPW SI,R8
	JZ   partial_success3
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop3
	JMP fail
partial_success3:
	MOVW 1(DI), SI
	CMPW SI,BX
	JZ success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop3
	JMP fail
_4_or_more:
	CMPQ AX, $4
	JA   _5_or_more
	MOVL (R8), R8
	LEAQ -3(DI)(DX*1), DX
loop4:
	MOVL (DI), SI
	CMPL SI,R8
	JZ   success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop4
	JMP fail
_5_or_more:
	CMPQ AX, $7
	JA   _8_or_more
	LEAQ 1(DI)(DX*1), DX
	SUBQ AX, DX
	MOVL -4(R8)(AX*1), BX
	MOVL (R8), R8
loop5to7:
	MOVL (DI), SI
	CMPL SI,R8
	JZ   partial_success5to7
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop5to7
	JMP fail
partial_success5to7:
	MOVL -4(AX)(DI*1), SI
	CMPL SI,BX
	JZ success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop5to7
	JMP fail
_8_or_more:
	CMPQ AX, $8
	JA   _9_or_more
	MOVQ (R8), R8
	LEAQ -7(DI)(DX*1), DX
loop8:
	MOVQ (DI), SI
	CMPQ SI,R8
	JZ   success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop8
	JMP fail
_9_or_more:
	CMPQ AX, $15
	JA   _16_or_more
	LEAQ 1(DI)(DX*1), DX
	SUBQ AX, DX
	MOVQ -8(R8)(AX*1), BX
	MOVQ (R8), R8
loop9to15:
	MOVQ (DI), SI
	CMPQ SI,R8
	JZ   partial_success9to15
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop9to15
	JMP fail
partial_success9to15:
	MOVQ -8(AX)(DI*1), SI
	CMPQ SI,BX
	JZ success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop9to15
	JMP fail
_16_or_more:
	CMPQ AX, $16
	JA   _17_or_more
	MOVOU (R8), X1
	LEAQ -15(DI)(DX*1), DX
loop16:
	MOVOU (DI), X2
	PCMPEQB X1, X2
	PMOVMSKB X2, SI
	CMPQ  SI, $0xffff
	JE   success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop16
	JMP fail
_17_or_more:
	CMPQ AX, $31
	JA   _32_or_more
	LEAQ 1(DI)(DX*1), DX
	SUBQ AX, DX
	MOVOU -16(R8)(AX*1), X0
	MOVOU (R8), X1
loop17to31:
	MOVOU (DI), X2
	PCMPEQB X1,X2
	PMOVMSKB X2, SI
	CMPQ  SI, $0xffff
	JE   partial_success17to31
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop17to31
	JMP fail
partial_success17to31:
	MOVOU -16(AX)(DI*1), X3
	PCMPEQB X0, X3
	PMOVMSKB X3, SI
	CMPQ  SI, $0xffff
	JE success
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop17to31
	JMP fail
// We can get here only when AVX2 is enabled and cutoff for indexShortStr is set to 63
// So no need to check cpuid
_32_or_more:
	CMPQ AX, $32
	JA   _33_to_63
	VMOVDQU (R8), Y1
	LEAQ -31(DI)(DX*1), DX
loop32:
	VMOVDQU (DI), Y2
	VPCMPEQB Y1, Y2, Y3
	VPMOVMSKB Y3, SI
	CMPL  SI, $0xffffffff
	JE   success_avx2
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop32
	JMP fail_avx2
_33_to_63:
	LEAQ 1(DI)(DX*1), DX
	SUBQ AX, DX
	VMOVDQU -32(R8)(AX*1), Y0
	VMOVDQU (R8), Y1
loop33to63:
	VMOVDQU (DI), Y2
	VPCMPEQB Y1, Y2, Y3
	VPMOVMSKB Y3, SI
	CMPL  SI, $0xffffffff
	JE   partial_success33to63
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop33to63
	JMP fail_avx2
partial_success33to63:
	VMOVDQU -32(AX)(DI*1), Y3
	VPCMPEQB Y0, Y3, Y4
	VPMOVMSKB Y4, SI
	CMPL  SI, $0xffffffff
	JE success_avx2
	ADDQ $1,DI
	CMPQ DI,DX
	JB loop33to63
fail_avx2:
	VZEROUPPER
fail:
	MOVQ $-1, (R11)
	RET
success_avx2:
	VZEROUPPER
	JMP success
sse42:
#ifndef hasSSE42
	CMPB internal∕cpu·X86+const_offsetX86HasSSE42(SB), $1
	JNE no_sse42
#endif
	CMPQ AX, $12
	// PCMPESTRI is slower than normal compare,
	// so using it makes sense only if we advance 4+ bytes per compare
	// This value was determined experimentally and is the ~same
	// on Nehalem (first with SSE42) and Haswell.
	JAE _9_or_more
	LEAQ 16(R8), SI
	TESTW $0xff0, SI
	JEQ no_sse42
	MOVOU (R8), X1
	LEAQ -15(DI)(DX*1), SI
	MOVQ $16, R9
	SUBQ AX, R9 // We advance by 16-len(sep) each iteration, so precalculate it into R9
	PCALIGN $16
loop_sse42:
	// 0x0c means: unsigned byte compare (bits 0,1 are 00)
	// for equality (bits 2,3 are 11)
	// result is not masked or inverted (bits 4,5 are 00)
	// and corresponds to first matching byte (bit 6 is 0)
	PCMPESTRI $0x0c, (DI), X1
	// CX == 16 means no match,
	// CX > R9 means partial match at the end of the string,
	// otherwise sep is at offset CX from X1 start
	CMPQ CX, R9
	JBE sse42_success
	ADDQ R9, DI
	CMPQ DI, SI
	JB loop_sse42
	PCMPESTRI $0x0c, -1(SI), X1
	CMPQ CX, R9
	JA fail
	LEAQ -1(SI), DI
sse42_success:
	ADDQ CX, DI
success:
	SUBQ R10, DI
	MOVQ DI, (R11)
	RET

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
16 Dec 2025 9.30 PM
root / root
0755
bytealg.go
3.186 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_386.s
2.628 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_amd64.s
4.295 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_arm.s
1.753 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_arm64.s
2.129 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_generic.go
1.49 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_loong64.s
5.86 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_mips64x.s
1.662 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_mipsx.s
1.393 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_native.go
0.709 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_ppc64x.s
6.686 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_riscv64.s
3.778 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_s390x.s
1.186 KB
4 Dec 2025 6.06 PM
root / root
0644
compare_wasm.s
1.436 KB
4 Dec 2025 6.06 PM
root / root
0644
count_amd64.s
4.673 KB
4 Dec 2025 6.06 PM
root / root
0644
count_arm.s
0.896 KB
4 Dec 2025 6.06 PM
root / root
0644
count_arm64.s
2.088 KB
4 Dec 2025 6.06 PM
root / root
0644
count_generic.go
0.512 KB
4 Dec 2025 6.06 PM
root / root
0644
count_loong64.s
4.01 KB
4 Dec 2025 6.06 PM
root / root
0644
count_mips64x.s
0.86 KB
4 Dec 2025 6.06 PM
root / root
0644
count_native.go
0.66 KB
4 Dec 2025 6.06 PM
root / root
0644
count_ppc64x.s
3.636 KB
4 Dec 2025 6.06 PM
root / root
0644
count_riscv64.s
0.685 KB
4 Dec 2025 6.06 PM
root / root
0644
count_s390x.s
5.385 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_386.s
2.129 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_amd64.s
2.775 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_arm.s
1.814 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_arm64.s
2.413 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_generic.go
0.613 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_loong64.s
4.726 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_mips64x.s
1.995 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_mipsx.s
1.069 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_native.go
0.771 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_ppc64x.s
4.873 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_riscv64.s
2.274 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_s390x.s
1.767 KB
4 Dec 2025 6.06 PM
root / root
0644
equal_wasm.s
1.099 KB
4 Dec 2025 6.06 PM
root / root
0644
index_amd64.go
0.603 KB
4 Dec 2025 6.06 PM
root / root
0644
index_amd64.s
5.053 KB
4 Dec 2025 6.06 PM
root / root
0644
index_arm64.go
0.689 KB
4 Dec 2025 6.06 PM
root / root
0644
index_arm64.s
3.96 KB
4 Dec 2025 6.06 PM
root / root
0644
index_generic.go
0.88 KB
4 Dec 2025 6.06 PM
root / root
0644
index_native.go
0.576 KB
4 Dec 2025 6.06 PM
root / root
0644
index_ppc64x.go
0.622 KB
4 Dec 2025 6.06 PM
root / root
0644
index_ppc64x.s
31.564 KB
4 Dec 2025 6.06 PM
root / root
0644
index_s390x.go
0.987 KB
4 Dec 2025 6.06 PM
root / root
0644
index_s390x.s
5.496 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_386.s
0.632 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_amd64.s
3.138 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_arm.s
0.929 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_arm64.s
3.313 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_generic.go
0.758 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_loong64.s
4.135 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_mips64x.s
0.962 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_mipsx.s
0.988 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_native.go
0.428 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_ppc64x.s
6.267 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_riscv64.s
2.786 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_s390x.s
2.489 KB
4 Dec 2025 6.06 PM
root / root
0644
indexbyte_wasm.s
2.539 KB
4 Dec 2025 6.06 PM
root / root
0644
lastindexbyte_generic.go
0.43 KB
4 Dec 2025 6.06 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF