github.com/dgraph-io/simdjson-go@v0.3.0/find_newline_delimiters_amd64.s (about)

     1  //+build !noasm !appengine gc
     2  
     3  // _find_newline_delimiters(raw []byte) (mask uint64)
     4  TEXT ·_find_newline_delimiters(SB), 7, $0
     5  	MOVQ    raw+0(FP), SI        // SI: &raw
     6  	MOVQ    quoteMask+24(FP), DX // get quotemask
     7  	VMOVDQU (SI), Y8             // load low 32-bytes
     8  	VMOVDQU 0x20(SI), Y9         // load high 32-bytes
     9  
    10  	CALL ·__find_newline_delimiters(SB)
    11  
    12  	MOVQ BX, mask+32(FP) // store result
    13  	VZEROUPPER
    14  	RET
    15  
    16  TEXT ·__find_newline_delimiters(SB), 7, $0
    17  	MOVQ         $0x0a, BX // get newline
    18  	MOVQ         BX, X11
    19  	VPBROADCASTB X11, Y11
    20  
    21  	VPCMPEQB  Y8, Y11, Y10
    22  	VPCMPEQB  Y9, Y11, Y11
    23  	VPMOVMSKB Y10, BX
    24  	VPMOVMSKB Y11, CX
    25  	SHLQ      $32, CX
    26  	ORQ       CX, BX       // BX is resulting mask of newline chars
    27  	ANDNQ     BX, DX, BX   // clear out newline delimiters enclosed in quotes
    28  	RET
    29  
    30  // _find_newline_delimiters_avx512(raw []byte) (mask uint64)
    31  TEXT ·_find_newline_delimiters_avx512(SB), 7, $0
    32  	MOVQ      raw+0(FP), SI        // SI: &raw
    33  	MOVQ      quoteMask+24(FP), DX // get quotemask
    34  	VMOVDQU32 (SI), Z8             // load 64 bytes
    35  
    36  	CALL ·__init_newline_delimiters_avx512(SB)
    37  	CALL ·__find_newline_delimiters_avx512(SB)
    38  
    39  	MOVQ BX, mask+32(FP) // store result
    40  	VZEROUPPER
    41  	RET
    42  
    43  #define NLD_CONST Z26
    44  
    45  TEXT ·__init_newline_delimiters_avx512(SB), 7, $0
    46  	MOVQ         $0x0a, BX     // get newline
    47  	VPBROADCASTB BX, NLD_CONST
    48  	RET
    49  
    50  TEXT ·__find_newline_delimiters_avx512(SB), 7, $0
    51  	VPCMPEQB Z8, NLD_CONST, K1
    52  	KMOVQ    K1, BX
    53  	ANDNQ    BX, DX, BX        // clear out newline delimiters enclosed in quotes
    54  	RET