$14 GRAYBYTE WORDPRESS FILE MANAGER $71

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

/lib/golang/src/internal/bytealg/

HOME
Current File : /lib/golang/src/internal/bytealg//indexbyte_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.

//go:build !plan9

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

TEXT	·IndexByte(SB), NOSPLIT, $0-40
	MOVQ b_base+0(FP), SI
	MOVQ b_len+8(FP), BX
	MOVB c+24(FP), AL
	LEAQ ret+32(FP), R8
	JMP  indexbytebody<>(SB)

TEXT	·IndexByteString(SB), NOSPLIT, $0-32
	MOVQ s_base+0(FP), SI
	MOVQ s_len+8(FP), BX
	MOVB c+16(FP), AL
	LEAQ ret+24(FP), R8
	JMP  indexbytebody<>(SB)

// input:
//   SI: data
//   BX: data len
//   AL: byte sought
//   R8: address to put result
TEXT	indexbytebody<>(SB), NOSPLIT, $0
	// Shuffle X0 around so that each byte contains
	// the character we're looking for.
	MOVD AX, X0
	PUNPCKLBW X0, X0
	PUNPCKLBW X0, X0
	PSHUFL $0, X0, X0

	CMPQ BX, $16
	JLT small

	MOVQ SI, DI

	CMPQ BX, $32
	JA avx2
sse:
	LEAQ	-16(SI)(BX*1), AX	// AX = address of last 16 bytes
	JMP	sseloopentry

	PCALIGN $16
sseloop:
	// Move the next 16-byte chunk of the data into X1.
	MOVOU	(DI), X1
	// Compare bytes in X0 to X1.
	PCMPEQB	X0, X1
	// Take the top bit of each byte in X1 and put the result in DX.
	PMOVMSKB X1, DX
	// Find first set bit, if any.
	BSFL	DX, DX
	JNZ	ssesuccess
	// Advance to next block.
	ADDQ	$16, DI
sseloopentry:
	CMPQ	DI, AX
	JB	sseloop

	// Search the last 16-byte chunk. This chunk may overlap with the
	// chunks we've already searched, but that's ok.
	MOVQ	AX, DI
	MOVOU	(AX), X1
	PCMPEQB	X0, X1
	PMOVMSKB X1, DX
	BSFL	DX, DX
	JNZ	ssesuccess

failure:
	MOVQ $-1, (R8)
	RET

// We've found a chunk containing the byte.
// The chunk was loaded from DI.
// The index of the matching byte in the chunk is DX.
// The start of the data is SI.
ssesuccess:
	SUBQ SI, DI	// Compute offset of chunk within data.
	ADDQ DX, DI	// Add offset of byte within chunk.
	MOVQ DI, (R8)
	RET

// handle for lengths < 16
small:
	TESTQ	BX, BX
	JEQ	failure

	// Check if we'll load across a page boundary.
	LEAQ	16(SI), AX
	TESTW	$0xff0, AX
	JEQ	endofpage

	MOVOU	(SI), X1 // Load data
	PCMPEQB	X0, X1	// Compare target byte with each byte in data.
	PMOVMSKB X1, DX	// Move result bits to integer register.
	BSFL	DX, DX	// Find first set bit.
	JZ	failure	// No set bit, failure.
	CMPL	DX, BX
	JAE	failure	// Match is past end of data.
	MOVQ	DX, (R8)
	RET

endofpage:
	MOVOU	-16(SI)(BX*1), X1	// Load data into the high end of X1.
	PCMPEQB	X0, X1	// Compare target byte with each byte in data.
	PMOVMSKB X1, DX	// Move result bits to integer register.
	MOVL	BX, CX
	SHLL	CX, DX
	SHRL	$16, DX	// Shift desired bits down to bottom of register.
	BSFL	DX, DX	// Find first set bit.
	JZ	failure	// No set bit, failure.
	MOVQ	DX, (R8)
	RET

avx2:
#ifndef hasAVX2
	CMPB   internal∕cpu·X86+const_offsetX86HasAVX2(SB), $1
	JNE sse
#endif
	MOVD AX, X0
	LEAQ -32(SI)(BX*1), R11
	VPBROADCASTB  X0, Y1

	PCALIGN $32
avx2_loop:
	VMOVDQU (DI), Y2
	VPCMPEQB Y1, Y2, Y3
	VPTEST Y3, Y3
	JNZ avx2success
	ADDQ $32, DI
	CMPQ DI, R11
	JLT avx2_loop
	MOVQ R11, DI
	VMOVDQU (DI), Y2
	VPCMPEQB Y1, Y2, Y3
	VPTEST Y3, Y3
	JNZ avx2success
	VZEROUPPER
	MOVQ $-1, (R8)
	RET

avx2success:
	VPMOVMSKB Y3, DX
	BSFL DX, DX
	SUBQ SI, DI
	ADDQ DI, DX
	MOVQ DX, (R8)
	VZEROUPPER
	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