-
Notifications
You must be signed in to change notification settings - Fork 6
/
sip13_amd64.s
323 lines (301 loc) · 4.63 KB
/
sip13_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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// Code generated by command: go run asm.go -out sip13_amd64.s. DO NOT EDIT.
// +build !noasm
#include "textflag.h"
// func Sum64(k0 uint64, k1 uint64, p []byte) uint64
TEXT ·Sum64(SB), NOSPLIT, $0-48
MOVQ k0+0(FP), AX
MOVQ AX, DX
MOVQ k1+8(FP), CX
MOVQ CX, BX
MOVQ $0x736f6d6570736575, BP
XORQ BP, AX
MOVQ $0x646f72616e646f6d, BP
XORQ BP, CX
MOVQ $0x6c7967656e657261, BP
XORQ BP, DX
MOVQ $0x7465646279746573, BP
XORQ BP, BX
MOVQ p_base+16(FP), BP
MOVQ p_len+24(FP), SI
MOVQ SI, DI
SHLQ $0x38, DI
CMPQ SI, $0x08
JL loop_end
loop_begin:
MOVQ (BP), R8
XORQ R8, BX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ R8, AX
ADDQ $0x08, BP
SUBQ $0x08, SI
CMPQ SI, $0x08
JGE loop_begin
loop_end:
CMPQ SI, $0x00
JE sw0
CMPQ SI, $0x01
JE sw1
CMPQ SI, $0x02
JE sw2
CMPQ SI, $0x03
JE sw3
CMPQ SI, $0x04
JE sw4
CMPQ SI, $0x05
JE sw5
CMPQ SI, $0x06
JE sw6
MOVBQZX 6(BP), SI
SHLQ $0x30, SI
ORQ SI, DI
sw6:
MOVBQZX 5(BP), SI
SHLQ $0x28, SI
ORQ SI, DI
sw5:
MOVBQZX 4(BP), SI
SHLQ $0x20, SI
ORQ SI, DI
sw4:
MOVBQZX 3(BP), SI
SHLQ $0x18, SI
ORQ SI, DI
sw3:
MOVBQZX 2(BP), SI
SHLQ $0x10, SI
ORQ SI, DI
sw2:
MOVBQZX 1(BP), SI
SHLQ $0x08, SI
ORQ SI, DI
sw1:
MOVBQZX (BP), SI
SHLQ $0x00, SI
ORQ SI, DI
sw0:
XORQ DI, BX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ DI, AX
XORQ $0xff, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ CX, AX
XORQ BX, DX
XORQ DX, AX
MOVQ AX, ret+40(FP)
RET
// func Sum64Str(k0 uint64, k1 uint64, p string) uint64
TEXT ·Sum64Str(SB), NOSPLIT, $0-40
MOVQ k0+0(FP), AX
MOVQ AX, DX
MOVQ k1+8(FP), CX
MOVQ CX, BX
MOVQ $0x736f6d6570736575, BP
XORQ BP, AX
MOVQ $0x646f72616e646f6d, BP
XORQ BP, CX
MOVQ $0x6c7967656e657261, BP
XORQ BP, DX
MOVQ $0x7465646279746573, BP
XORQ BP, BX
MOVQ p_base+16(FP), BP
MOVQ p_len+24(FP), SI
MOVQ SI, DI
SHLQ $0x38, DI
CMPQ SI, $0x08
JL loop_end
loop_begin:
MOVQ (BP), R8
XORQ R8, BX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ R8, AX
ADDQ $0x08, BP
SUBQ $0x08, SI
CMPQ SI, $0x08
JGE loop_begin
loop_end:
CMPQ SI, $0x00
JE sw0
CMPQ SI, $0x01
JE sw1
CMPQ SI, $0x02
JE sw2
CMPQ SI, $0x03
JE sw3
CMPQ SI, $0x04
JE sw4
CMPQ SI, $0x05
JE sw5
CMPQ SI, $0x06
JE sw6
MOVBQZX 6(BP), SI
SHLQ $0x30, SI
ORQ SI, DI
sw6:
MOVBQZX 5(BP), SI
SHLQ $0x28, SI
ORQ SI, DI
sw5:
MOVBQZX 4(BP), SI
SHLQ $0x20, SI
ORQ SI, DI
sw4:
MOVBQZX 3(BP), SI
SHLQ $0x18, SI
ORQ SI, DI
sw3:
MOVBQZX 2(BP), SI
SHLQ $0x10, SI
ORQ SI, DI
sw2:
MOVBQZX 1(BP), SI
SHLQ $0x08, SI
ORQ SI, DI
sw1:
MOVBQZX (BP), SI
SHLQ $0x00, SI
ORQ SI, DI
sw0:
XORQ DI, BX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ DI, AX
XORQ $0xff, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
ADDQ CX, AX
ADDQ BX, DX
ROLQ $0x0d, CX
ROLQ $0x10, BX
XORQ AX, CX
XORQ DX, BX
ROLQ $0x20, AX
ADDQ CX, DX
ADDQ BX, AX
ROLQ $0x11, CX
ROLQ $0x15, BX
XORQ DX, CX
XORQ AX, BX
ROLQ $0x20, DX
XORQ CX, AX
XORQ BX, DX
XORQ DX, AX
MOVQ AX, ret+32(FP)
RET