1// Copyright 2012 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5//go:build amd64 && !purego && gc
6
7// This code was translated into a form compatible with 6a from the public
8// domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html
9
10// func salsa2020XORKeyStream(out, in *byte, n uint64, nonce, key *byte)
11// This needs up to 64 bytes at 360(R12); hence the non-obvious frame size.
12TEXT ·salsa2020XORKeyStream(SB),0,$456-40 // frame = 424 + 32 byte alignment
13 MOVQ out+0(FP),DI
14 MOVQ in+8(FP),SI
15 MOVQ n+16(FP),DX
16 MOVQ nonce+24(FP),CX
17 MOVQ key+32(FP),R8
18
19 MOVQ SP,R12
20 ADDQ $31, R12
21 ANDQ $~31, R12
22
23 MOVQ DX,R9
24 MOVQ CX,DX
25 MOVQ R8,R10
26 CMPQ R9,$0
27 JBE DONE
28 START:
29 MOVL 20(R10),CX
30 MOVL 0(R10),R8
31 MOVL 0(DX),AX
32 MOVL 16(R10),R11
33 MOVL CX,0(R12)
34 MOVL R8, 4 (R12)
35 MOVL AX, 8 (R12)
36 MOVL R11, 12 (R12)
37 MOVL 8(DX),CX
38 MOVL 24(R10),R8
39 MOVL 4(R10),AX
40 MOVL 4(DX),R11
41 MOVL CX,16(R12)
42 MOVL R8, 20 (R12)
43 MOVL AX, 24 (R12)
44 MOVL R11, 28 (R12)
45 MOVL 12(DX),CX
46 MOVL 12(R10),DX
47 MOVL 28(R10),R8
48 MOVL 8(R10),AX
49 MOVL DX,32(R12)
50 MOVL CX, 36 (R12)
51 MOVL R8, 40 (R12)
52 MOVL AX, 44 (R12)
53 MOVQ $1634760805,DX
54 MOVQ $857760878,CX
55 MOVQ $2036477234,R8
56 MOVQ $1797285236,AX
57 MOVL DX,48(R12)
58 MOVL CX, 52 (R12)
59 MOVL R8, 56 (R12)
60 MOVL AX, 60 (R12)
61 CMPQ R9,$256
62 JB BYTESBETWEEN1AND255
63 MOVOA 48(R12),X0
64 PSHUFL $0X55,X0,X1
65 PSHUFL $0XAA,X0,X2
66 PSHUFL $0XFF,X0,X3
67 PSHUFL $0X00,X0,X0
68 MOVOA X1,64(R12)
69 MOVOA X2,80(R12)
70 MOVOA X3,96(R12)
71 MOVOA X0,112(R12)
72 MOVOA 0(R12),X0
73 PSHUFL $0XAA,X0,X1
74 PSHUFL $0XFF,X0,X2
75 PSHUFL $0X00,X0,X3
76 PSHUFL $0X55,X0,X0
77 MOVOA X1,128(R12)
78 MOVOA X2,144(R12)
79 MOVOA X3,160(R12)
80 MOVOA X0,176(R12)
81 MOVOA 16(R12),X0
82 PSHUFL $0XFF,X0,X1
83 PSHUFL $0X55,X0,X2
84 PSHUFL $0XAA,X0,X0
85 MOVOA X1,192(R12)
86 MOVOA X2,208(R12)
87 MOVOA X0,224(R12)
88 MOVOA 32(R12),X0
89 PSHUFL $0X00,X0,X1
90 PSHUFL $0XAA,X0,X2
91 PSHUFL $0XFF,X0,X0
92 MOVOA X1,240(R12)
93 MOVOA X2,256(R12)
94 MOVOA X0,272(R12)
95 BYTESATLEAST256:
96 MOVL 16(R12),DX
97 MOVL 36 (R12),CX
98 MOVL DX,288(R12)
99 MOVL CX,304(R12)
100 SHLQ $32,CX
101 ADDQ CX,DX
102 ADDQ $1,DX
103 MOVQ DX,CX
104 SHRQ $32,CX
105 MOVL DX, 292 (R12)
106 MOVL CX, 308 (R12)
107 ADDQ $1,DX
108 MOVQ DX,CX
109 SHRQ $32,CX
110 MOVL DX, 296 (R12)
111 MOVL CX, 312 (R12)
112 ADDQ $1,DX
113 MOVQ DX,CX
114 SHRQ $32,CX
115 MOVL DX, 300 (R12)
116 MOVL CX, 316 (R12)
117 ADDQ $1,DX
118 MOVQ DX,CX
119 SHRQ $32,CX
120 MOVL DX,16(R12)
121 MOVL CX, 36 (R12)
122 MOVQ R9,352(R12)
123 MOVQ $20,DX
124 MOVOA 64(R12),X0
125 MOVOA 80(R12),X1
126 MOVOA 96(R12),X2
127 MOVOA 256(R12),X3
128 MOVOA 272(R12),X4
129 MOVOA 128(R12),X5
130 MOVOA 144(R12),X6
131 MOVOA 176(R12),X7
132 MOVOA 192(R12),X8
133 MOVOA 208(R12),X9
134 MOVOA 224(R12),X10
135 MOVOA 304(R12),X11
136 MOVOA 112(R12),X12
137 MOVOA 160(R12),X13
138 MOVOA 240(R12),X14
139 MOVOA 288(R12),X15
140 MAINLOOP1:
141 MOVOA X1,320(R12)
142 MOVOA X2,336(R12)
143 MOVOA X13,X1
144 PADDL X12,X1
145 MOVOA X1,X2
146 PSLLL $7,X1
147 PXOR X1,X14
148 PSRLL $25,X2
149 PXOR X2,X14
150 MOVOA X7,X1
151 PADDL X0,X1
152 MOVOA X1,X2
153 PSLLL $7,X1
154 PXOR X1,X11
155 PSRLL $25,X2
156 PXOR X2,X11
157 MOVOA X12,X1
158 PADDL X14,X1
159 MOVOA X1,X2
160 PSLLL $9,X1
161 PXOR X1,X15
162 PSRLL $23,X2
163 PXOR X2,X15
164 MOVOA X0,X1
165 PADDL X11,X1
166 MOVOA X1,X2
167 PSLLL $9,X1
168 PXOR X1,X9
169 PSRLL $23,X2
170 PXOR X2,X9
171 MOVOA X14,X1
172 PADDL X15,X1
173 MOVOA X1,X2
174 PSLLL $13,X1
175 PXOR X1,X13
176 PSRLL $19,X2
177 PXOR X2,X13
178 MOVOA X11,X1
179 PADDL X9,X1
180 MOVOA X1,X2
181 PSLLL $13,X1
182 PXOR X1,X7
183 PSRLL $19,X2
184 PXOR X2,X7
185 MOVOA X15,X1
186 PADDL X13,X1
187 MOVOA X1,X2
188 PSLLL $18,X1
189 PXOR X1,X12
190 PSRLL $14,X2
191 PXOR X2,X12
192 MOVOA 320(R12),X1
193 MOVOA X12,320(R12)
194 MOVOA X9,X2
195 PADDL X7,X2
196 MOVOA X2,X12
197 PSLLL $18,X2
198 PXOR X2,X0
199 PSRLL $14,X12
200 PXOR X12,X0
201 MOVOA X5,X2
202 PADDL X1,X2
203 MOVOA X2,X12
204 PSLLL $7,X2
205 PXOR X2,X3
206 PSRLL $25,X12
207 PXOR X12,X3
208 MOVOA 336(R12),X2
209 MOVOA X0,336(R12)
210 MOVOA X6,X0
211 PADDL X2,X0
212 MOVOA X0,X12
213 PSLLL $7,X0
214 PXOR X0,X4
215 PSRLL $25,X12
216 PXOR X12,X4
217 MOVOA X1,X0
218 PADDL X3,X0
219 MOVOA X0,X12
220 PSLLL $9,X0
221 PXOR X0,X10
222 PSRLL $23,X12
223 PXOR X12,X10
224 MOVOA X2,X0
225 PADDL X4,X0
226 MOVOA X0,X12
227 PSLLL $9,X0
228 PXOR X0,X8
229 PSRLL $23,X12
230 PXOR X12,X8
231 MOVOA X3,X0
232 PADDL X10,X0
233 MOVOA X0,X12
234 PSLLL $13,X0
235 PXOR X0,X5
236 PSRLL $19,X12
237 PXOR X12,X5
238 MOVOA X4,X0
239 PADDL X8,X0
240 MOVOA X0,X12
241 PSLLL $13,X0
242 PXOR X0,X6
243 PSRLL $19,X12
244 PXOR X12,X6
245 MOVOA X10,X0
246 PADDL X5,X0
247 MOVOA X0,X12
248 PSLLL $18,X0
249 PXOR X0,X1
250 PSRLL $14,X12
251 PXOR X12,X1
252 MOVOA 320(R12),X0
253 MOVOA X1,320(R12)
254 MOVOA X4,X1
255 PADDL X0,X1
256 MOVOA X1,X12
257 PSLLL $7,X1
258 PXOR X1,X7
259 PSRLL $25,X12
260 PXOR X12,X7
261 MOVOA X8,X1
262 PADDL X6,X1
263 MOVOA X1,X12
264 PSLLL $18,X1
265 PXOR X1,X2
266 PSRLL $14,X12
267 PXOR X12,X2
268 MOVOA 336(R12),X12
269 MOVOA X2,336(R12)
270 MOVOA X14,X1
271 PADDL X12,X1
272 MOVOA X1,X2
273 PSLLL $7,X1
274 PXOR X1,X5
275 PSRLL $25,X2
276 PXOR X2,X5
277 MOVOA X0,X1
278 PADDL X7,X1
279 MOVOA X1,X2
280 PSLLL $9,X1
281 PXOR X1,X10
282 PSRLL $23,X2
283 PXOR X2,X10
284 MOVOA X12,X1
285 PADDL X5,X1
286 MOVOA X1,X2
287 PSLLL $9,X1
288 PXOR X1,X8
289 PSRLL $23,X2
290 PXOR X2,X8
291 MOVOA X7,X1
292 PADDL X10,X1
293 MOVOA X1,X2
294 PSLLL $13,X1
295 PXOR X1,X4
296 PSRLL $19,X2
297 PXOR X2,X4
298 MOVOA X5,X1
299 PADDL X8,X1
300 MOVOA X1,X2
301 PSLLL $13,X1
302 PXOR X1,X14
303 PSRLL $19,X2
304 PXOR X2,X14
305 MOVOA X10,X1
306 PADDL X4,X1
307 MOVOA X1,X2
308 PSLLL $18,X1
309 PXOR X1,X0
310 PSRLL $14,X2
311 PXOR X2,X0
312 MOVOA 320(R12),X1
313 MOVOA X0,320(R12)
314 MOVOA X8,X0
315 PADDL X14,X0
316 MOVOA X0,X2
317 PSLLL $18,X0
318 PXOR X0,X12
319 PSRLL $14,X2
320 PXOR X2,X12
321 MOVOA X11,X0
322 PADDL X1,X0
323 MOVOA X0,X2
324 PSLLL $7,X0
325 PXOR X0,X6
326 PSRLL $25,X2
327 PXOR X2,X6
328 MOVOA 336(R12),X2
329 MOVOA X12,336(R12)
330 MOVOA X3,X0
331 PADDL X2,X0
332 MOVOA X0,X12
333 PSLLL $7,X0
334 PXOR X0,X13
335 PSRLL $25,X12
336 PXOR X12,X13
337 MOVOA X1,X0
338 PADDL X6,X0
339 MOVOA X0,X12
340 PSLLL $9,X0
341 PXOR X0,X15
342 PSRLL $23,X12
343 PXOR X12,X15
344 MOVOA X2,X0
345 PADDL X13,X0
346 MOVOA X0,X12
347 PSLLL $9,X0
348 PXOR X0,X9
349 PSRLL $23,X12
350 PXOR X12,X9
351 MOVOA X6,X0
352 PADDL X15,X0
353 MOVOA X0,X12
354 PSLLL $13,X0
355 PXOR X0,X11
356 PSRLL $19,X12
357 PXOR X12,X11
358 MOVOA X13,X0
359 PADDL X9,X0
360 MOVOA X0,X12
361 PSLLL $13,X0
362 PXOR X0,X3
363 PSRLL $19,X12
364 PXOR X12,X3
365 MOVOA X15,X0
366 PADDL X11,X0
367 MOVOA X0,X12
368 PSLLL $18,X0
369 PXOR X0,X1
370 PSRLL $14,X12
371 PXOR X12,X1
372 MOVOA X9,X0
373 PADDL X3,X0
374 MOVOA X0,X12
375 PSLLL $18,X0
376 PXOR X0,X2
377 PSRLL $14,X12
378 PXOR X12,X2
379 MOVOA 320(R12),X12
380 MOVOA 336(R12),X0
381 SUBQ $2,DX
382 JA MAINLOOP1
383 PADDL 112(R12),X12
384 PADDL 176(R12),X7
385 PADDL 224(R12),X10
386 PADDL 272(R12),X4
387 MOVD X12,DX
388 MOVD X7,CX
389 MOVD X10,R8
390 MOVD X4,R9
391 PSHUFL $0X39,X12,X12
392 PSHUFL $0X39,X7,X7
393 PSHUFL $0X39,X10,X10
394 PSHUFL $0X39,X4,X4
395 XORL 0(SI),DX
396 XORL 4(SI),CX
397 XORL 8(SI),R8
398 XORL 12(SI),R9
399 MOVL DX,0(DI)
400 MOVL CX,4(DI)
401 MOVL R8,8(DI)
402 MOVL R9,12(DI)
403 MOVD X12,DX
404 MOVD X7,CX
405 MOVD X10,R8
406 MOVD X4,R9
407 PSHUFL $0X39,X12,X12
408 PSHUFL $0X39,X7,X7
409 PSHUFL $0X39,X10,X10
410 PSHUFL $0X39,X4,X4
411 XORL 64(SI),DX
412 XORL 68(SI),CX
413 XORL 72(SI),R8
414 XORL 76(SI),R9
415 MOVL DX,64(DI)
416 MOVL CX,68(DI)
417 MOVL R8,72(DI)
418 MOVL R9,76(DI)
419 MOVD X12,DX
420 MOVD X7,CX
421 MOVD X10,R8
422 MOVD X4,R9
423 PSHUFL $0X39,X12,X12
424 PSHUFL $0X39,X7,X7
425 PSHUFL $0X39,X10,X10
426 PSHUFL $0X39,X4,X4
427 XORL 128(SI),DX
428 XORL 132(SI),CX
429 XORL 136(SI),R8
430 XORL 140(SI),R9
431 MOVL DX,128(DI)
432 MOVL CX,132(DI)
433 MOVL R8,136(DI)
434 MOVL R9,140(DI)
435 MOVD X12,DX
436 MOVD X7,CX
437 MOVD X10,R8
438 MOVD X4,R9
439 XORL 192(SI),DX
440 XORL 196(SI),CX
441 XORL 200(SI),R8
442 XORL 204(SI),R9
443 MOVL DX,192(DI)
444 MOVL CX,196(DI)
445 MOVL R8,200(DI)
446 MOVL R9,204(DI)
447 PADDL 240(R12),X14
448 PADDL 64(R12),X0
449 PADDL 128(R12),X5
450 PADDL 192(R12),X8
451 MOVD X14,DX
452 MOVD X0,CX
453 MOVD X5,R8
454 MOVD X8,R9
455 PSHUFL $0X39,X14,X14
456 PSHUFL $0X39,X0,X0
457 PSHUFL $0X39,X5,X5
458 PSHUFL $0X39,X8,X8
459 XORL 16(SI),DX
460 XORL 20(SI),CX
461 XORL 24(SI),R8
462 XORL 28(SI),R9
463 MOVL DX,16(DI)
464 MOVL CX,20(DI)
465 MOVL R8,24(DI)
466 MOVL R9,28(DI)
467 MOVD X14,DX
468 MOVD X0,CX
469 MOVD X5,R8
470 MOVD X8,R9
471 PSHUFL $0X39,X14,X14
472 PSHUFL $0X39,X0,X0
473 PSHUFL $0X39,X5,X5
474 PSHUFL $0X39,X8,X8
475 XORL 80(SI),DX
476 XORL 84(SI),CX
477 XORL 88(SI),R8
478 XORL 92(SI),R9
479 MOVL DX,80(DI)
480 MOVL CX,84(DI)
481 MOVL R8,88(DI)
482 MOVL R9,92(DI)
483 MOVD X14,DX
484 MOVD X0,CX
485 MOVD X5,R8
486 MOVD X8,R9
487 PSHUFL $0X39,X14,X14
488 PSHUFL $0X39,X0,X0
489 PSHUFL $0X39,X5,X5
490 PSHUFL $0X39,X8,X8
491 XORL 144(SI),DX
492 XORL 148(SI),CX
493 XORL 152(SI),R8
494 XORL 156(SI),R9
495 MOVL DX,144(DI)
496 MOVL CX,148(DI)
497 MOVL R8,152(DI)
498 MOVL R9,156(DI)
499 MOVD X14,DX
500 MOVD X0,CX
501 MOVD X5,R8
502 MOVD X8,R9
503 XORL 208(SI),DX
504 XORL 212(SI),CX
505 XORL 216(SI),R8
506 XORL 220(SI),R9
507 MOVL DX,208(DI)
508 MOVL CX,212(DI)
509 MOVL R8,216(DI)
510 MOVL R9,220(DI)
511 PADDL 288(R12),X15
512 PADDL 304(R12),X11
513 PADDL 80(R12),X1
514 PADDL 144(R12),X6
515 MOVD X15,DX
516 MOVD X11,CX
517 MOVD X1,R8
518 MOVD X6,R9
519 PSHUFL $0X39,X15,X15
520 PSHUFL $0X39,X11,X11
521 PSHUFL $0X39,X1,X1
522 PSHUFL $0X39,X6,X6
523 XORL 32(SI),DX
524 XORL 36(SI),CX
525 XORL 40(SI),R8
526 XORL 44(SI),R9
527 MOVL DX,32(DI)
528 MOVL CX,36(DI)
529 MOVL R8,40(DI)
530 MOVL R9,44(DI)
531 MOVD X15,DX
532 MOVD X11,CX
533 MOVD X1,R8
534 MOVD X6,R9
535 PSHUFL $0X39,X15,X15
536 PSHUFL $0X39,X11,X11
537 PSHUFL $0X39,X1,X1
538 PSHUFL $0X39,X6,X6
539 XORL 96(SI),DX
540 XORL 100(SI),CX
541 XORL 104(SI),R8
542 XORL 108(SI),R9
543 MOVL DX,96(DI)
544 MOVL CX,100(DI)
545 MOVL R8,104(DI)
546 MOVL R9,108(DI)
547 MOVD X15,DX
548 MOVD X11,CX
549 MOVD X1,R8
550 MOVD X6,R9
551 PSHUFL $0X39,X15,X15
552 PSHUFL $0X39,X11,X11
553 PSHUFL $0X39,X1,X1
554 PSHUFL $0X39,X6,X6
555 XORL 160(SI),DX
556 XORL 164(SI),CX
557 XORL 168(SI),R8
558 XORL 172(SI),R9
559 MOVL DX,160(DI)
560 MOVL CX,164(DI)
561 MOVL R8,168(DI)
562 MOVL R9,172(DI)
563 MOVD X15,DX
564 MOVD X11,CX
565 MOVD X1,R8
566 MOVD X6,R9
567 XORL 224(SI),DX
568 XORL 228(SI),CX
569 XORL 232(SI),R8
570 XORL 236(SI),R9
571 MOVL DX,224(DI)
572 MOVL CX,228(DI)
573 MOVL R8,232(DI)
574 MOVL R9,236(DI)
575 PADDL 160(R12),X13
576 PADDL 208(R12),X9
577 PADDL 256(R12),X3
578 PADDL 96(R12),X2
579 MOVD X13,DX
580 MOVD X9,CX
581 MOVD X3,R8
582 MOVD X2,R9
583 PSHUFL $0X39,X13,X13
584 PSHUFL $0X39,X9,X9
585 PSHUFL $0X39,X3,X3
586 PSHUFL $0X39,X2,X2
587 XORL 48(SI),DX
588 XORL 52(SI),CX
589 XORL 56(SI),R8
590 XORL 60(SI),R9
591 MOVL DX,48(DI)
592 MOVL CX,52(DI)
593 MOVL R8,56(DI)
594 MOVL R9,60(DI)
595 MOVD X13,DX
596 MOVD X9,CX
597 MOVD X3,R8
598 MOVD X2,R9
599 PSHUFL $0X39,X13,X13
600 PSHUFL $0X39,X9,X9
601 PSHUFL $0X39,X3,X3
602 PSHUFL $0X39,X2,X2
603 XORL 112(SI),DX
604 XORL 116(SI),CX
605 XORL 120(SI),R8
606 XORL 124(SI),R9
607 MOVL DX,112(DI)
608 MOVL CX,116(DI)
609 MOVL R8,120(DI)
610 MOVL R9,124(DI)
611 MOVD X13,DX
612 MOVD X9,CX
613 MOVD X3,R8
614 MOVD X2,R9
615 PSHUFL $0X39,X13,X13
616 PSHUFL $0X39,X9,X9
617 PSHUFL $0X39,X3,X3
618 PSHUFL $0X39,X2,X2
619 XORL 176(SI),DX
620 XORL 180(SI),CX
621 XORL 184(SI),R8
622 XORL 188(SI),R9
623 MOVL DX,176(DI)
624 MOVL CX,180(DI)
625 MOVL R8,184(DI)
626 MOVL R9,188(DI)
627 MOVD X13,DX
628 MOVD X9,CX
629 MOVD X3,R8
630 MOVD X2,R9
631 XORL 240(SI),DX
632 XORL 244(SI),CX
633 XORL 248(SI),R8
634 XORL 252(SI),R9
635 MOVL DX,240(DI)
636 MOVL CX,244(DI)
637 MOVL R8,248(DI)
638 MOVL R9,252(DI)
639 MOVQ 352(R12),R9
640 SUBQ $256,R9
641 ADDQ $256,SI
642 ADDQ $256,DI
643 CMPQ R9,$256
644 JAE BYTESATLEAST256
645 CMPQ R9,$0
646 JBE DONE
647 BYTESBETWEEN1AND255:
648 CMPQ R9,$64
649 JAE NOCOPY
650 MOVQ DI,DX
651 LEAQ 360(R12),DI
652 MOVQ R9,CX
653 REP; MOVSB
654 LEAQ 360(R12),DI
655 LEAQ 360(R12),SI
656 NOCOPY:
657 MOVQ R9,352(R12)
658 MOVOA 48(R12),X0
659 MOVOA 0(R12),X1
660 MOVOA 16(R12),X2
661 MOVOA 32(R12),X3
662 MOVOA X1,X4
663 MOVQ $20,CX
664 MAINLOOP2:
665 PADDL X0,X4
666 MOVOA X0,X5
667 MOVOA X4,X6
668 PSLLL $7,X4
669 PSRLL $25,X6
670 PXOR X4,X3
671 PXOR X6,X3
672 PADDL X3,X5
673 MOVOA X3,X4
674 MOVOA X5,X6
675 PSLLL $9,X5
676 PSRLL $23,X6
677 PXOR X5,X2
678 PSHUFL $0X93,X3,X3
679 PXOR X6,X2
680 PADDL X2,X4
681 MOVOA X2,X5
682 MOVOA X4,X6
683 PSLLL $13,X4
684 PSRLL $19,X6
685 PXOR X4,X1
686 PSHUFL $0X4E,X2,X2
687 PXOR X6,X1
688 PADDL X1,X5
689 MOVOA X3,X4
690 MOVOA X5,X6
691 PSLLL $18,X5
692 PSRLL $14,X6
693 PXOR X5,X0
694 PSHUFL $0X39,X1,X1
695 PXOR X6,X0
696 PADDL X0,X4
697 MOVOA X0,X5
698 MOVOA X4,X6
699 PSLLL $7,X4
700 PSRLL $25,X6
701 PXOR X4,X1
702 PXOR X6,X1
703 PADDL X1,X5
704 MOVOA X1,X4
705 MOVOA X5,X6
706 PSLLL $9,X5
707 PSRLL $23,X6
708 PXOR X5,X2
709 PSHUFL $0X93,X1,X1
710 PXOR X6,X2
711 PADDL X2,X4
712 MOVOA X2,X5
713 MOVOA X4,X6
714 PSLLL $13,X4
715 PSRLL $19,X6
716 PXOR X4,X3
717 PSHUFL $0X4E,X2,X2
718 PXOR X6,X3
719 PADDL X3,X5
720 MOVOA X1,X4
721 MOVOA X5,X6
722 PSLLL $18,X5
723 PSRLL $14,X6
724 PXOR X5,X0
725 PSHUFL $0X39,X3,X3
726 PXOR X6,X0
727 PADDL X0,X4
728 MOVOA X0,X5
729 MOVOA X4,X6
730 PSLLL $7,X4
731 PSRLL $25,X6
732 PXOR X4,X3
733 PXOR X6,X3
734 PADDL X3,X5
735 MOVOA X3,X4
736 MOVOA X5,X6
737 PSLLL $9,X5
738 PSRLL $23,X6
739 PXOR X5,X2
740 PSHUFL $0X93,X3,X3
741 PXOR X6,X2
742 PADDL X2,X4
743 MOVOA X2,X5
744 MOVOA X4,X6
745 PSLLL $13,X4
746 PSRLL $19,X6
747 PXOR X4,X1
748 PSHUFL $0X4E,X2,X2
749 PXOR X6,X1
750 PADDL X1,X5
751 MOVOA X3,X4
752 MOVOA X5,X6
753 PSLLL $18,X5
754 PSRLL $14,X6
755 PXOR X5,X0
756 PSHUFL $0X39,X1,X1
757 PXOR X6,X0
758 PADDL X0,X4
759 MOVOA X0,X5
760 MOVOA X4,X6
761 PSLLL $7,X4
762 PSRLL $25,X6
763 PXOR X4,X1
764 PXOR X6,X1
765 PADDL X1,X5
766 MOVOA X1,X4
767 MOVOA X5,X6
768 PSLLL $9,X5
769 PSRLL $23,X6
770 PXOR X5,X2
771 PSHUFL $0X93,X1,X1
772 PXOR X6,X2
773 PADDL X2,X4
774 MOVOA X2,X5
775 MOVOA X4,X6
776 PSLLL $13,X4
777 PSRLL $19,X6
778 PXOR X4,X3
779 PSHUFL $0X4E,X2,X2
780 PXOR X6,X3
781 SUBQ $4,CX
782 PADDL X3,X5
783 MOVOA X1,X4
784 MOVOA X5,X6
785 PSLLL $18,X5
786 PXOR X7,X7
787 PSRLL $14,X6
788 PXOR X5,X0
789 PSHUFL $0X39,X3,X3
790 PXOR X6,X0
791 JA MAINLOOP2
792 PADDL 48(R12),X0
793 PADDL 0(R12),X1
794 PADDL 16(R12),X2
795 PADDL 32(R12),X3
796 MOVD X0,CX
797 MOVD X1,R8
798 MOVD X2,R9
799 MOVD X3,AX
800 PSHUFL $0X39,X0,X0
801 PSHUFL $0X39,X1,X1
802 PSHUFL $0X39,X2,X2
803 PSHUFL $0X39,X3,X3
804 XORL 0(SI),CX
805 XORL 48(SI),R8
806 XORL 32(SI),R9
807 XORL 16(SI),AX
808 MOVL CX,0(DI)
809 MOVL R8,48(DI)
810 MOVL R9,32(DI)
811 MOVL AX,16(DI)
812 MOVD X0,CX
813 MOVD X1,R8
814 MOVD X2,R9
815 MOVD X3,AX
816 PSHUFL $0X39,X0,X0
817 PSHUFL $0X39,X1,X1
818 PSHUFL $0X39,X2,X2
819 PSHUFL $0X39,X3,X3
820 XORL 20(SI),CX
821 XORL 4(SI),R8
822 XORL 52(SI),R9
823 XORL 36(SI),AX
824 MOVL CX,20(DI)
825 MOVL R8,4(DI)
826 MOVL R9,52(DI)
827 MOVL AX,36(DI)
828 MOVD X0,CX
829 MOVD X1,R8
830 MOVD X2,R9
831 MOVD X3,AX
832 PSHUFL $0X39,X0,X0
833 PSHUFL $0X39,X1,X1
834 PSHUFL $0X39,X2,X2
835 PSHUFL $0X39,X3,X3
836 XORL 40(SI),CX
837 XORL 24(SI),R8
838 XORL 8(SI),R9
839 XORL 56(SI),AX
840 MOVL CX,40(DI)
841 MOVL R8,24(DI)
842 MOVL R9,8(DI)
843 MOVL AX,56(DI)
844 MOVD X0,CX
845 MOVD X1,R8
846 MOVD X2,R9
847 MOVD X3,AX
848 XORL 60(SI),CX
849 XORL 44(SI),R8
850 XORL 28(SI),R9
851 XORL 12(SI),AX
852 MOVL CX,60(DI)
853 MOVL R8,44(DI)
854 MOVL R9,28(DI)
855 MOVL AX,12(DI)
856 MOVQ 352(R12),R9
857 MOVL 16(R12),CX
858 MOVL 36 (R12),R8
859 ADDQ $1,CX
860 SHLQ $32,R8
861 ADDQ R8,CX
862 MOVQ CX,R8
863 SHRQ $32,R8
864 MOVL CX,16(R12)
865 MOVL R8, 36 (R12)
866 CMPQ R9,$64
867 JA BYTESATLEAST65
868 JAE BYTESATLEAST64
869 MOVQ DI,SI
870 MOVQ DX,DI
871 MOVQ R9,CX
872 REP; MOVSB
873 BYTESATLEAST64:
874 DONE:
875 RET
876 BYTESATLEAST65:
877 SUBQ $64,R9
878 ADDQ $64,DI
879 ADDQ $64,SI
880 JMP BYTESBETWEEN1AND255
View as plain text