-
Notifications
You must be signed in to change notification settings - Fork 10
/
metro_amd64.s
373 lines (370 loc) · 5.66 KB
/
metro_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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
// +build !noasm
// +build gc
// +build !purego
// Generated by PeachPy 0.2.0 from metro.py
// func Hash64(buffer_base uintptr, buffer_len int64, buffer_cap int64, seed uint64) uint64
TEXT ·Hash64(SB),4,$0-40
MOVQ seed+24(FP), AX
MOVQ buffer_base+0(FP), BX
MOVQ buffer_len+8(FP), CX
MOVQ $3603962101, DX
IMULQ DX, AX
MOVQ $5961697176435608501, DX
ADDQ DX, AX
CMPQ CX, $32
JLT after32
MOVQ AX, DX
MOVQ AX, DI
MOVQ AX, SI
MOVQ AX, BP
loop_begin:
MOVQ 0(BX), R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ R8, DX
RORQ $29, DX
ADDQ SI, DX
MOVQ 8(BX), R8
MOVQ $2729050939, R9
IMULQ R9, R8
ADDQ R8, DI
RORQ $29, DI
ADDQ BP, DI
MOVQ 16(BX), R8
MOVQ $1654206401, R9
IMULQ R9, R8
ADDQ R8, SI
RORQ $29, SI
ADDQ DX, SI
MOVQ 24(BX), R8
MOVQ $817650473, R9
IMULQ R9, R8
ADDQ R8, BP
RORQ $29, BP
ADDQ DI, BP
ADDQ $32, BX
SUBQ $32, CX
CMPQ CX, $32
JGE loop_begin
MOVQ DX, R8
ADDQ BP, R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ DI, R8
RORQ $37, R8
MOVQ $2729050939, R9
IMULQ R9, R8
XORQ R8, SI
MOVQ DI, R8
ADDQ SI, R8
MOVQ $2729050939, R9
IMULQ R9, R8
ADDQ DX, R8
RORQ $37, R8
MOVQ $3603962101, R9
IMULQ R9, R8
XORQ R8, BP
MOVQ DX, R8
ADDQ SI, R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ BP, R8
RORQ $37, R8
MOVQ $2729050939, R9
IMULQ R9, R8
XORQ R8, DX
MOVQ DI, R8
ADDQ BP, R8
MOVQ $2729050939, BP
IMULQ BP, R8
ADDQ SI, R8
RORQ $37, R8
MOVQ $3603962101, SI
IMULQ SI, R8
XORQ R8, DI
XORQ DI, DX
ADDQ DX, AX
after32:
CMPQ CX, $16
JLT after16
MOVQ 0(BX), DX
MOVQ $1654206401, DI
IMULQ DI, DX
ADDQ AX, DX
ADDQ $8, BX
SUBQ $8, CX
RORQ $29, DX
MOVQ $817650473, DI
IMULQ DI, DX
MOVQ 0(BX), DI
MOVQ $1654206401, SI
IMULQ SI, DI
ADDQ AX, DI
ADDQ $8, BX
SUBQ $8, CX
RORQ $29, DI
MOVQ $817650473, SI
IMULQ SI, DI
MOVQ DX, SI
MOVQ $3603962101, BP
IMULQ BP, SI
RORQ $21, SI
ADDQ DI, SI
XORQ SI, DX
MOVQ DI, SI
MOVQ $817650473, BP
IMULQ BP, SI
RORQ $21, SI
ADDQ DX, SI
XORQ SI, DI
ADDQ DI, AX
after16:
CMPQ CX, $8
JLT after8
MOVQ 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $8, BX
SUBQ $8, CX
MOVQ AX, DX
RORQ $55, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after8:
CMPQ CX, $4
JLT after4
XORQ DX, DX
MOVL 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $4, BX
SUBQ $4, CX
MOVQ AX, DX
RORQ $26, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after4:
CMPQ CX, $2
JLT after2
XORQ DX, DX
MOVW 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $2, BX
SUBQ $2, CX
MOVQ AX, DX
RORQ $48, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after2:
CMPQ CX, $1
JLT after1
MOVBQZX 0(BX), BX
MOVQ $817650473, CX
IMULQ CX, BX
ADDQ BX, AX
MOVQ AX, BX
RORQ $37, BX
MOVQ $2729050939, CX
IMULQ CX, BX
XORQ BX, AX
after1:
MOVQ AX, BX
RORQ $28, BX
XORQ BX, AX
MOVQ $3603962101, BX
IMULQ BX, AX
MOVQ AX, BX
RORQ $29, BX
XORQ BX, AX
MOVQ AX, ret+32(FP)
RET
// func Hash64Str(buffer_base uintptr, buffer_len int64, seed uint64) uint64
TEXT ·Hash64Str(SB),4,$0-32
MOVQ seed+16(FP), AX
MOVQ buffer_base+0(FP), BX
MOVQ buffer_len+8(FP), CX
MOVQ $3603962101, DX
IMULQ DX, AX
MOVQ $5961697176435608501, DX
ADDQ DX, AX
CMPQ CX, $32
JLT after32
MOVQ AX, DX
MOVQ AX, DI
MOVQ AX, SI
MOVQ AX, BP
loop_begin:
MOVQ 0(BX), R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ R8, DX
RORQ $29, DX
ADDQ SI, DX
MOVQ 8(BX), R8
MOVQ $2729050939, R9
IMULQ R9, R8
ADDQ R8, DI
RORQ $29, DI
ADDQ BP, DI
MOVQ 16(BX), R8
MOVQ $1654206401, R9
IMULQ R9, R8
ADDQ R8, SI
RORQ $29, SI
ADDQ DX, SI
MOVQ 24(BX), R8
MOVQ $817650473, R9
IMULQ R9, R8
ADDQ R8, BP
RORQ $29, BP
ADDQ DI, BP
ADDQ $32, BX
SUBQ $32, CX
CMPQ CX, $32
JGE loop_begin
MOVQ DX, R8
ADDQ BP, R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ DI, R8
RORQ $37, R8
MOVQ $2729050939, R9
IMULQ R9, R8
XORQ R8, SI
MOVQ DI, R8
ADDQ SI, R8
MOVQ $2729050939, R9
IMULQ R9, R8
ADDQ DX, R8
RORQ $37, R8
MOVQ $3603962101, R9
IMULQ R9, R8
XORQ R8, BP
MOVQ DX, R8
ADDQ SI, R8
MOVQ $3603962101, R9
IMULQ R9, R8
ADDQ BP, R8
RORQ $37, R8
MOVQ $2729050939, R9
IMULQ R9, R8
XORQ R8, DX
MOVQ DI, R8
ADDQ BP, R8
MOVQ $2729050939, BP
IMULQ BP, R8
ADDQ SI, R8
RORQ $37, R8
MOVQ $3603962101, SI
IMULQ SI, R8
XORQ R8, DI
XORQ DI, DX
ADDQ DX, AX
after32:
CMPQ CX, $16
JLT after16
MOVQ 0(BX), DX
MOVQ $1654206401, DI
IMULQ DI, DX
ADDQ AX, DX
ADDQ $8, BX
SUBQ $8, CX
RORQ $29, DX
MOVQ $817650473, DI
IMULQ DI, DX
MOVQ 0(BX), DI
MOVQ $1654206401, SI
IMULQ SI, DI
ADDQ AX, DI
ADDQ $8, BX
SUBQ $8, CX
RORQ $29, DI
MOVQ $817650473, SI
IMULQ SI, DI
MOVQ DX, SI
MOVQ $3603962101, BP
IMULQ BP, SI
RORQ $21, SI
ADDQ DI, SI
XORQ SI, DX
MOVQ DI, SI
MOVQ $817650473, BP
IMULQ BP, SI
RORQ $21, SI
ADDQ DX, SI
XORQ SI, DI
ADDQ DI, AX
after16:
CMPQ CX, $8
JLT after8
MOVQ 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $8, BX
SUBQ $8, CX
MOVQ AX, DX
RORQ $55, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after8:
CMPQ CX, $4
JLT after4
XORQ DX, DX
MOVL 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $4, BX
SUBQ $4, CX
MOVQ AX, DX
RORQ $26, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after4:
CMPQ CX, $2
JLT after2
XORQ DX, DX
MOVW 0(BX), DX
MOVQ $817650473, DI
IMULQ DI, DX
ADDQ DX, AX
ADDQ $2, BX
SUBQ $2, CX
MOVQ AX, DX
RORQ $48, DX
MOVQ $2729050939, DI
IMULQ DI, DX
XORQ DX, AX
after2:
CMPQ CX, $1
JLT after1
MOVBQZX 0(BX), BX
MOVQ $817650473, CX
IMULQ CX, BX
ADDQ BX, AX
MOVQ AX, BX
RORQ $37, BX
MOVQ $2729050939, CX
IMULQ CX, BX
XORQ BX, AX
after1:
MOVQ AX, BX
RORQ $28, BX
XORQ BX, AX
MOVQ $3603962101, BX
IMULQ BX, AX
MOVQ AX, BX
RORQ $29, BX
XORQ BX, AX
MOVQ AX, ret+24(FP)
RET