-
Notifications
You must be signed in to change notification settings - Fork 89
/
find_odd_backslash_sequences_amd64.s
88 lines (71 loc) · 2.9 KB
/
find_odd_backslash_sequences_amd64.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
//+build !noasm !appengine gc
// AUTO-GENERATED BY C2GOASM -- DO NOT EDIT
DATA LCDATA1<>+0x000(SB)/8, $0x5c5c5c5c5c5c5c5c
DATA LCDATA1<>+0x008(SB)/8, $0x5c5c5c5c5c5c5c5c
DATA LCDATA1<>+0x010(SB)/8, $0x5c5c5c5c5c5c5c5c
DATA LCDATA1<>+0x018(SB)/8, $0x5c5c5c5c5c5c5c5c
GLOBL LCDATA1<>(SB), 8, $32
TEXT ·_find_odd_backslash_sequences(SB), $0-24
MOVQ p1+0(FP), DI
MOVQ p3+8(FP), DX
VMOVDQU (DI), Y8 // load low 32-bytes
VMOVDQU 0x20(DI), Y9 // load high 32-bytes
CALL ·__find_odd_backslash_sequences(SB)
VZEROUPPER
MOVQ AX, result+16(FP)
RET
TEXT ·__find_odd_backslash_sequences(SB), $0
LEAQ LCDATA1<>(SB), R8
VMOVDQA (R8), Y0 // vmovdqa ymm0, yword 0[rbp] /* [rip + LCPI0_0] */
VPCMPEQB Y8/*(DI)*/, Y0, Y1 // vpcmpeqb ymm1, ymm0, yword [rdi]
VPMOVMSKB Y1, CX // vpmovmskb ecx, ymm1
VPCMPEQB Y9/*(SI)*/, Y0, Y0 // vpcmpeqb ymm0, ymm0, yword [rsi]
VPMOVMSKB Y0, AX // vpmovmskb eax, ymm0
SHLQ $32, AX // shl rax, 32
ORQ CX, AX // or rax, rcx
#define FIND_ODD_BACKSLASH_SEQUENCES \
LEAQ (AX)(AX*1), CX \ // lea rcx, [rax + rax]
NOTQ CX \ // not rcx
ANDQ AX, CX \ // and rcx, rax
WORD $0x8b4c; BYTE $0x0a \ // mov r9, qword [rdx]
MOVQ $0x5555555555555555, R8 \ // mov r8, 6148914691236517205
MOVQ R9, SI \ // mov rsi, r9
XORQ R8, SI \ // xor rsi, r8
ANDQ CX, SI \ // and rsi, rcx
MOVQ $0xaaaaaaaaaaaaaaaa, R10 \ // mov r10, -6148914691236517206
MOVQ R9, DI \ // mov rdi, r9
XORQ R10, DI \ // xor rdi, r10
ANDQ CX, DI \ // and rdi, rcx
ADDQ AX, SI \ // add rsi, rax
XORL CX, CX \ // xor ecx, ecx
ADDQ AX, DI \ // add rdi, rax
SETCS CX \ // setb cl
ORQ R9, DI \ // or rdi, r9
MOVQ CX, (DX) \ // mov qword [rdx], rcx
NOTQ AX \ // not rax
ANDQ AX, R10 \ // and r10, rax
ANDQ SI, R10 \ // and r10, rsi
ANDQ R8, AX \ // and rax, r8
ANDQ DI, AX \ // and rax, rdi
ORQ R10, AX // or rax, r10
FIND_ODD_BACKSLASH_SEQUENCES
RET
#define OBSS_CONST Z16
TEXT ·_find_odd_backslash_sequences_avx512(SB), $0-24
MOVQ p1+0(FP), DI
MOVQ p3+8(FP), DX
VMOVDQU32 (DI), Z8
CALL ·__init_odd_backslash_sequences_avx512(SB)
CALL ·__find_odd_backslash_sequences_avx512(SB)
VZEROUPPER
MOVQ AX, result+16(FP)
RET
TEXT ·__init_odd_backslash_sequences_avx512(SB), $0
MOVQ $0x5c, AX
VPBROADCASTB AX, OBSS_CONST
RET
TEXT ·__find_odd_backslash_sequences_avx512(SB), $0
VPCMPEQB Z8, OBSS_CONST, K1
KMOVQ K1, AX
FIND_ODD_BACKSLASH_SEQUENCES
RET