github.com/etecs-ru/ristretto@v0.9.1/z/simd/search_amd64.s (about)

     1  // Code generated by command: go run asm2.go -out search_amd64.s -stubs stub_search_amd64.go. DO NOT EDIT.
     2  
     3  #include "textflag.h"
     4  
     5  // func Search(xs []uint64, k uint64) int16
     6  TEXT ·Search(SB), NOSPLIT, $0-34
     7  	MOVQ xs_base+0(FP), AX
     8  	MOVQ xs_len+8(FP), CX
     9  	MOVQ k+24(FP), DX
    10  
    11  	// Save n
    12  	MOVQ CX, BX
    13  
    14  	// Initialize idx register to zero.
    15  	XORL BP, BP
    16  
    17  loop:
    18  	// Unroll1
    19  	CMPQ (AX)(BP*8), DX
    20  	JAE  Found
    21  
    22  	// Unroll2
    23  	CMPQ 16(AX)(BP*8), DX
    24  	JAE  Found2
    25  
    26  	// Unroll3
    27  	CMPQ 32(AX)(BP*8), DX
    28  	JAE  Found3
    29  
    30  	// Unroll4
    31  	CMPQ 48(AX)(BP*8), DX
    32  	JAE  Found4
    33  
    34  	// plus8
    35  	ADDQ $0x08, BP
    36  	CMPQ BP, CX
    37  	JB   loop
    38  	JMP  NotFound
    39  
    40  Found2:
    41  	ADDL $0x02, BP
    42  	JMP  Found
    43  
    44  Found3:
    45  	ADDL $0x04, BP
    46  	JMP  Found
    47  
    48  Found4:
    49  	ADDL $0x06, BP
    50  
    51  Found:
    52  	MOVL BP, BX
    53  
    54  NotFound:
    55  	MOVL BX, BP
    56  	SHRL $0x1f, BP
    57  	ADDL BX, BP
    58  	SHRL $0x01, BP
    59  	MOVL BP, ret+32(FP)
    60  	RET