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