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