xref: /freebsd/sys/crypto/openssl/powerpc64/chacha-ppc.S (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1/* $FreeBSD$ */
2/* Do not modify. This file is auto-generated from chacha-ppc.pl. */
3.machine	"any"
4.abiversion	2
5.text
6
7.globl	ChaCha20_ctr32_int
8.type	ChaCha20_ctr32_int,@function
9.align	5
10ChaCha20_ctr32_int:
11.localentry	ChaCha20_ctr32_int,0
12
13__ChaCha20_ctr32_int:
14	cmpldi	5,0
15	.long	0x4DC20020
16
17	stdu	1,-256(1)
18	mflr	0
19
20	std	14,112(1)
21	std	15,120(1)
22	std	16,128(1)
23	std	17,136(1)
24	std	18,144(1)
25	std	19,152(1)
26	std	20,160(1)
27	std	21,168(1)
28	std	22,176(1)
29	std	23,184(1)
30	std	24,192(1)
31	std	25,200(1)
32	std	26,208(1)
33	std	27,216(1)
34	std	28,224(1)
35	std	29,232(1)
36	std	30,240(1)
37	std	31,248(1)
38	std	0,272(1)
39
40	lwz	11,0(7)
41	lwz	12,4(7)
42	lwz	14,8(7)
43	lwz	15,12(7)
44
45	bl	__ChaCha20_1x
46
47	ld	0,272(1)
48	ld	14,112(1)
49	ld	15,120(1)
50	ld	16,128(1)
51	ld	17,136(1)
52	ld	18,144(1)
53	ld	19,152(1)
54	ld	20,160(1)
55	ld	21,168(1)
56	ld	22,176(1)
57	ld	23,184(1)
58	ld	24,192(1)
59	ld	25,200(1)
60	ld	26,208(1)
61	ld	27,216(1)
62	ld	28,224(1)
63	ld	29,232(1)
64	ld	30,240(1)
65	ld	31,248(1)
66	mtlr	0
67	addi	1,1,256
68	blr
69.long	0
70.byte	0,12,4,1,0x80,18,5,0
71.long	0
72.size	ChaCha20_ctr32_int,.-ChaCha20_ctr32_int
73
74.align	5
75__ChaCha20_1x:
76.Loop_outer:
77	lis	16,0x6170
78	lis	17,0x3320
79	lis	18,0x7962
80	lis	19,0x6b20
81	ori	16,16,0x7865
82	ori	17,17,0x646e
83	ori	18,18,0x2d32
84	ori	19,19,0x6574
85
86	li	0,10
87	lwz	20,0(6)
88	lwz	21,4(6)
89	lwz	22,8(6)
90	lwz	23,12(6)
91	lwz	24,16(6)
92	mr	28,11
93	lwz	25,20(6)
94	mr	29,12
95	lwz	26,24(6)
96	mr	30,14
97	lwz	27,28(6)
98	mr	31,15
99
100	mr	7,20
101	mr	8,21
102	mr	9,22
103	mr	10,23
104
105	mtctr	0
106.Loop:
107	add	16,16,20
108	add	17,17,21
109	add	18,18,22
110	add	19,19,23
111	xor	28,28,16
112	xor	29,29,17
113	xor	30,30,18
114	xor	31,31,19
115	rotlwi	28,28,16
116	rotlwi	29,29,16
117	rotlwi	30,30,16
118	rotlwi	31,31,16
119	add	24,24,28
120	add	25,25,29
121	add	26,26,30
122	add	27,27,31
123	xor	20,20,24
124	xor	21,21,25
125	xor	22,22,26
126	xor	23,23,27
127	rotlwi	20,20,12
128	rotlwi	21,21,12
129	rotlwi	22,22,12
130	rotlwi	23,23,12
131	add	16,16,20
132	add	17,17,21
133	add	18,18,22
134	add	19,19,23
135	xor	28,28,16
136	xor	29,29,17
137	xor	30,30,18
138	xor	31,31,19
139	rotlwi	28,28,8
140	rotlwi	29,29,8
141	rotlwi	30,30,8
142	rotlwi	31,31,8
143	add	24,24,28
144	add	25,25,29
145	add	26,26,30
146	add	27,27,31
147	xor	20,20,24
148	xor	21,21,25
149	xor	22,22,26
150	xor	23,23,27
151	rotlwi	20,20,7
152	rotlwi	21,21,7
153	rotlwi	22,22,7
154	rotlwi	23,23,7
155	add	16,16,21
156	add	17,17,22
157	add	18,18,23
158	add	19,19,20
159	xor	31,31,16
160	xor	28,28,17
161	xor	29,29,18
162	xor	30,30,19
163	rotlwi	31,31,16
164	rotlwi	28,28,16
165	rotlwi	29,29,16
166	rotlwi	30,30,16
167	add	26,26,31
168	add	27,27,28
169	add	24,24,29
170	add	25,25,30
171	xor	21,21,26
172	xor	22,22,27
173	xor	23,23,24
174	xor	20,20,25
175	rotlwi	21,21,12
176	rotlwi	22,22,12
177	rotlwi	23,23,12
178	rotlwi	20,20,12
179	add	16,16,21
180	add	17,17,22
181	add	18,18,23
182	add	19,19,20
183	xor	31,31,16
184	xor	28,28,17
185	xor	29,29,18
186	xor	30,30,19
187	rotlwi	31,31,8
188	rotlwi	28,28,8
189	rotlwi	29,29,8
190	rotlwi	30,30,8
191	add	26,26,31
192	add	27,27,28
193	add	24,24,29
194	add	25,25,30
195	xor	21,21,26
196	xor	22,22,27
197	xor	23,23,24
198	xor	20,20,25
199	rotlwi	21,21,7
200	rotlwi	22,22,7
201	rotlwi	23,23,7
202	rotlwi	20,20,7
203	bdnz	.Loop
204
205	subic	5,5,64
206	addi	16,16,0x7865
207	addi	17,17,0x646e
208	addi	18,18,0x2d32
209	addi	19,19,0x6574
210	addis	16,16,0x6170
211	addis	17,17,0x3320
212	addis	18,18,0x7962
213	addis	19,19,0x6b20
214
215	subfe.	0,0,0
216	add	20,20,7
217	lwz	7,16(6)
218	add	21,21,8
219	lwz	8,20(6)
220	add	22,22,9
221	lwz	9,24(6)
222	add	23,23,10
223	lwz	10,28(6)
224	add	24,24,7
225	add	25,25,8
226	add	26,26,9
227	add	27,27,10
228
229	add	28,28,11
230	add	29,29,12
231	add	30,30,14
232	add	31,31,15
233	addi	11,11,1
234	mr	7,16
235	rotlwi	16,16,8
236	rlwimi	16,7,24,0,7
237	rlwimi	16,7,24,16,23
238	mr	8,17
239	rotlwi	17,17,8
240	rlwimi	17,8,24,0,7
241	rlwimi	17,8,24,16,23
242	mr	9,18
243	rotlwi	18,18,8
244	rlwimi	18,9,24,0,7
245	rlwimi	18,9,24,16,23
246	mr	10,19
247	rotlwi	19,19,8
248	rlwimi	19,10,24,0,7
249	rlwimi	19,10,24,16,23
250	mr	7,20
251	rotlwi	20,20,8
252	rlwimi	20,7,24,0,7
253	rlwimi	20,7,24,16,23
254	mr	8,21
255	rotlwi	21,21,8
256	rlwimi	21,8,24,0,7
257	rlwimi	21,8,24,16,23
258	mr	9,22
259	rotlwi	22,22,8
260	rlwimi	22,9,24,0,7
261	rlwimi	22,9,24,16,23
262	mr	10,23
263	rotlwi	23,23,8
264	rlwimi	23,10,24,0,7
265	rlwimi	23,10,24,16,23
266	mr	7,24
267	rotlwi	24,24,8
268	rlwimi	24,7,24,0,7
269	rlwimi	24,7,24,16,23
270	mr	8,25
271	rotlwi	25,25,8
272	rlwimi	25,8,24,0,7
273	rlwimi	25,8,24,16,23
274	mr	9,26
275	rotlwi	26,26,8
276	rlwimi	26,9,24,0,7
277	rlwimi	26,9,24,16,23
278	mr	10,27
279	rotlwi	27,27,8
280	rlwimi	27,10,24,0,7
281	rlwimi	27,10,24,16,23
282	mr	7,28
283	rotlwi	28,28,8
284	rlwimi	28,7,24,0,7
285	rlwimi	28,7,24,16,23
286	mr	8,29
287	rotlwi	29,29,8
288	rlwimi	29,8,24,0,7
289	rlwimi	29,8,24,16,23
290	mr	9,30
291	rotlwi	30,30,8
292	rlwimi	30,9,24,0,7
293	rlwimi	30,9,24,16,23
294	mr	10,31
295	rotlwi	31,31,8
296	rlwimi	31,10,24,0,7
297	rlwimi	31,10,24,16,23
298	bne	.Ltail
299
300	lwz	7,0(4)
301	lwz	8,4(4)
302	cmpldi	5,0
303	lwz	9,8(4)
304	lwz	10,12(4)
305	xor	16,16,7
306	lwz	7,16(4)
307	xor	17,17,8
308	lwz	8,20(4)
309	xor	18,18,9
310	lwz	9,24(4)
311	xor	19,19,10
312	lwz	10,28(4)
313	xor	20,20,7
314	lwz	7,32(4)
315	xor	21,21,8
316	lwz	8,36(4)
317	xor	22,22,9
318	lwz	9,40(4)
319	xor	23,23,10
320	lwz	10,44(4)
321	xor	24,24,7
322	lwz	7,48(4)
323	xor	25,25,8
324	lwz	8,52(4)
325	xor	26,26,9
326	lwz	9,56(4)
327	xor	27,27,10
328	lwz	10,60(4)
329	xor	28,28,7
330	stw	16,0(3)
331	xor	29,29,8
332	stw	17,4(3)
333	xor	30,30,9
334	stw	18,8(3)
335	xor	31,31,10
336	stw	19,12(3)
337	stw	20,16(3)
338	stw	21,20(3)
339	stw	22,24(3)
340	stw	23,28(3)
341	stw	24,32(3)
342	stw	25,36(3)
343	stw	26,40(3)
344	stw	27,44(3)
345	stw	28,48(3)
346	stw	29,52(3)
347	stw	30,56(3)
348	addi	4,4,64
349	stw	31,60(3)
350	addi	3,3,64
351
352	bne	.Loop_outer
353
354	blr
355
356.align	4
357.Ltail:
358	addi	5,5,64
359	subi	4,4,1
360	subi	3,3,1
361	addi	7,1,48-1
362	mtctr	5
363
364	stw	16,48(1)
365	stw	17,52(1)
366	stw	18,56(1)
367	stw	19,60(1)
368	stw	20,64(1)
369	stw	21,68(1)
370	stw	22,72(1)
371	stw	23,76(1)
372	stw	24,80(1)
373	stw	25,84(1)
374	stw	26,88(1)
375	stw	27,92(1)
376	stw	28,96(1)
377	stw	29,100(1)
378	stw	30,104(1)
379	stw	31,108(1)
380
381.Loop_tail:
382	lbzu	11,1(4)
383	lbzu	16,1(7)
384	xor	12,11,16
385	stbu	12,1(3)
386	bdnz	.Loop_tail
387
388	stw	1,48(1)
389	stw	1,52(1)
390	stw	1,56(1)
391	stw	1,60(1)
392	stw	1,64(1)
393	stw	1,68(1)
394	stw	1,72(1)
395	stw	1,76(1)
396	stw	1,80(1)
397	stw	1,84(1)
398	stw	1,88(1)
399	stw	1,92(1)
400	stw	1,96(1)
401	stw	1,100(1)
402	stw	1,104(1)
403	stw	1,108(1)
404
405	blr
406.long	0
407.byte	0,12,0x14,0,0,0,0,0
408
409.globl	ChaCha20_ctr32_vmx
410.type	ChaCha20_ctr32_vmx,@function
411.align	5
412ChaCha20_ctr32_vmx:
413.localentry	ChaCha20_ctr32_vmx,0
414
415	cmpldi	5,256
416	blt	__ChaCha20_ctr32_int
417
418	stdu	1,-416(1)
419	mflr	0
420	li	10,127
421	li	11,143
422	li	12,-1
423	stvx	23,10,1
424	addi	10,10,32
425	stvx	24,11,1
426	addi	11,11,32
427	stvx	25,10,1
428	addi	10,10,32
429	stvx	26,11,1
430	addi	11,11,32
431	stvx	27,10,1
432	addi	10,10,32
433	stvx	28,11,1
434	addi	11,11,32
435	stvx	29,10,1
436	addi	10,10,32
437	stvx	30,11,1
438	stvx	31,10,1
439	stw	12,268(1)
440	std	14,272(1)
441	std	15,280(1)
442	std	16,288(1)
443	std	17,296(1)
444	std	18,304(1)
445	std	19,312(1)
446	std	20,320(1)
447	std	21,328(1)
448	std	22,336(1)
449	std	23,344(1)
450	std	24,352(1)
451	std	25,360(1)
452	std	26,368(1)
453	std	27,376(1)
454	std	28,384(1)
455	std	29,392(1)
456	std	30,400(1)
457	std	31,408(1)
458	li	12,-4096+511
459	std	0, 432(1)
460	or	12,12,12
461
462	bl	.Lconsts
463	li	16,16
464	li	17,32
465	li	18,48
466	li	19,64
467	li	20,31
468	li	21,15
469
470	lvx	13,0,6
471	lvsl	29,0,6
472	lvx	14,16,6
473	lvx	27,20,6
474
475	lvx	15,0,7
476	lvsl	30,0,7
477	lvx	28,21,7
478
479	lvx	12,0,12
480	lvx	17,16,12
481	lvx	18,17,12
482	lvx	19,18,12
483	lvx	23,19,12
484
485	vperm	13,13,14,29
486	vperm	14,14,27,29
487	vperm	15,15,28,30
488
489	lwz	11,0(7)
490	lwz	12,4(7)
491	vadduwm	15,15,17
492	lwz	14,8(7)
493	vadduwm	16,15,17
494	lwz	15,12(7)
495	vadduwm	17,16,17
496
497	vxor	29,29,29
498	vspltisw	26,-1
499	lvsl	24,0,4
500	lvsr	25,0,3
501	vperm	26,29,26,25
502
503	lvsl	29,0,16
504	vspltisb	30,3
505	vxor	29,29,30
506	vxor	25,25,30
507	vperm	24,24,24,29
508
509	li	0,10
510	b	.Loop_outer_vmx
511
512.align	4
513.Loop_outer_vmx:
514	lis	16,0x6170
515	lis	17,0x3320
516	vor	0,12,12
517	lis	18,0x7962
518	lis	19,0x6b20
519	vor	4,12,12
520	ori	16,16,0x7865
521	ori	17,17,0x646e
522	vor	8,12,12
523	ori	18,18,0x2d32
524	ori	19,19,0x6574
525	vor	1,13,13
526
527	lwz	20,0(6)
528	vor	5,13,13
529	lwz	21,4(6)
530	vor	9,13,13
531	lwz	22,8(6)
532	vor	2,14,14
533	lwz	23,12(6)
534	vor	6,14,14
535	lwz	24,16(6)
536	vor	10,14,14
537	mr	28,11
538	lwz	25,20(6)
539	vor	3,15,15
540	mr	29,12
541	lwz	26,24(6)
542	vor	7,16,16
543	mr	30,14
544	lwz	27,28(6)
545	vor	11,17,17
546	mr	31,15
547
548	mr	7,20
549	mr	8,21
550	mr	9,22
551	mr	10,23
552
553	vspltisw	27,12
554	vspltisw	28,7
555
556	mtctr	0
557	nop
558.Loop_vmx:
559	vadduwm	0,0,1
560	vadduwm	4,4,5
561	vadduwm	8,8,9
562	add	16,16,20
563	add	17,17,21
564	add	18,18,22
565	vxor	3,3,0
566	vxor	7,7,4
567	vxor	11,11,8
568	add	19,19,23
569	xor	28,28,16
570	xor	29,29,17
571	vperm	3,3,3,19
572	vperm	7,7,7,19
573	vperm	11,11,11,19
574	xor	30,30,18
575	xor	31,31,19
576	rotlwi	28,28,16
577	vadduwm	2,2,3
578	vadduwm	6,6,7
579	vadduwm	10,10,11
580	rotlwi	29,29,16
581	rotlwi	30,30,16
582	rotlwi	31,31,16
583	vxor	1,1,2
584	vxor	5,5,6
585	vxor	9,9,10
586	add	24,24,28
587	add	25,25,29
588	add	26,26,30
589	vrlw	1,1,27
590	vrlw	5,5,27
591	vrlw	9,9,27
592	add	27,27,31
593	xor	20,20,24
594	xor	21,21,25
595	vadduwm	0,0,1
596	vadduwm	4,4,5
597	vadduwm	8,8,9
598	xor	22,22,26
599	xor	23,23,27
600	rotlwi	20,20,12
601	vxor	3,3,0
602	vxor	7,7,4
603	vxor	11,11,8
604	rotlwi	21,21,12
605	rotlwi	22,22,12
606	rotlwi	23,23,12
607	vperm	3,3,3,23
608	vperm	7,7,7,23
609	vperm	11,11,11,23
610	add	16,16,20
611	add	17,17,21
612	add	18,18,22
613	vadduwm	2,2,3
614	vadduwm	6,6,7
615	vadduwm	10,10,11
616	add	19,19,23
617	xor	28,28,16
618	xor	29,29,17
619	vxor	1,1,2
620	vxor	5,5,6
621	vxor	9,9,10
622	xor	30,30,18
623	xor	31,31,19
624	rotlwi	28,28,8
625	vrlw	1,1,28
626	vrlw	5,5,28
627	vrlw	9,9,28
628	rotlwi	29,29,8
629	rotlwi	30,30,8
630	rotlwi	31,31,8
631	vsldoi	2,2,2, 16-8
632	vsldoi	6,6,6, 16-8
633	vsldoi	10,10,10, 16-8
634	add	24,24,28
635	add	25,25,29
636	add	26,26,30
637	vsldoi	1,1,1, 16-12
638	vsldoi	5,5,5, 16-12
639	vsldoi	9,9,9, 16-12
640	add	27,27,31
641	xor	20,20,24
642	xor	21,21,25
643	vsldoi	3,3,3, 16-4
644	vsldoi	7,7,7, 16-4
645	vsldoi	11,11,11, 16-4
646	xor	22,22,26
647	xor	23,23,27
648	rotlwi	20,20,7
649	rotlwi	21,21,7
650	rotlwi	22,22,7
651	rotlwi	23,23,7
652	vadduwm	0,0,1
653	vadduwm	4,4,5
654	vadduwm	8,8,9
655	add	16,16,21
656	add	17,17,22
657	add	18,18,23
658	vxor	3,3,0
659	vxor	7,7,4
660	vxor	11,11,8
661	add	19,19,20
662	xor	31,31,16
663	xor	28,28,17
664	vperm	3,3,3,19
665	vperm	7,7,7,19
666	vperm	11,11,11,19
667	xor	29,29,18
668	xor	30,30,19
669	rotlwi	31,31,16
670	vadduwm	2,2,3
671	vadduwm	6,6,7
672	vadduwm	10,10,11
673	rotlwi	28,28,16
674	rotlwi	29,29,16
675	rotlwi	30,30,16
676	vxor	1,1,2
677	vxor	5,5,6
678	vxor	9,9,10
679	add	26,26,31
680	add	27,27,28
681	add	24,24,29
682	vrlw	1,1,27
683	vrlw	5,5,27
684	vrlw	9,9,27
685	add	25,25,30
686	xor	21,21,26
687	xor	22,22,27
688	vadduwm	0,0,1
689	vadduwm	4,4,5
690	vadduwm	8,8,9
691	xor	23,23,24
692	xor	20,20,25
693	rotlwi	21,21,12
694	vxor	3,3,0
695	vxor	7,7,4
696	vxor	11,11,8
697	rotlwi	22,22,12
698	rotlwi	23,23,12
699	rotlwi	20,20,12
700	vperm	3,3,3,23
701	vperm	7,7,7,23
702	vperm	11,11,11,23
703	add	16,16,21
704	add	17,17,22
705	add	18,18,23
706	vadduwm	2,2,3
707	vadduwm	6,6,7
708	vadduwm	10,10,11
709	add	19,19,20
710	xor	31,31,16
711	xor	28,28,17
712	vxor	1,1,2
713	vxor	5,5,6
714	vxor	9,9,10
715	xor	29,29,18
716	xor	30,30,19
717	rotlwi	31,31,8
718	vrlw	1,1,28
719	vrlw	5,5,28
720	vrlw	9,9,28
721	rotlwi	28,28,8
722	rotlwi	29,29,8
723	rotlwi	30,30,8
724	vsldoi	2,2,2, 16-8
725	vsldoi	6,6,6, 16-8
726	vsldoi	10,10,10, 16-8
727	add	26,26,31
728	add	27,27,28
729	add	24,24,29
730	vsldoi	1,1,1, 16-4
731	vsldoi	5,5,5, 16-4
732	vsldoi	9,9,9, 16-4
733	add	25,25,30
734	xor	21,21,26
735	xor	22,22,27
736	vsldoi	3,3,3, 16-12
737	vsldoi	7,7,7, 16-12
738	vsldoi	11,11,11, 16-12
739	xor	23,23,24
740	xor	20,20,25
741	rotlwi	21,21,7
742	rotlwi	22,22,7
743	rotlwi	23,23,7
744	rotlwi	20,20,7
745	bdnz	.Loop_vmx
746
747	subi	5,5,256
748	addi	16,16,0x7865
749	addi	17,17,0x646e
750	addi	18,18,0x2d32
751	addi	19,19,0x6574
752	addis	16,16,0x6170
753	addis	17,17,0x3320
754	addis	18,18,0x7962
755	addis	19,19,0x6b20
756	add	20,20,7
757	lwz	7,16(6)
758	add	21,21,8
759	lwz	8,20(6)
760	add	22,22,9
761	lwz	9,24(6)
762	add	23,23,10
763	lwz	10,28(6)
764	add	24,24,7
765	add	25,25,8
766	add	26,26,9
767	add	27,27,10
768	add	28,28,11
769	add	29,29,12
770	add	30,30,14
771	add	31,31,15
772
773	vadduwm	0,0,12
774	vadduwm	4,4,12
775	vadduwm	8,8,12
776	vadduwm	1,1,13
777	vadduwm	5,5,13
778	vadduwm	9,9,13
779	vadduwm	2,2,14
780	vadduwm	6,6,14
781	vadduwm	10,10,14
782	vadduwm	3,3,15
783	vadduwm	7,7,16
784	vadduwm	11,11,17
785
786	addi	11,11,4
787	vadduwm	15,15,18
788	vadduwm	16,16,18
789	vadduwm	17,17,18
790
791	mr	7,16
792	rotlwi	16,16,8
793	rlwimi	16,7,24,0,7
794	rlwimi	16,7,24,16,23
795	mr	8,17
796	rotlwi	17,17,8
797	rlwimi	17,8,24,0,7
798	rlwimi	17,8,24,16,23
799	mr	9,18
800	rotlwi	18,18,8
801	rlwimi	18,9,24,0,7
802	rlwimi	18,9,24,16,23
803	mr	10,19
804	rotlwi	19,19,8
805	rlwimi	19,10,24,0,7
806	rlwimi	19,10,24,16,23
807	mr	7,20
808	rotlwi	20,20,8
809	rlwimi	20,7,24,0,7
810	rlwimi	20,7,24,16,23
811	mr	8,21
812	rotlwi	21,21,8
813	rlwimi	21,8,24,0,7
814	rlwimi	21,8,24,16,23
815	mr	9,22
816	rotlwi	22,22,8
817	rlwimi	22,9,24,0,7
818	rlwimi	22,9,24,16,23
819	mr	10,23
820	rotlwi	23,23,8
821	rlwimi	23,10,24,0,7
822	rlwimi	23,10,24,16,23
823	mr	7,24
824	rotlwi	24,24,8
825	rlwimi	24,7,24,0,7
826	rlwimi	24,7,24,16,23
827	mr	8,25
828	rotlwi	25,25,8
829	rlwimi	25,8,24,0,7
830	rlwimi	25,8,24,16,23
831	mr	9,26
832	rotlwi	26,26,8
833	rlwimi	26,9,24,0,7
834	rlwimi	26,9,24,16,23
835	mr	10,27
836	rotlwi	27,27,8
837	rlwimi	27,10,24,0,7
838	rlwimi	27,10,24,16,23
839	mr	7,28
840	rotlwi	28,28,8
841	rlwimi	28,7,24,0,7
842	rlwimi	28,7,24,16,23
843	mr	8,29
844	rotlwi	29,29,8
845	rlwimi	29,8,24,0,7
846	rlwimi	29,8,24,16,23
847	mr	9,30
848	rotlwi	30,30,8
849	rlwimi	30,9,24,0,7
850	rlwimi	30,9,24,16,23
851	mr	10,31
852	rotlwi	31,31,8
853	rlwimi	31,10,24,0,7
854	rlwimi	31,10,24,16,23
855	lwz	7,0(4)
856	lwz	8,4(4)
857	lwz	9,8(4)
858	lwz	10,12(4)
859	xor	16,16,7
860	lwz	7,16(4)
861	xor	17,17,8
862	lwz	8,20(4)
863	xor	18,18,9
864	lwz	9,24(4)
865	xor	19,19,10
866	lwz	10,28(4)
867	xor	20,20,7
868	lwz	7,32(4)
869	xor	21,21,8
870	lwz	8,36(4)
871	xor	22,22,9
872	lwz	9,40(4)
873	xor	23,23,10
874	lwz	10,44(4)
875	xor	24,24,7
876	lwz	7,48(4)
877	xor	25,25,8
878	lwz	8,52(4)
879	xor	26,26,9
880	lwz	9,56(4)
881	xor	27,27,10
882	lwz	10,60(4)
883	xor	28,28,7
884	stw	16,0(3)
885	xor	29,29,8
886	stw	17,4(3)
887	xor	30,30,9
888	stw	18,8(3)
889	xor	31,31,10
890	stw	19,12(3)
891	addi	4,4,64
892	stw	20,16(3)
893	li	7,16
894	stw	21,20(3)
895	li	8,32
896	stw	22,24(3)
897	li	9,48
898	stw	23,28(3)
899	li	10,64
900	stw	24,32(3)
901	stw	25,36(3)
902	stw	26,40(3)
903	stw	27,44(3)
904	stw	28,48(3)
905	stw	29,52(3)
906	stw	30,56(3)
907	stw	31,60(3)
908	addi	3,3,64
909
910	lvx	27,0,4
911	lvx	28,7,4
912	lvx	29,8,4
913	lvx	30,9,4
914	lvx	31,10,4
915	addi	4,4,64
916
917	vperm	27,27,28,24
918	vperm	28,28,29,24
919	vperm	29,29,30,24
920	vperm	30,30,31,24
921	vxor	0,0,27
922	vxor	1,1,28
923	lvx	28,7,4
924	vxor	2,2,29
925	lvx	29,8,4
926	vxor	3,3,30
927	lvx	30,9,4
928	lvx	27,10,4
929	addi	4,4,64
930	li	10,63
931	vperm	0,0,0,25
932	vperm	1,1,1,25
933	vperm	2,2,2,25
934	vperm	3,3,3,25
935
936	vperm	31,31,28,24
937	vperm	28,28,29,24
938	vperm	29,29,30,24
939	vperm	30,30,27,24
940	vxor	4,4,31
941	vxor	5,5,28
942	lvx	28,7,4
943	vxor	6,6,29
944	lvx	29,8,4
945	vxor	7,7,30
946	lvx	30,9,4
947	lvx	31,10,4
948	addi	4,4,64
949	vperm	4,4,4,25
950	vperm	5,5,5,25
951	vperm	6,6,6,25
952	vperm	7,7,7,25
953
954	vperm	27,27,28,24
955	vperm	28,28,29,24
956	vperm	29,29,30,24
957	vperm	30,30,31,24
958	vxor	8,8,27
959	vxor	9,9,28
960	vxor	10,10,29
961	vxor	11,11,30
962	vperm	8,8,8,25
963	vperm	9,9,9,25
964	vperm	10,10,10,25
965	vperm	11,11,11,25
966
967	andi.	17,3,15
968	mr	16,3
969
970	vsel	27,0,1,26
971	vsel	28,1,2,26
972	vsel	29,2,3,26
973	vsel	30,3,4,26
974	vsel	1,4,5,26
975	vsel	2,5,6,26
976	vsel	3,6,7,26
977	vsel	4,7,8,26
978	vsel	5,8,9,26
979	vsel	6,9,10,26
980	vsel	7,10,11,26
981
982
983	stvx	27,7,3
984	stvx	28,8,3
985	stvx	29,9,3
986	addi	3,3,64
987	stvx	30,0,3
988	stvx	1,7,3
989	stvx	2,8,3
990	stvx	3,9,3
991	addi	3,3,64
992	stvx	4,0,3
993	stvx	5,7,3
994	stvx	6,8,3
995	stvx	7,9,3
996	addi	3,3,64
997
998	beq	.Laligned_vmx
999
1000	sub	18,3,17
1001	li	19,0
1002.Lunaligned_tail_vmx:
1003	stvebx	11,19,18
1004	addi	19,19,1
1005	cmpw	19,17
1006	bne	.Lunaligned_tail_vmx
1007
1008	sub	18,16,17
1009.Lunaligned_head_vmx:
1010	stvebx	0,17,18
1011	cmpwi	17,15
1012	addi	17,17,1
1013	bne	.Lunaligned_head_vmx
1014
1015	cmpldi	5,255
1016	bgt	.Loop_outer_vmx
1017
1018	b	.Ldone_vmx
1019
1020.align	4
1021.Laligned_vmx:
1022	stvx	0,0,16
1023
1024	cmpldi	5,255
1025	bgt	.Loop_outer_vmx
1026	nop
1027
1028.Ldone_vmx:
1029	cmpldi	5,0
1030	bnel	__ChaCha20_1x
1031
1032	lwz	12,268(1)
1033	li	10,127
1034	li	11,143
1035	or	12,12,12
1036	lvx	23,10,1
1037	addi	10,10,32
1038	lvx	24,11,1
1039	addi	11,11,32
1040	lvx	25,10,1
1041	addi	10,10,32
1042	lvx	26,11,1
1043	addi	11,11,32
1044	lvx	27,10,1
1045	addi	10,10,32
1046	lvx	28,11,1
1047	addi	11,11,32
1048	lvx	29,10,1
1049	addi	10,10,32
1050	lvx	30,11,1
1051	lvx	31,10,1
1052	ld	0, 432(1)
1053	ld	14,272(1)
1054	ld	15,280(1)
1055	ld	16,288(1)
1056	ld	17,296(1)
1057	ld	18,304(1)
1058	ld	19,312(1)
1059	ld	20,320(1)
1060	ld	21,328(1)
1061	ld	22,336(1)
1062	ld	23,344(1)
1063	ld	24,352(1)
1064	ld	25,360(1)
1065	ld	26,368(1)
1066	ld	27,376(1)
1067	ld	28,384(1)
1068	ld	29,392(1)
1069	ld	30,400(1)
1070	ld	31,408(1)
1071	mtlr	0
1072	addi	1,1,416
1073	blr
1074.long	0
1075.byte	0,12,0x04,1,0x80,18,5,0
1076.long	0
1077.size	ChaCha20_ctr32_vmx,.-ChaCha20_ctr32_vmx
1078
1079.globl	ChaCha20_ctr32_vsx
1080.type	ChaCha20_ctr32_vsx,@function
1081.align	5
1082ChaCha20_ctr32_vsx:
1083.localentry	ChaCha20_ctr32_vsx,0
1084
1085	stdu	1,-224(1)
1086	mflr	0
1087	li	10,127
1088	li	11,143
1089	li	12,-1
1090	stvx	26,10,1
1091	addi	10,10,32
1092	stvx	27,11,1
1093	addi	11,11,32
1094	stvx	28,10,1
1095	addi	10,10,32
1096	stvx	29,11,1
1097	addi	11,11,32
1098	stvx	30,10,1
1099	stvx	31,11,1
1100	stw	12,220(1)
1101	li	12,-4096+63
1102	std	0, 240(1)
1103	or	12,12,12
1104
1105	bl	.Lconsts
1106	.long	0x7E006619
1107	addi	12,12,0x50
1108	li	8,16
1109	li	9,32
1110	li	10,48
1111	li	11,64
1112
1113	.long	0x7E203619
1114	.long	0x7E483619
1115	.long	0x7E603E19
1116
1117	vxor	27,27,27
1118	.long	0x7F8B6619
1119	vspltw	26,19,0
1120	vsldoi	19,19,27,4
1121	vsldoi	19,27,19,12
1122	vadduwm	26,26,28
1123
1124	lvsl	31,0,8
1125	vspltisb	27,3
1126	vxor	31,31,27
1127
1128	li	0,10
1129	mtctr	0
1130	b	.Loop_outer_vsx
1131
1132.align	5
1133.Loop_outer_vsx:
1134	lvx	0,0,12
1135	lvx	1,8,12
1136	lvx	2,9,12
1137	lvx	3,10,12
1138
1139	vspltw	4,17,0
1140	vspltw	5,17,1
1141	vspltw	6,17,2
1142	vspltw	7,17,3
1143
1144	vspltw	8,18,0
1145	vspltw	9,18,1
1146	vspltw	10,18,2
1147	vspltw	11,18,3
1148
1149	vor	12,26,26
1150	vspltw	13,19,1
1151	vspltw	14,19,2
1152	vspltw	15,19,3
1153
1154	vspltisw	27,-16
1155	vspltisw	28,12
1156	vspltisw	29,8
1157	vspltisw	30,7
1158
1159.Loop_vsx:
1160	vadduwm	0,0,4
1161	vadduwm	1,1,5
1162	vadduwm	2,2,6
1163	vadduwm	3,3,7
1164	vxor	12,12,0
1165	vxor	13,13,1
1166	vxor	14,14,2
1167	vxor	15,15,3
1168	vrlw	12,12,27
1169	vrlw	13,13,27
1170	vrlw	14,14,27
1171	vrlw	15,15,27
1172	vadduwm	8,8,12
1173	vadduwm	9,9,13
1174	vadduwm	10,10,14
1175	vadduwm	11,11,15
1176	vxor	4,4,8
1177	vxor	5,5,9
1178	vxor	6,6,10
1179	vxor	7,7,11
1180	vrlw	4,4,28
1181	vrlw	5,5,28
1182	vrlw	6,6,28
1183	vrlw	7,7,28
1184	vadduwm	0,0,4
1185	vadduwm	1,1,5
1186	vadduwm	2,2,6
1187	vadduwm	3,3,7
1188	vxor	12,12,0
1189	vxor	13,13,1
1190	vxor	14,14,2
1191	vxor	15,15,3
1192	vrlw	12,12,29
1193	vrlw	13,13,29
1194	vrlw	14,14,29
1195	vrlw	15,15,29
1196	vadduwm	8,8,12
1197	vadduwm	9,9,13
1198	vadduwm	10,10,14
1199	vadduwm	11,11,15
1200	vxor	4,4,8
1201	vxor	5,5,9
1202	vxor	6,6,10
1203	vxor	7,7,11
1204	vrlw	4,4,30
1205	vrlw	5,5,30
1206	vrlw	6,6,30
1207	vrlw	7,7,30
1208	vadduwm	0,0,5
1209	vadduwm	1,1,6
1210	vadduwm	2,2,7
1211	vadduwm	3,3,4
1212	vxor	15,15,0
1213	vxor	12,12,1
1214	vxor	13,13,2
1215	vxor	14,14,3
1216	vrlw	15,15,27
1217	vrlw	12,12,27
1218	vrlw	13,13,27
1219	vrlw	14,14,27
1220	vadduwm	10,10,15
1221	vadduwm	11,11,12
1222	vadduwm	8,8,13
1223	vadduwm	9,9,14
1224	vxor	5,5,10
1225	vxor	6,6,11
1226	vxor	7,7,8
1227	vxor	4,4,9
1228	vrlw	5,5,28
1229	vrlw	6,6,28
1230	vrlw	7,7,28
1231	vrlw	4,4,28
1232	vadduwm	0,0,5
1233	vadduwm	1,1,6
1234	vadduwm	2,2,7
1235	vadduwm	3,3,4
1236	vxor	15,15,0
1237	vxor	12,12,1
1238	vxor	13,13,2
1239	vxor	14,14,3
1240	vrlw	15,15,29
1241	vrlw	12,12,29
1242	vrlw	13,13,29
1243	vrlw	14,14,29
1244	vadduwm	10,10,15
1245	vadduwm	11,11,12
1246	vadduwm	8,8,13
1247	vadduwm	9,9,14
1248	vxor	5,5,10
1249	vxor	6,6,11
1250	vxor	7,7,8
1251	vxor	4,4,9
1252	vrlw	5,5,30
1253	vrlw	6,6,30
1254	vrlw	7,7,30
1255	vrlw	4,4,30
1256	bdnz	.Loop_vsx
1257
1258	vadduwm	12,12,26
1259
1260	.long	0x13600F8C
1261	.long	0x13821F8C
1262	.long	0x10000E8C
1263	.long	0x10421E8C
1264	.long	0x13A42F8C
1265	.long	0x13C63F8C
1266	.long	0xF0201057
1267	.long	0xF0601357
1268	.long	0xF01BE057
1269	.long	0xF05BE357
1270
1271	.long	0x10842E8C
1272	.long	0x10C63E8C
1273	.long	0x13684F8C
1274	.long	0x138A5F8C
1275	.long	0xF0A43057
1276	.long	0xF0E43357
1277	.long	0xF09DF057
1278	.long	0xF0DDF357
1279
1280	.long	0x11084E8C
1281	.long	0x114A5E8C
1282	.long	0x13AC6F8C
1283	.long	0x13CE7F8C
1284	.long	0xF1285057
1285	.long	0xF1685357
1286	.long	0xF11BE057
1287	.long	0xF15BE357
1288
1289	.long	0x118C6E8C
1290	.long	0x11CE7E8C
1291	vspltisw	27,4
1292	vadduwm	26,26,27
1293	.long	0xF1AC7057
1294	.long	0xF1EC7357
1295	.long	0xF19DF057
1296	.long	0xF1DDF357
1297
1298	vadduwm	0,0,16
1299	vadduwm	4,4,17
1300	vadduwm	8,8,18
1301	vadduwm	12,12,19
1302
1303	vperm	0,0,0,31
1304	vperm	4,4,4,31
1305	vperm	8,8,8,31
1306	vperm	12,12,12,31
1307
1308	cmpldi	5,0x40
1309	blt	.Ltail_vsx
1310
1311	.long	0x7F602619
1312	.long	0x7F882619
1313	.long	0x7FA92619
1314	.long	0x7FCA2619
1315
1316	vxor	27,27,0
1317	vxor	28,28,4
1318	vxor	29,29,8
1319	vxor	30,30,12
1320
1321	.long	0x7F601F19
1322	.long	0x7F881F19
1323	addi	4,4,0x40
1324	.long	0x7FA91F19
1325	subi	5,5,0x40
1326	.long	0x7FCA1F19
1327	addi	3,3,0x40
1328	beq	.Ldone_vsx
1329
1330	vadduwm	0,1,16
1331	vadduwm	4,5,17
1332	vadduwm	8,9,18
1333	vadduwm	12,13,19
1334
1335	vperm	0,0,0,31
1336	vperm	4,4,4,31
1337	vperm	8,8,8,31
1338	vperm	12,12,12,31
1339
1340	cmpldi	5,0x40
1341	blt	.Ltail_vsx
1342
1343	.long	0x7F602619
1344	.long	0x7F882619
1345	.long	0x7FA92619
1346	.long	0x7FCA2619
1347
1348	vxor	27,27,0
1349	vxor	28,28,4
1350	vxor	29,29,8
1351	vxor	30,30,12
1352
1353	.long	0x7F601F19
1354	.long	0x7F881F19
1355	addi	4,4,0x40
1356	.long	0x7FA91F19
1357	subi	5,5,0x40
1358	.long	0x7FCA1F19
1359	addi	3,3,0x40
1360	beq	.Ldone_vsx
1361
1362	vadduwm	0,2,16
1363	vadduwm	4,6,17
1364	vadduwm	8,10,18
1365	vadduwm	12,14,19
1366
1367	vperm	0,0,0,31
1368	vperm	4,4,4,31
1369	vperm	8,8,8,31
1370	vperm	12,12,12,31
1371
1372	cmpldi	5,0x40
1373	blt	.Ltail_vsx
1374
1375	.long	0x7F602619
1376	.long	0x7F882619
1377	.long	0x7FA92619
1378	.long	0x7FCA2619
1379
1380	vxor	27,27,0
1381	vxor	28,28,4
1382	vxor	29,29,8
1383	vxor	30,30,12
1384
1385	.long	0x7F601F19
1386	.long	0x7F881F19
1387	addi	4,4,0x40
1388	.long	0x7FA91F19
1389	subi	5,5,0x40
1390	.long	0x7FCA1F19
1391	addi	3,3,0x40
1392	beq	.Ldone_vsx
1393
1394	vadduwm	0,3,16
1395	vadduwm	4,7,17
1396	vadduwm	8,11,18
1397	vadduwm	12,15,19
1398
1399	vperm	0,0,0,31
1400	vperm	4,4,4,31
1401	vperm	8,8,8,31
1402	vperm	12,12,12,31
1403
1404	cmpldi	5,0x40
1405	blt	.Ltail_vsx
1406
1407	.long	0x7F602619
1408	.long	0x7F882619
1409	.long	0x7FA92619
1410	.long	0x7FCA2619
1411
1412	vxor	27,27,0
1413	vxor	28,28,4
1414	vxor	29,29,8
1415	vxor	30,30,12
1416
1417	.long	0x7F601F19
1418	.long	0x7F881F19
1419	addi	4,4,0x40
1420	.long	0x7FA91F19
1421	subi	5,5,0x40
1422	.long	0x7FCA1F19
1423	addi	3,3,0x40
1424	mtctr	0
1425	bne	.Loop_outer_vsx
1426
1427.Ldone_vsx:
1428	lwz	12,220(1)
1429	li	10,127
1430	li	11,143
1431	ld	0, 240(1)
1432	or	12,12,12
1433	lvx	26,10,1
1434	addi	10,10,32
1435	lvx	27,11,1
1436	addi	11,11,32
1437	lvx	28,10,1
1438	addi	10,10,32
1439	lvx	29,11,1
1440	addi	11,11,32
1441	lvx	30,10,1
1442	lvx	31,11,1
1443	mtlr	0
1444	addi	1,1,224
1445	blr
1446
1447.align	4
1448.Ltail_vsx:
1449	addi	11,1,48
1450	mtctr	5
1451	.long	0x7C005F19
1452	.long	0x7C885F19
1453	.long	0x7D095F19
1454	.long	0x7D8A5F19
1455	subi	12,11,1
1456	subi	4,4,1
1457	subi	3,3,1
1458
1459.Loop_tail_vsx:
1460	lbzu	6,1(12)
1461	lbzu	7,1(4)
1462	xor	6,6,7
1463	stbu	6,1(3)
1464	bdnz	.Loop_tail_vsx
1465
1466	.long	0x7E005F19
1467	.long	0x7E085F19
1468	.long	0x7E095F19
1469	.long	0x7E0A5F19
1470
1471	b	.Ldone_vsx
1472.long	0
1473.byte	0,12,0x04,1,0x80,0,5,0
1474.long	0
1475.size	ChaCha20_ctr32_vsx,.-ChaCha20_ctr32_vsx
1476.align	5
1477.Lconsts:
1478	mflr	0
1479	bcl	20,31,$+4
1480	mflr	12
1481	addi	12,12,56
1482	mtlr	0
1483	blr
1484.long	0
1485.byte	0,12,0x14,0,0,0,0,0
1486.space	28
1487.Lsigma:
1488.long	0x61707865,0x3320646e,0x79622d32,0x6b206574
1489.long	1,0,0,0
1490.long	4,0,0,0
1491.long	0x02030001,0x06070405,0x0a0b0809,0x0e0f0c0d
1492.long	0x01020300,0x05060704,0x090a0b08,0x0d0e0f0c
1493.long	0x61707865,0x61707865,0x61707865,0x61707865
1494.long	0x3320646e,0x3320646e,0x3320646e,0x3320646e
1495.long	0x79622d32,0x79622d32,0x79622d32,0x79622d32
1496.long	0x6b206574,0x6b206574,0x6b206574,0x6b206574
1497.long	0,1,2,3
1498.byte	67,104,97,67,104,97,50,48,32,102,111,114,32,80,111,119,101,114,80,67,47,65,108,116,105,86,101,99,44,67,82,89,80,84,79,71,65,77,83,32,98,121,32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46,111,114,103,62,0
1499.align	2
1500.align	2
1501