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