xref: /freebsd/sys/crypto/openssl/powerpc64le/aesp8-ppc.S (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1/* Do not modify. This file is auto-generated from aesp8-ppc.pl. */
2.machine	"any"
3
4.abiversion	2
5.text
6
7.align	7
8rcon:
9.byte	0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01
10.byte	0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b,0x00,0x00,0x00,0x1b
11.byte	0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d,0x0c,0x0f,0x0e,0x0d
12.byte	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
13.long	0x0f102132, 0x43546576, 0x8798a9ba, 0xcbdcedfe
14.Lconsts:
15	mflr	0
16	bcl	20,31,$+4
17	mflr	6
18	addi	6,6,-0x58
19	mtlr	0
20	blr
21.long	0
22.byte	0,12,0x14,0,0,0,0,0
23.byte	65,69,83,32,102,111,114,32,80,111,119,101,114,73,83,65,32,50,46,48,55,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
24.align	2
25
26.globl	aes_p8_set_encrypt_key
27.type	aes_p8_set_encrypt_key,@function
28.align	5
29aes_p8_set_encrypt_key:
30.localentry	aes_p8_set_encrypt_key,0
31
32.Lset_encrypt_key:
33	mflr	11
34	std	11,16(1)
35
36	li	6,-1
37	cmpldi	3,0
38	beq-	.Lenc_key_abort
39	cmpldi	5,0
40	beq-	.Lenc_key_abort
41	li	6,-2
42	cmpwi	4,128
43	blt-	.Lenc_key_abort
44	cmpwi	4,256
45	bgt-	.Lenc_key_abort
46	andi.	0,4,0x3f
47	bne-	.Lenc_key_abort
48
49	lis	0,0xfff0
50	li	12,-1
51	or	0,0,0
52
53	bl	.Lconsts
54	mtlr	11
55
56	neg	9,3
57	lvx	1,0,3
58	addi	3,3,15
59	lvsr	3,0,9
60	li	8,0x20
61	cmpwi	4,192
62	lvx	2,0,3
63	vspltisb	5,0x0f
64	lvx	4,0,6
65	vxor	3,3,5
66	lvx	5,8,6
67	addi	6,6,0x10
68	vperm	1,1,2,3
69	li	7,8
70	vxor	0,0,0
71	mtctr	7
72
73	lvsl	8,0,5
74	vspltisb	9,-1
75	lvx	10,0,5
76	vperm	9,9,0,8
77
78	blt	.Loop128
79	addi	3,3,8
80	beq	.L192
81	addi	3,3,8
82	b	.L256
83
84.align	4
85.Loop128:
86	vperm	3,1,1,5
87	vsldoi	6,0,1,12
88	vperm	11,1,1,8
89	vsel	7,10,11,9
90	vor	10,11,11
91	.long	0x10632509
92	stvx	7,0,5
93	addi	5,5,16
94
95	vxor	1,1,6
96	vsldoi	6,0,6,12
97	vxor	1,1,6
98	vsldoi	6,0,6,12
99	vxor	1,1,6
100	vadduwm	4,4,4
101	vxor	1,1,3
102	bdnz	.Loop128
103
104	lvx	4,0,6
105
106	vperm	3,1,1,5
107	vsldoi	6,0,1,12
108	vperm	11,1,1,8
109	vsel	7,10,11,9
110	vor	10,11,11
111	.long	0x10632509
112	stvx	7,0,5
113	addi	5,5,16
114
115	vxor	1,1,6
116	vsldoi	6,0,6,12
117	vxor	1,1,6
118	vsldoi	6,0,6,12
119	vxor	1,1,6
120	vadduwm	4,4,4
121	vxor	1,1,3
122
123	vperm	3,1,1,5
124	vsldoi	6,0,1,12
125	vperm	11,1,1,8
126	vsel	7,10,11,9
127	vor	10,11,11
128	.long	0x10632509
129	stvx	7,0,5
130	addi	5,5,16
131
132	vxor	1,1,6
133	vsldoi	6,0,6,12
134	vxor	1,1,6
135	vsldoi	6,0,6,12
136	vxor	1,1,6
137	vxor	1,1,3
138	vperm	11,1,1,8
139	vsel	7,10,11,9
140	vor	10,11,11
141	stvx	7,0,5
142
143	addi	3,5,15
144	addi	5,5,0x50
145
146	li	8,10
147	b	.Ldone
148
149.align	4
150.L192:
151	lvx	6,0,3
152	li	7,4
153	vperm	11,1,1,8
154	vsel	7,10,11,9
155	vor	10,11,11
156	stvx	7,0,5
157	addi	5,5,16
158	vperm	2,2,6,3
159	vspltisb	3,8
160	mtctr	7
161	vsububm	5,5,3
162
163.Loop192:
164	vperm	3,2,2,5
165	vsldoi	6,0,1,12
166	.long	0x10632509
167
168	vxor	1,1,6
169	vsldoi	6,0,6,12
170	vxor	1,1,6
171	vsldoi	6,0,6,12
172	vxor	1,1,6
173
174	vsldoi	7,0,2,8
175	vspltw	6,1,3
176	vxor	6,6,2
177	vsldoi	2,0,2,12
178	vadduwm	4,4,4
179	vxor	2,2,6
180	vxor	1,1,3
181	vxor	2,2,3
182	vsldoi	7,7,1,8
183
184	vperm	3,2,2,5
185	vsldoi	6,0,1,12
186	vperm	11,7,7,8
187	vsel	7,10,11,9
188	vor	10,11,11
189	.long	0x10632509
190	stvx	7,0,5
191	addi	5,5,16
192
193	vsldoi	7,1,2,8
194	vxor	1,1,6
195	vsldoi	6,0,6,12
196	vperm	11,7,7,8
197	vsel	7,10,11,9
198	vor	10,11,11
199	vxor	1,1,6
200	vsldoi	6,0,6,12
201	vxor	1,1,6
202	stvx	7,0,5
203	addi	5,5,16
204
205	vspltw	6,1,3
206	vxor	6,6,2
207	vsldoi	2,0,2,12
208	vadduwm	4,4,4
209	vxor	2,2,6
210	vxor	1,1,3
211	vxor	2,2,3
212	vperm	11,1,1,8
213	vsel	7,10,11,9
214	vor	10,11,11
215	stvx	7,0,5
216	addi	3,5,15
217	addi	5,5,16
218	bdnz	.Loop192
219
220	li	8,12
221	addi	5,5,0x20
222	b	.Ldone
223
224.align	4
225.L256:
226	lvx	6,0,3
227	li	7,7
228	li	8,14
229	vperm	11,1,1,8
230	vsel	7,10,11,9
231	vor	10,11,11
232	stvx	7,0,5
233	addi	5,5,16
234	vperm	2,2,6,3
235	mtctr	7
236
237.Loop256:
238	vperm	3,2,2,5
239	vsldoi	6,0,1,12
240	vperm	11,2,2,8
241	vsel	7,10,11,9
242	vor	10,11,11
243	.long	0x10632509
244	stvx	7,0,5
245	addi	5,5,16
246
247	vxor	1,1,6
248	vsldoi	6,0,6,12
249	vxor	1,1,6
250	vsldoi	6,0,6,12
251	vxor	1,1,6
252	vadduwm	4,4,4
253	vxor	1,1,3
254	vperm	11,1,1,8
255	vsel	7,10,11,9
256	vor	10,11,11
257	stvx	7,0,5
258	addi	3,5,15
259	addi	5,5,16
260	bdz	.Ldone
261
262	vspltw	3,1,3
263	vsldoi	6,0,2,12
264	.long	0x106305C8
265
266	vxor	2,2,6
267	vsldoi	6,0,6,12
268	vxor	2,2,6
269	vsldoi	6,0,6,12
270	vxor	2,2,6
271
272	vxor	2,2,3
273	b	.Loop256
274
275.align	4
276.Ldone:
277	lvx	2,0,3
278	vsel	2,10,2,9
279	stvx	2,0,3
280	li	6,0
281	or	12,12,12
282	stw	8,0(5)
283
284.Lenc_key_abort:
285	mr	3,6
286	blr
287.long	0
288.byte	0,12,0x14,1,0,0,3,0
289.long	0
290.size	aes_p8_set_encrypt_key,.-aes_p8_set_encrypt_key
291
292.globl	aes_p8_set_decrypt_key
293.type	aes_p8_set_decrypt_key,@function
294.align	5
295aes_p8_set_decrypt_key:
296.localentry	aes_p8_set_decrypt_key,0
297
298	stdu	1,-64(1)
299	mflr	10
300	std	10,64+16(1)
301	bl	.Lset_encrypt_key
302	mtlr	10
303
304	cmpwi	3,0
305	bne-	.Ldec_key_abort
306
307	slwi	7,8,4
308	subi	3,5,240
309	srwi	8,8,1
310	add	5,3,7
311	mtctr	8
312
313.Ldeckey:
314	lwz	0, 0(3)
315	lwz	6, 4(3)
316	lwz	7, 8(3)
317	lwz	8, 12(3)
318	addi	3,3,16
319	lwz	9, 0(5)
320	lwz	10,4(5)
321	lwz	11,8(5)
322	lwz	12,12(5)
323	stw	0, 0(5)
324	stw	6, 4(5)
325	stw	7, 8(5)
326	stw	8, 12(5)
327	subi	5,5,16
328	stw	9, -16(3)
329	stw	10,-12(3)
330	stw	11,-8(3)
331	stw	12,-4(3)
332	bdnz	.Ldeckey
333
334	xor	3,3,3
335.Ldec_key_abort:
336	addi	1,1,64
337	blr
338.long	0
339.byte	0,12,4,1,0x80,0,3,0
340.long	0
341.size	aes_p8_set_decrypt_key,.-aes_p8_set_decrypt_key
342.globl	aes_p8_encrypt
343.type	aes_p8_encrypt,@function
344.align	5
345aes_p8_encrypt:
346.localentry	aes_p8_encrypt,0
347
348	lwz	6,240(5)
349	lis	0,0xfc00
350	li	12,-1
351	li	7,15
352	or	0,0,0
353
354	lvx	0,0,3
355	neg	11,4
356	lvx	1,7,3
357	lvsl	2,0,3
358	vspltisb	4,0x0f
359	lvsr	3,0,11
360	vxor	2,2,4
361	li	7,16
362	vperm	0,0,1,2
363	lvx	1,0,5
364	lvsr	5,0,5
365	srwi	6,6,1
366	lvx	2,7,5
367	addi	7,7,16
368	subi	6,6,1
369	vperm	1,2,1,5
370
371	vxor	0,0,1
372	lvx	1,7,5
373	addi	7,7,16
374	mtctr	6
375
376.Loop_enc:
377	vperm	2,1,2,5
378	.long	0x10001508
379	lvx	2,7,5
380	addi	7,7,16
381	vperm	1,2,1,5
382	.long	0x10000D08
383	lvx	1,7,5
384	addi	7,7,16
385	bdnz	.Loop_enc
386
387	vperm	2,1,2,5
388	.long	0x10001508
389	lvx	2,7,5
390	vperm	1,2,1,5
391	.long	0x10000D09
392
393	vspltisb	2,-1
394	vxor	1,1,1
395	li	7,15
396	vperm	2,2,1,3
397	vxor	3,3,4
398	lvx	1,0,4
399	vperm	0,0,0,3
400	vsel	1,1,0,2
401	lvx	4,7,4
402	stvx	1,0,4
403	vsel	0,0,4,2
404	stvx	0,7,4
405
406	or	12,12,12
407	blr
408.long	0
409.byte	0,12,0x14,0,0,0,3,0
410.long	0
411.size	aes_p8_encrypt,.-aes_p8_encrypt
412.globl	aes_p8_decrypt
413.type	aes_p8_decrypt,@function
414.align	5
415aes_p8_decrypt:
416.localentry	aes_p8_decrypt,0
417
418	lwz	6,240(5)
419	lis	0,0xfc00
420	li	12,-1
421	li	7,15
422	or	0,0,0
423
424	lvx	0,0,3
425	neg	11,4
426	lvx	1,7,3
427	lvsl	2,0,3
428	vspltisb	4,0x0f
429	lvsr	3,0,11
430	vxor	2,2,4
431	li	7,16
432	vperm	0,0,1,2
433	lvx	1,0,5
434	lvsr	5,0,5
435	srwi	6,6,1
436	lvx	2,7,5
437	addi	7,7,16
438	subi	6,6,1
439	vperm	1,2,1,5
440
441	vxor	0,0,1
442	lvx	1,7,5
443	addi	7,7,16
444	mtctr	6
445
446.Loop_dec:
447	vperm	2,1,2,5
448	.long	0x10001548
449	lvx	2,7,5
450	addi	7,7,16
451	vperm	1,2,1,5
452	.long	0x10000D48
453	lvx	1,7,5
454	addi	7,7,16
455	bdnz	.Loop_dec
456
457	vperm	2,1,2,5
458	.long	0x10001548
459	lvx	2,7,5
460	vperm	1,2,1,5
461	.long	0x10000D49
462
463	vspltisb	2,-1
464	vxor	1,1,1
465	li	7,15
466	vperm	2,2,1,3
467	vxor	3,3,4
468	lvx	1,0,4
469	vperm	0,0,0,3
470	vsel	1,1,0,2
471	lvx	4,7,4
472	stvx	1,0,4
473	vsel	0,0,4,2
474	stvx	0,7,4
475
476	or	12,12,12
477	blr
478.long	0
479.byte	0,12,0x14,0,0,0,3,0
480.long	0
481.size	aes_p8_decrypt,.-aes_p8_decrypt
482.globl	aes_p8_cbc_encrypt
483.type	aes_p8_cbc_encrypt,@function
484.align	5
485aes_p8_cbc_encrypt:
486.localentry	aes_p8_cbc_encrypt,0
487
488	cmpldi	5,16
489	.long	0x4dc00020
490
491	cmpwi	8,0
492	lis	0,0xffe0
493	li	12,-1
494	or	0,0,0
495
496	li	10,15
497	vxor	0,0,0
498	vspltisb	3,0x0f
499
500	lvx	4,0,7
501	lvsl	6,0,7
502	lvx	5,10,7
503	vxor	6,6,3
504	vperm	4,4,5,6
505
506	neg	11,3
507	lvsr	10,0,6
508	lwz	9,240(6)
509
510	lvsr	6,0,11
511	lvx	5,0,3
512	addi	3,3,15
513	vxor	6,6,3
514
515	lvsl	8,0,4
516	vspltisb	9,-1
517	lvx	7,0,4
518	vperm	9,9,0,8
519	vxor	8,8,3
520
521	srwi	9,9,1
522	li	10,16
523	subi	9,9,1
524	beq	.Lcbc_dec
525
526.Lcbc_enc:
527	vor	2,5,5
528	lvx	5,0,3
529	addi	3,3,16
530	mtctr	9
531	subi	5,5,16
532
533	lvx	0,0,6
534	vperm	2,2,5,6
535	lvx	1,10,6
536	addi	10,10,16
537	vperm	0,1,0,10
538	vxor	2,2,0
539	lvx	0,10,6
540	addi	10,10,16
541	vxor	2,2,4
542
543.Loop_cbc_enc:
544	vperm	1,0,1,10
545	.long	0x10420D08
546	lvx	1,10,6
547	addi	10,10,16
548	vperm	0,1,0,10
549	.long	0x10420508
550	lvx	0,10,6
551	addi	10,10,16
552	bdnz	.Loop_cbc_enc
553
554	vperm	1,0,1,10
555	.long	0x10420D08
556	lvx	1,10,6
557	li	10,16
558	vperm	0,1,0,10
559	.long	0x10820509
560	cmpldi	5,16
561
562	vperm	3,4,4,8
563	vsel	2,7,3,9
564	vor	7,3,3
565	stvx	2,0,4
566	addi	4,4,16
567	bge	.Lcbc_enc
568
569	b	.Lcbc_done
570
571.align	4
572.Lcbc_dec:
573	cmpldi	5,128
574	bge	_aesp8_cbc_decrypt8x
575	vor	3,5,5
576	lvx	5,0,3
577	addi	3,3,16
578	mtctr	9
579	subi	5,5,16
580
581	lvx	0,0,6
582	vperm	3,3,5,6
583	lvx	1,10,6
584	addi	10,10,16
585	vperm	0,1,0,10
586	vxor	2,3,0
587	lvx	0,10,6
588	addi	10,10,16
589
590.Loop_cbc_dec:
591	vperm	1,0,1,10
592	.long	0x10420D48
593	lvx	1,10,6
594	addi	10,10,16
595	vperm	0,1,0,10
596	.long	0x10420548
597	lvx	0,10,6
598	addi	10,10,16
599	bdnz	.Loop_cbc_dec
600
601	vperm	1,0,1,10
602	.long	0x10420D48
603	lvx	1,10,6
604	li	10,16
605	vperm	0,1,0,10
606	.long	0x10420549
607	cmpldi	5,16
608
609	vxor	2,2,4
610	vor	4,3,3
611	vperm	3,2,2,8
612	vsel	2,7,3,9
613	vor	7,3,3
614	stvx	2,0,4
615	addi	4,4,16
616	bge	.Lcbc_dec
617
618.Lcbc_done:
619	addi	4,4,-1
620	lvx	2,0,4
621	vsel	2,7,2,9
622	stvx	2,0,4
623
624	neg	8,7
625	li	10,15
626	vxor	0,0,0
627	vspltisb	9,-1
628	vspltisb	3,0x0f
629	lvsr	8,0,8
630	vperm	9,9,0,8
631	vxor	8,8,3
632	lvx	7,0,7
633	vperm	4,4,4,8
634	vsel	2,7,4,9
635	lvx	5,10,7
636	stvx	2,0,7
637	vsel	2,4,5,9
638	stvx	2,10,7
639
640	or	12,12,12
641	blr
642.long	0
643.byte	0,12,0x14,0,0,0,6,0
644.long	0
645.align	5
646_aesp8_cbc_decrypt8x:
647	stdu	1,-448(1)
648	li	10,207
649	li	11,223
650	stvx	20,10,1
651	addi	10,10,32
652	stvx	21,11,1
653	addi	11,11,32
654	stvx	22,10,1
655	addi	10,10,32
656	stvx	23,11,1
657	addi	11,11,32
658	stvx	24,10,1
659	addi	10,10,32
660	stvx	25,11,1
661	addi	11,11,32
662	stvx	26,10,1
663	addi	10,10,32
664	stvx	27,11,1
665	addi	11,11,32
666	stvx	28,10,1
667	addi	10,10,32
668	stvx	29,11,1
669	addi	11,11,32
670	stvx	30,10,1
671	stvx	31,11,1
672	li	0,-1
673	stw	12,396(1)
674	li	8,0x10
675	std	26,400(1)
676	li	26,0x20
677	std	27,408(1)
678	li	27,0x30
679	std	28,416(1)
680	li	28,0x40
681	std	29,424(1)
682	li	29,0x50
683	std	30,432(1)
684	li	30,0x60
685	std	31,440(1)
686	li	31,0x70
687	or	0,0,0
688
689	subi	9,9,3
690	subi	5,5,128
691
692	lvx	23,0,6
693	lvx	30,8,6
694	addi	6,6,0x20
695	lvx	31,0,6
696	vperm	23,30,23,10
697	addi	11,1,64+15
698	mtctr	9
699
700.Load_cbc_dec_key:
701	vperm	24,31,30,10
702	lvx	30,8,6
703	addi	6,6,0x20
704	stvx	24,0,11
705	vperm	25,30,31,10
706	lvx	31,0,6
707	stvx	25,8,11
708	addi	11,11,0x20
709	bdnz	.Load_cbc_dec_key
710
711	lvx	26,8,6
712	vperm	24,31,30,10
713	lvx	27,26,6
714	stvx	24,0,11
715	vperm	25,26,31,10
716	lvx	28,27,6
717	stvx	25,8,11
718	addi	11,1,64+15
719	vperm	26,27,26,10
720	lvx	29,28,6
721	vperm	27,28,27,10
722	lvx	30,29,6
723	vperm	28,29,28,10
724	lvx	31,30,6
725	vperm	29,30,29,10
726	lvx	14,31,6
727	vperm	30,31,30,10
728	lvx	24,0,11
729	vperm	31,14,31,10
730	lvx	25,8,11
731
732
733
734	subi	3,3,15
735
736	li	10,8
737	.long	0x7C001E99
738	lvsl	6,0,10
739	vspltisb	3,0x0f
740	.long	0x7C281E99
741	vxor	6,6,3
742	.long	0x7C5A1E99
743	vperm	0,0,0,6
744	.long	0x7C7B1E99
745	vperm	1,1,1,6
746	.long	0x7D5C1E99
747	vperm	2,2,2,6
748	vxor	14,0,23
749	.long	0x7D7D1E99
750	vperm	3,3,3,6
751	vxor	15,1,23
752	.long	0x7D9E1E99
753	vperm	10,10,10,6
754	vxor	16,2,23
755	.long	0x7DBF1E99
756	addi	3,3,0x80
757	vperm	11,11,11,6
758	vxor	17,3,23
759	vperm	12,12,12,6
760	vxor	18,10,23
761	vperm	13,13,13,6
762	vxor	19,11,23
763	vxor	20,12,23
764	vxor	21,13,23
765
766	mtctr	9
767	b	.Loop_cbc_dec8x
768.align	5
769.Loop_cbc_dec8x:
770	.long	0x11CEC548
771	.long	0x11EFC548
772	.long	0x1210C548
773	.long	0x1231C548
774	.long	0x1252C548
775	.long	0x1273C548
776	.long	0x1294C548
777	.long	0x12B5C548
778	lvx	24,26,11
779	addi	11,11,0x20
780
781	.long	0x11CECD48
782	.long	0x11EFCD48
783	.long	0x1210CD48
784	.long	0x1231CD48
785	.long	0x1252CD48
786	.long	0x1273CD48
787	.long	0x1294CD48
788	.long	0x12B5CD48
789	lvx	25,8,11
790	bdnz	.Loop_cbc_dec8x
791
792	subic	5,5,128
793	.long	0x11CEC548
794	.long	0x11EFC548
795	.long	0x1210C548
796	.long	0x1231C548
797	.long	0x1252C548
798	.long	0x1273C548
799	.long	0x1294C548
800	.long	0x12B5C548
801
802	subfe.	0,0,0
803	.long	0x11CECD48
804	.long	0x11EFCD48
805	.long	0x1210CD48
806	.long	0x1231CD48
807	.long	0x1252CD48
808	.long	0x1273CD48
809	.long	0x1294CD48
810	.long	0x12B5CD48
811
812	and	0,0,5
813	.long	0x11CED548
814	.long	0x11EFD548
815	.long	0x1210D548
816	.long	0x1231D548
817	.long	0x1252D548
818	.long	0x1273D548
819	.long	0x1294D548
820	.long	0x12B5D548
821
822	add	3,3,0
823
824
825
826	.long	0x11CEDD48
827	.long	0x11EFDD48
828	.long	0x1210DD48
829	.long	0x1231DD48
830	.long	0x1252DD48
831	.long	0x1273DD48
832	.long	0x1294DD48
833	.long	0x12B5DD48
834
835	addi	11,1,64+15
836	.long	0x11CEE548
837	.long	0x11EFE548
838	.long	0x1210E548
839	.long	0x1231E548
840	.long	0x1252E548
841	.long	0x1273E548
842	.long	0x1294E548
843	.long	0x12B5E548
844	lvx	24,0,11
845
846	.long	0x11CEED48
847	.long	0x11EFED48
848	.long	0x1210ED48
849	.long	0x1231ED48
850	.long	0x1252ED48
851	.long	0x1273ED48
852	.long	0x1294ED48
853	.long	0x12B5ED48
854	lvx	25,8,11
855
856	.long	0x11CEF548
857	vxor	4,4,31
858	.long	0x11EFF548
859	vxor	0,0,31
860	.long	0x1210F548
861	vxor	1,1,31
862	.long	0x1231F548
863	vxor	2,2,31
864	.long	0x1252F548
865	vxor	3,3,31
866	.long	0x1273F548
867	vxor	10,10,31
868	.long	0x1294F548
869	vxor	11,11,31
870	.long	0x12B5F548
871	vxor	12,12,31
872
873	.long	0x11CE2549
874	.long	0x11EF0549
875	.long	0x7C001E99
876	.long	0x12100D49
877	.long	0x7C281E99
878	.long	0x12311549
879	vperm	0,0,0,6
880	.long	0x7C5A1E99
881	.long	0x12521D49
882	vperm	1,1,1,6
883	.long	0x7C7B1E99
884	.long	0x12735549
885	vperm	2,2,2,6
886	.long	0x7D5C1E99
887	.long	0x12945D49
888	vperm	3,3,3,6
889	.long	0x7D7D1E99
890	.long	0x12B56549
891	vperm	10,10,10,6
892	.long	0x7D9E1E99
893	vor	4,13,13
894	vperm	11,11,11,6
895	.long	0x7DBF1E99
896	addi	3,3,0x80
897
898	vperm	14,14,14,6
899	vperm	15,15,15,6
900	.long	0x7DC02799
901	vperm	12,12,12,6
902	vxor	14,0,23
903	vperm	16,16,16,6
904	.long	0x7DE82799
905	vperm	13,13,13,6
906	vxor	15,1,23
907	vperm	17,17,17,6
908	.long	0x7E1A2799
909	vxor	16,2,23
910	vperm	18,18,18,6
911	.long	0x7E3B2799
912	vxor	17,3,23
913	vperm	19,19,19,6
914	.long	0x7E5C2799
915	vxor	18,10,23
916	vperm	20,20,20,6
917	.long	0x7E7D2799
918	vxor	19,11,23
919	vperm	21,21,21,6
920	.long	0x7E9E2799
921	vxor	20,12,23
922	.long	0x7EBF2799
923	addi	4,4,0x80
924	vxor	21,13,23
925
926	mtctr	9
927	beq	.Loop_cbc_dec8x
928
929	addic.	5,5,128
930	beq	.Lcbc_dec8x_done
931	nop
932	nop
933
934.Loop_cbc_dec8x_tail:
935	.long	0x11EFC548
936	.long	0x1210C548
937	.long	0x1231C548
938	.long	0x1252C548
939	.long	0x1273C548
940	.long	0x1294C548
941	.long	0x12B5C548
942	lvx	24,26,11
943	addi	11,11,0x20
944
945	.long	0x11EFCD48
946	.long	0x1210CD48
947	.long	0x1231CD48
948	.long	0x1252CD48
949	.long	0x1273CD48
950	.long	0x1294CD48
951	.long	0x12B5CD48
952	lvx	25,8,11
953	bdnz	.Loop_cbc_dec8x_tail
954
955	.long	0x11EFC548
956	.long	0x1210C548
957	.long	0x1231C548
958	.long	0x1252C548
959	.long	0x1273C548
960	.long	0x1294C548
961	.long	0x12B5C548
962
963	.long	0x11EFCD48
964	.long	0x1210CD48
965	.long	0x1231CD48
966	.long	0x1252CD48
967	.long	0x1273CD48
968	.long	0x1294CD48
969	.long	0x12B5CD48
970
971	.long	0x11EFD548
972	.long	0x1210D548
973	.long	0x1231D548
974	.long	0x1252D548
975	.long	0x1273D548
976	.long	0x1294D548
977	.long	0x12B5D548
978
979	.long	0x11EFDD48
980	.long	0x1210DD48
981	.long	0x1231DD48
982	.long	0x1252DD48
983	.long	0x1273DD48
984	.long	0x1294DD48
985	.long	0x12B5DD48
986
987	.long	0x11EFE548
988	.long	0x1210E548
989	.long	0x1231E548
990	.long	0x1252E548
991	.long	0x1273E548
992	.long	0x1294E548
993	.long	0x12B5E548
994
995	.long	0x11EFED48
996	.long	0x1210ED48
997	.long	0x1231ED48
998	.long	0x1252ED48
999	.long	0x1273ED48
1000	.long	0x1294ED48
1001	.long	0x12B5ED48
1002
1003	.long	0x11EFF548
1004	vxor	4,4,31
1005	.long	0x1210F548
1006	vxor	1,1,31
1007	.long	0x1231F548
1008	vxor	2,2,31
1009	.long	0x1252F548
1010	vxor	3,3,31
1011	.long	0x1273F548
1012	vxor	10,10,31
1013	.long	0x1294F548
1014	vxor	11,11,31
1015	.long	0x12B5F548
1016	vxor	12,12,31
1017
1018	cmplwi	5,32
1019	blt	.Lcbc_dec8x_one
1020	nop
1021	beq	.Lcbc_dec8x_two
1022	cmplwi	5,64
1023	blt	.Lcbc_dec8x_three
1024	nop
1025	beq	.Lcbc_dec8x_four
1026	cmplwi	5,96
1027	blt	.Lcbc_dec8x_five
1028	nop
1029	beq	.Lcbc_dec8x_six
1030
1031.Lcbc_dec8x_seven:
1032	.long	0x11EF2549
1033	.long	0x12100D49
1034	.long	0x12311549
1035	.long	0x12521D49
1036	.long	0x12735549
1037	.long	0x12945D49
1038	.long	0x12B56549
1039	vor	4,13,13
1040
1041	vperm	15,15,15,6
1042	vperm	16,16,16,6
1043	.long	0x7DE02799
1044	vperm	17,17,17,6
1045	.long	0x7E082799
1046	vperm	18,18,18,6
1047	.long	0x7E3A2799
1048	vperm	19,19,19,6
1049	.long	0x7E5B2799
1050	vperm	20,20,20,6
1051	.long	0x7E7C2799
1052	vperm	21,21,21,6
1053	.long	0x7E9D2799
1054	.long	0x7EBE2799
1055	addi	4,4,0x70
1056	b	.Lcbc_dec8x_done
1057
1058.align	5
1059.Lcbc_dec8x_six:
1060	.long	0x12102549
1061	.long	0x12311549
1062	.long	0x12521D49
1063	.long	0x12735549
1064	.long	0x12945D49
1065	.long	0x12B56549
1066	vor	4,13,13
1067
1068	vperm	16,16,16,6
1069	vperm	17,17,17,6
1070	.long	0x7E002799
1071	vperm	18,18,18,6
1072	.long	0x7E282799
1073	vperm	19,19,19,6
1074	.long	0x7E5A2799
1075	vperm	20,20,20,6
1076	.long	0x7E7B2799
1077	vperm	21,21,21,6
1078	.long	0x7E9C2799
1079	.long	0x7EBD2799
1080	addi	4,4,0x60
1081	b	.Lcbc_dec8x_done
1082
1083.align	5
1084.Lcbc_dec8x_five:
1085	.long	0x12312549
1086	.long	0x12521D49
1087	.long	0x12735549
1088	.long	0x12945D49
1089	.long	0x12B56549
1090	vor	4,13,13
1091
1092	vperm	17,17,17,6
1093	vperm	18,18,18,6
1094	.long	0x7E202799
1095	vperm	19,19,19,6
1096	.long	0x7E482799
1097	vperm	20,20,20,6
1098	.long	0x7E7A2799
1099	vperm	21,21,21,6
1100	.long	0x7E9B2799
1101	.long	0x7EBC2799
1102	addi	4,4,0x50
1103	b	.Lcbc_dec8x_done
1104
1105.align	5
1106.Lcbc_dec8x_four:
1107	.long	0x12522549
1108	.long	0x12735549
1109	.long	0x12945D49
1110	.long	0x12B56549
1111	vor	4,13,13
1112
1113	vperm	18,18,18,6
1114	vperm	19,19,19,6
1115	.long	0x7E402799
1116	vperm	20,20,20,6
1117	.long	0x7E682799
1118	vperm	21,21,21,6
1119	.long	0x7E9A2799
1120	.long	0x7EBB2799
1121	addi	4,4,0x40
1122	b	.Lcbc_dec8x_done
1123
1124.align	5
1125.Lcbc_dec8x_three:
1126	.long	0x12732549
1127	.long	0x12945D49
1128	.long	0x12B56549
1129	vor	4,13,13
1130
1131	vperm	19,19,19,6
1132	vperm	20,20,20,6
1133	.long	0x7E602799
1134	vperm	21,21,21,6
1135	.long	0x7E882799
1136	.long	0x7EBA2799
1137	addi	4,4,0x30
1138	b	.Lcbc_dec8x_done
1139
1140.align	5
1141.Lcbc_dec8x_two:
1142	.long	0x12942549
1143	.long	0x12B56549
1144	vor	4,13,13
1145
1146	vperm	20,20,20,6
1147	vperm	21,21,21,6
1148	.long	0x7E802799
1149	.long	0x7EA82799
1150	addi	4,4,0x20
1151	b	.Lcbc_dec8x_done
1152
1153.align	5
1154.Lcbc_dec8x_one:
1155	.long	0x12B52549
1156	vor	4,13,13
1157
1158	vperm	21,21,21,6
1159	.long	0x7EA02799
1160	addi	4,4,0x10
1161
1162.Lcbc_dec8x_done:
1163	vperm	4,4,4,6
1164	.long	0x7C803F99
1165
1166	li	10,79
1167	li	11,95
1168	stvx	6,10,1
1169	addi	10,10,32
1170	stvx	6,11,1
1171	addi	11,11,32
1172	stvx	6,10,1
1173	addi	10,10,32
1174	stvx	6,11,1
1175	addi	11,11,32
1176	stvx	6,10,1
1177	addi	10,10,32
1178	stvx	6,11,1
1179	addi	11,11,32
1180	stvx	6,10,1
1181	addi	10,10,32
1182	stvx	6,11,1
1183	addi	11,11,32
1184
1185	or	12,12,12
1186	lvx	20,10,1
1187	addi	10,10,32
1188	lvx	21,11,1
1189	addi	11,11,32
1190	lvx	22,10,1
1191	addi	10,10,32
1192	lvx	23,11,1
1193	addi	11,11,32
1194	lvx	24,10,1
1195	addi	10,10,32
1196	lvx	25,11,1
1197	addi	11,11,32
1198	lvx	26,10,1
1199	addi	10,10,32
1200	lvx	27,11,1
1201	addi	11,11,32
1202	lvx	28,10,1
1203	addi	10,10,32
1204	lvx	29,11,1
1205	addi	11,11,32
1206	lvx	30,10,1
1207	lvx	31,11,1
1208	ld	26,400(1)
1209	ld	27,408(1)
1210	ld	28,416(1)
1211	ld	29,424(1)
1212	ld	30,432(1)
1213	ld	31,440(1)
1214	addi	1,1,448
1215	blr
1216.long	0
1217.byte	0,12,0x04,0,0x80,6,6,0
1218.long	0
1219.size	aes_p8_cbc_encrypt,.-aes_p8_cbc_encrypt
1220.globl	aes_p8_ctr32_encrypt_blocks
1221.type	aes_p8_ctr32_encrypt_blocks,@function
1222.align	5
1223aes_p8_ctr32_encrypt_blocks:
1224.localentry	aes_p8_ctr32_encrypt_blocks,0
1225
1226	cmpldi	5,1
1227	.long	0x4dc00020
1228
1229	lis	0,0xfff0
1230	li	12,-1
1231	or	0,0,0
1232
1233	li	10,15
1234	vxor	0,0,0
1235	vspltisb	3,0x0f
1236
1237	lvx	4,0,7
1238	lvsl	6,0,7
1239	lvx	5,10,7
1240	vspltisb	11,1
1241	vxor	6,6,3
1242	vperm	4,4,5,6
1243	vsldoi	11,0,11,1
1244
1245	neg	11,3
1246	lvsr	10,0,6
1247	lwz	9,240(6)
1248
1249	lvsr	6,0,11
1250	lvx	5,0,3
1251	addi	3,3,15
1252	vxor	6,6,3
1253
1254	srwi	9,9,1
1255	li	10,16
1256	subi	9,9,1
1257
1258	cmpldi	5,8
1259	bge	_aesp8_ctr32_encrypt8x
1260
1261	lvsl	8,0,4
1262	vspltisb	9,-1
1263	lvx	7,0,4
1264	vperm	9,9,0,8
1265	vxor	8,8,3
1266
1267	lvx	0,0,6
1268	mtctr	9
1269	lvx	1,10,6
1270	addi	10,10,16
1271	vperm	0,1,0,10
1272	vxor	2,4,0
1273	lvx	0,10,6
1274	addi	10,10,16
1275	b	.Loop_ctr32_enc
1276
1277.align	5
1278.Loop_ctr32_enc:
1279	vperm	1,0,1,10
1280	.long	0x10420D08
1281	lvx	1,10,6
1282	addi	10,10,16
1283	vperm	0,1,0,10
1284	.long	0x10420508
1285	lvx	0,10,6
1286	addi	10,10,16
1287	bdnz	.Loop_ctr32_enc
1288
1289	vadduwm	4,4,11
1290	vor	3,5,5
1291	lvx	5,0,3
1292	addi	3,3,16
1293	subic.	5,5,1
1294
1295	vperm	1,0,1,10
1296	.long	0x10420D08
1297	lvx	1,10,6
1298	vperm	3,3,5,6
1299	li	10,16
1300	vperm	1,1,0,10
1301	lvx	0,0,6
1302	vxor	3,3,1
1303	.long	0x10421D09
1304
1305	lvx	1,10,6
1306	addi	10,10,16
1307	vperm	2,2,2,8
1308	vsel	3,7,2,9
1309	mtctr	9
1310	vperm	0,1,0,10
1311	vor	7,2,2
1312	vxor	2,4,0
1313	lvx	0,10,6
1314	addi	10,10,16
1315	stvx	3,0,4
1316	addi	4,4,16
1317	bne	.Loop_ctr32_enc
1318
1319	addi	4,4,-1
1320	lvx	2,0,4
1321	vsel	2,7,2,9
1322	stvx	2,0,4
1323
1324	or	12,12,12
1325	blr
1326.long	0
1327.byte	0,12,0x14,0,0,0,6,0
1328.long	0
1329.align	5
1330_aesp8_ctr32_encrypt8x:
1331	stdu	1,-448(1)
1332	li	10,207
1333	li	11,223
1334	stvx	20,10,1
1335	addi	10,10,32
1336	stvx	21,11,1
1337	addi	11,11,32
1338	stvx	22,10,1
1339	addi	10,10,32
1340	stvx	23,11,1
1341	addi	11,11,32
1342	stvx	24,10,1
1343	addi	10,10,32
1344	stvx	25,11,1
1345	addi	11,11,32
1346	stvx	26,10,1
1347	addi	10,10,32
1348	stvx	27,11,1
1349	addi	11,11,32
1350	stvx	28,10,1
1351	addi	10,10,32
1352	stvx	29,11,1
1353	addi	11,11,32
1354	stvx	30,10,1
1355	stvx	31,11,1
1356	li	0,-1
1357	stw	12,396(1)
1358	li	8,0x10
1359	std	26,400(1)
1360	li	26,0x20
1361	std	27,408(1)
1362	li	27,0x30
1363	std	28,416(1)
1364	li	28,0x40
1365	std	29,424(1)
1366	li	29,0x50
1367	std	30,432(1)
1368	li	30,0x60
1369	std	31,440(1)
1370	li	31,0x70
1371	or	0,0,0
1372
1373	subi	9,9,3
1374
1375	lvx	23,0,6
1376	lvx	30,8,6
1377	addi	6,6,0x20
1378	lvx	31,0,6
1379	vperm	23,30,23,10
1380	addi	11,1,64+15
1381	mtctr	9
1382
1383.Load_ctr32_enc_key:
1384	vperm	24,31,30,10
1385	lvx	30,8,6
1386	addi	6,6,0x20
1387	stvx	24,0,11
1388	vperm	25,30,31,10
1389	lvx	31,0,6
1390	stvx	25,8,11
1391	addi	11,11,0x20
1392	bdnz	.Load_ctr32_enc_key
1393
1394	lvx	26,8,6
1395	vperm	24,31,30,10
1396	lvx	27,26,6
1397	stvx	24,0,11
1398	vperm	25,26,31,10
1399	lvx	28,27,6
1400	stvx	25,8,11
1401	addi	11,1,64+15
1402	vperm	26,27,26,10
1403	lvx	29,28,6
1404	vperm	27,28,27,10
1405	lvx	30,29,6
1406	vperm	28,29,28,10
1407	lvx	31,30,6
1408	vperm	29,30,29,10
1409	lvx	15,31,6
1410	vperm	30,31,30,10
1411	lvx	24,0,11
1412	vperm	31,15,31,10
1413	lvx	25,8,11
1414
1415	vadduwm	7,11,11
1416	subi	3,3,15
1417	sldi	5,5,4
1418
1419	vadduwm	16,4,11
1420	vadduwm	17,4,7
1421	vxor	15,4,23
1422	li	10,8
1423	vadduwm	18,16,7
1424	vxor	16,16,23
1425	lvsl	6,0,10
1426	vadduwm	19,17,7
1427	vxor	17,17,23
1428	vspltisb	3,0x0f
1429	vadduwm	20,18,7
1430	vxor	18,18,23
1431	vxor	6,6,3
1432	vadduwm	21,19,7
1433	vxor	19,19,23
1434	vadduwm	22,20,7
1435	vxor	20,20,23
1436	vadduwm	4,21,7
1437	vxor	21,21,23
1438	vxor	22,22,23
1439
1440	mtctr	9
1441	b	.Loop_ctr32_enc8x
1442.align	5
1443.Loop_ctr32_enc8x:
1444	.long	0x11EFC508
1445	.long	0x1210C508
1446	.long	0x1231C508
1447	.long	0x1252C508
1448	.long	0x1273C508
1449	.long	0x1294C508
1450	.long	0x12B5C508
1451	.long	0x12D6C508
1452.Loop_ctr32_enc8x_middle:
1453	lvx	24,26,11
1454	addi	11,11,0x20
1455
1456	.long	0x11EFCD08
1457	.long	0x1210CD08
1458	.long	0x1231CD08
1459	.long	0x1252CD08
1460	.long	0x1273CD08
1461	.long	0x1294CD08
1462	.long	0x12B5CD08
1463	.long	0x12D6CD08
1464	lvx	25,8,11
1465	bdnz	.Loop_ctr32_enc8x
1466
1467	subic	11,5,256
1468	.long	0x11EFC508
1469	.long	0x1210C508
1470	.long	0x1231C508
1471	.long	0x1252C508
1472	.long	0x1273C508
1473	.long	0x1294C508
1474	.long	0x12B5C508
1475	.long	0x12D6C508
1476
1477	subfe	0,0,0
1478	.long	0x11EFCD08
1479	.long	0x1210CD08
1480	.long	0x1231CD08
1481	.long	0x1252CD08
1482	.long	0x1273CD08
1483	.long	0x1294CD08
1484	.long	0x12B5CD08
1485	.long	0x12D6CD08
1486
1487	and	0,0,11
1488	addi	11,1,64+15
1489	.long	0x11EFD508
1490	.long	0x1210D508
1491	.long	0x1231D508
1492	.long	0x1252D508
1493	.long	0x1273D508
1494	.long	0x1294D508
1495	.long	0x12B5D508
1496	.long	0x12D6D508
1497	lvx	24,0,11
1498
1499	subic	5,5,129
1500	.long	0x11EFDD08
1501	addi	5,5,1
1502	.long	0x1210DD08
1503	.long	0x1231DD08
1504	.long	0x1252DD08
1505	.long	0x1273DD08
1506	.long	0x1294DD08
1507	.long	0x12B5DD08
1508	.long	0x12D6DD08
1509	lvx	25,8,11
1510
1511	.long	0x11EFE508
1512	.long	0x7C001E99
1513	.long	0x1210E508
1514	.long	0x7C281E99
1515	.long	0x1231E508
1516	.long	0x7C5A1E99
1517	.long	0x1252E508
1518	.long	0x7C7B1E99
1519	.long	0x1273E508
1520	.long	0x7D5C1E99
1521	.long	0x1294E508
1522	.long	0x7D9D1E99
1523	.long	0x12B5E508
1524	.long	0x7DBE1E99
1525	.long	0x12D6E508
1526	.long	0x7DDF1E99
1527	addi	3,3,0x80
1528
1529	.long	0x11EFED08
1530	vperm	0,0,0,6
1531	.long	0x1210ED08
1532	vperm	1,1,1,6
1533	.long	0x1231ED08
1534	vperm	2,2,2,6
1535	.long	0x1252ED08
1536	vperm	3,3,3,6
1537	.long	0x1273ED08
1538	vperm	10,10,10,6
1539	.long	0x1294ED08
1540	vperm	12,12,12,6
1541	.long	0x12B5ED08
1542	vperm	13,13,13,6
1543	.long	0x12D6ED08
1544	vperm	14,14,14,6
1545
1546	add	3,3,0
1547
1548
1549
1550	subfe.	0,0,0
1551	.long	0x11EFF508
1552	vxor	0,0,31
1553	.long	0x1210F508
1554	vxor	1,1,31
1555	.long	0x1231F508
1556	vxor	2,2,31
1557	.long	0x1252F508
1558	vxor	3,3,31
1559	.long	0x1273F508
1560	vxor	10,10,31
1561	.long	0x1294F508
1562	vxor	12,12,31
1563	.long	0x12B5F508
1564	vxor	13,13,31
1565	.long	0x12D6F508
1566	vxor	14,14,31
1567
1568	bne	.Lctr32_enc8x_break
1569
1570	.long	0x100F0509
1571	.long	0x10300D09
1572	vadduwm	16,4,11
1573	.long	0x10511509
1574	vadduwm	17,4,7
1575	vxor	15,4,23
1576	.long	0x10721D09
1577	vadduwm	18,16,7
1578	vxor	16,16,23
1579	.long	0x11535509
1580	vadduwm	19,17,7
1581	vxor	17,17,23
1582	.long	0x11946509
1583	vadduwm	20,18,7
1584	vxor	18,18,23
1585	.long	0x11B56D09
1586	vadduwm	21,19,7
1587	vxor	19,19,23
1588	.long	0x11D67509
1589	vadduwm	22,20,7
1590	vxor	20,20,23
1591	vperm	0,0,0,6
1592	vadduwm	4,21,7
1593	vxor	21,21,23
1594	vperm	1,1,1,6
1595	vxor	22,22,23
1596	mtctr	9
1597
1598	.long	0x11EFC508
1599	.long	0x7C002799
1600	vperm	2,2,2,6
1601	.long	0x1210C508
1602	.long	0x7C282799
1603	vperm	3,3,3,6
1604	.long	0x1231C508
1605	.long	0x7C5A2799
1606	vperm	10,10,10,6
1607	.long	0x1252C508
1608	.long	0x7C7B2799
1609	vperm	12,12,12,6
1610	.long	0x1273C508
1611	.long	0x7D5C2799
1612	vperm	13,13,13,6
1613	.long	0x1294C508
1614	.long	0x7D9D2799
1615	vperm	14,14,14,6
1616	.long	0x12B5C508
1617	.long	0x7DBE2799
1618	.long	0x12D6C508
1619	.long	0x7DDF2799
1620	addi	4,4,0x80
1621
1622	b	.Loop_ctr32_enc8x_middle
1623
1624.align	5
1625.Lctr32_enc8x_break:
1626	cmpwi	5,-0x60
1627	blt	.Lctr32_enc8x_one
1628	nop
1629	beq	.Lctr32_enc8x_two
1630	cmpwi	5,-0x40
1631	blt	.Lctr32_enc8x_three
1632	nop
1633	beq	.Lctr32_enc8x_four
1634	cmpwi	5,-0x20
1635	blt	.Lctr32_enc8x_five
1636	nop
1637	beq	.Lctr32_enc8x_six
1638	cmpwi	5,0x00
1639	blt	.Lctr32_enc8x_seven
1640
1641.Lctr32_enc8x_eight:
1642	.long	0x11EF0509
1643	.long	0x12100D09
1644	.long	0x12311509
1645	.long	0x12521D09
1646	.long	0x12735509
1647	.long	0x12946509
1648	.long	0x12B56D09
1649	.long	0x12D67509
1650
1651	vperm	15,15,15,6
1652	vperm	16,16,16,6
1653	.long	0x7DE02799
1654	vperm	17,17,17,6
1655	.long	0x7E082799
1656	vperm	18,18,18,6
1657	.long	0x7E3A2799
1658	vperm	19,19,19,6
1659	.long	0x7E5B2799
1660	vperm	20,20,20,6
1661	.long	0x7E7C2799
1662	vperm	21,21,21,6
1663	.long	0x7E9D2799
1664	vperm	22,22,22,6
1665	.long	0x7EBE2799
1666	.long	0x7EDF2799
1667	addi	4,4,0x80
1668	b	.Lctr32_enc8x_done
1669
1670.align	5
1671.Lctr32_enc8x_seven:
1672	.long	0x11EF0D09
1673	.long	0x12101509
1674	.long	0x12311D09
1675	.long	0x12525509
1676	.long	0x12736509
1677	.long	0x12946D09
1678	.long	0x12B57509
1679
1680	vperm	15,15,15,6
1681	vperm	16,16,16,6
1682	.long	0x7DE02799
1683	vperm	17,17,17,6
1684	.long	0x7E082799
1685	vperm	18,18,18,6
1686	.long	0x7E3A2799
1687	vperm	19,19,19,6
1688	.long	0x7E5B2799
1689	vperm	20,20,20,6
1690	.long	0x7E7C2799
1691	vperm	21,21,21,6
1692	.long	0x7E9D2799
1693	.long	0x7EBE2799
1694	addi	4,4,0x70
1695	b	.Lctr32_enc8x_done
1696
1697.align	5
1698.Lctr32_enc8x_six:
1699	.long	0x11EF1509
1700	.long	0x12101D09
1701	.long	0x12315509
1702	.long	0x12526509
1703	.long	0x12736D09
1704	.long	0x12947509
1705
1706	vperm	15,15,15,6
1707	vperm	16,16,16,6
1708	.long	0x7DE02799
1709	vperm	17,17,17,6
1710	.long	0x7E082799
1711	vperm	18,18,18,6
1712	.long	0x7E3A2799
1713	vperm	19,19,19,6
1714	.long	0x7E5B2799
1715	vperm	20,20,20,6
1716	.long	0x7E7C2799
1717	.long	0x7E9D2799
1718	addi	4,4,0x60
1719	b	.Lctr32_enc8x_done
1720
1721.align	5
1722.Lctr32_enc8x_five:
1723	.long	0x11EF1D09
1724	.long	0x12105509
1725	.long	0x12316509
1726	.long	0x12526D09
1727	.long	0x12737509
1728
1729	vperm	15,15,15,6
1730	vperm	16,16,16,6
1731	.long	0x7DE02799
1732	vperm	17,17,17,6
1733	.long	0x7E082799
1734	vperm	18,18,18,6
1735	.long	0x7E3A2799
1736	vperm	19,19,19,6
1737	.long	0x7E5B2799
1738	.long	0x7E7C2799
1739	addi	4,4,0x50
1740	b	.Lctr32_enc8x_done
1741
1742.align	5
1743.Lctr32_enc8x_four:
1744	.long	0x11EF5509
1745	.long	0x12106509
1746	.long	0x12316D09
1747	.long	0x12527509
1748
1749	vperm	15,15,15,6
1750	vperm	16,16,16,6
1751	.long	0x7DE02799
1752	vperm	17,17,17,6
1753	.long	0x7E082799
1754	vperm	18,18,18,6
1755	.long	0x7E3A2799
1756	.long	0x7E5B2799
1757	addi	4,4,0x40
1758	b	.Lctr32_enc8x_done
1759
1760.align	5
1761.Lctr32_enc8x_three:
1762	.long	0x11EF6509
1763	.long	0x12106D09
1764	.long	0x12317509
1765
1766	vperm	15,15,15,6
1767	vperm	16,16,16,6
1768	.long	0x7DE02799
1769	vperm	17,17,17,6
1770	.long	0x7E082799
1771	.long	0x7E3A2799
1772	addi	4,4,0x30
1773	b	.Lctr32_enc8x_done
1774
1775.align	5
1776.Lctr32_enc8x_two:
1777	.long	0x11EF6D09
1778	.long	0x12107509
1779
1780	vperm	15,15,15,6
1781	vperm	16,16,16,6
1782	.long	0x7DE02799
1783	.long	0x7E082799
1784	addi	4,4,0x20
1785	b	.Lctr32_enc8x_done
1786
1787.align	5
1788.Lctr32_enc8x_one:
1789	.long	0x11EF7509
1790
1791	vperm	15,15,15,6
1792	.long	0x7DE02799
1793	addi	4,4,0x10
1794
1795.Lctr32_enc8x_done:
1796	li	10,79
1797	li	11,95
1798	stvx	6,10,1
1799	addi	10,10,32
1800	stvx	6,11,1
1801	addi	11,11,32
1802	stvx	6,10,1
1803	addi	10,10,32
1804	stvx	6,11,1
1805	addi	11,11,32
1806	stvx	6,10,1
1807	addi	10,10,32
1808	stvx	6,11,1
1809	addi	11,11,32
1810	stvx	6,10,1
1811	addi	10,10,32
1812	stvx	6,11,1
1813	addi	11,11,32
1814
1815	or	12,12,12
1816	lvx	20,10,1
1817	addi	10,10,32
1818	lvx	21,11,1
1819	addi	11,11,32
1820	lvx	22,10,1
1821	addi	10,10,32
1822	lvx	23,11,1
1823	addi	11,11,32
1824	lvx	24,10,1
1825	addi	10,10,32
1826	lvx	25,11,1
1827	addi	11,11,32
1828	lvx	26,10,1
1829	addi	10,10,32
1830	lvx	27,11,1
1831	addi	11,11,32
1832	lvx	28,10,1
1833	addi	10,10,32
1834	lvx	29,11,1
1835	addi	11,11,32
1836	lvx	30,10,1
1837	lvx	31,11,1
1838	ld	26,400(1)
1839	ld	27,408(1)
1840	ld	28,416(1)
1841	ld	29,424(1)
1842	ld	30,432(1)
1843	ld	31,440(1)
1844	addi	1,1,448
1845	blr
1846.long	0
1847.byte	0,12,0x04,0,0x80,6,6,0
1848.long	0
1849.size	aes_p8_ctr32_encrypt_blocks,.-aes_p8_ctr32_encrypt_blocks
1850.globl	aes_p8_xts_encrypt
1851.type	aes_p8_xts_encrypt,@function
1852.align	5
1853aes_p8_xts_encrypt:
1854.localentry	aes_p8_xts_encrypt,0
1855
1856	mr	10,3
1857	li	3,-1
1858	cmpldi	5,16
1859	.long	0x4dc00020
1860
1861	lis	0,0xfff0
1862	li	12,-1
1863	li	11,0
1864	or	0,0,0
1865
1866	vspltisb	9,0x07
1867	lvsl	6,11,11
1868	vspltisb	11,0x0f
1869	vxor	6,6,9
1870
1871	li	3,15
1872	lvx	8,0,8
1873	lvsl	5,0,8
1874	lvx	4,3,8
1875	vxor	5,5,11
1876	vperm	8,8,4,5
1877
1878	neg	11,10
1879	lvsr	5,0,11
1880	lvx	2,0,10
1881	addi	10,10,15
1882	vxor	5,5,11
1883
1884	cmpldi	7,0
1885	beq	.Lxts_enc_no_key2
1886
1887	lvsr	7,0,7
1888	lwz	9,240(7)
1889	srwi	9,9,1
1890	subi	9,9,1
1891	li	3,16
1892
1893	lvx	0,0,7
1894	lvx	1,3,7
1895	addi	3,3,16
1896	vperm	0,1,0,7
1897	vxor	8,8,0
1898	lvx	0,3,7
1899	addi	3,3,16
1900	mtctr	9
1901
1902.Ltweak_xts_enc:
1903	vperm	1,0,1,7
1904	.long	0x11080D08
1905	lvx	1,3,7
1906	addi	3,3,16
1907	vperm	0,1,0,7
1908	.long	0x11080508
1909	lvx	0,3,7
1910	addi	3,3,16
1911	bdnz	.Ltweak_xts_enc
1912
1913	vperm	1,0,1,7
1914	.long	0x11080D08
1915	lvx	1,3,7
1916	vperm	0,1,0,7
1917	.long	0x11080509
1918
1919	li	8,0
1920	b	.Lxts_enc
1921
1922.Lxts_enc_no_key2:
1923	li	3,-16
1924	and	5,5,3
1925
1926
1927.Lxts_enc:
1928	lvx	4,0,10
1929	addi	10,10,16
1930
1931	lvsr	7,0,6
1932	lwz	9,240(6)
1933	srwi	9,9,1
1934	subi	9,9,1
1935	li	3,16
1936
1937	vslb	10,9,9
1938	vor	10,10,9
1939	vspltisb	11,1
1940	vsldoi	10,10,11,15
1941
1942	cmpldi	5,96
1943	bge	_aesp8_xts_encrypt6x
1944
1945	andi.	7,5,15
1946	subic	0,5,32
1947	subi	7,7,16
1948	subfe	0,0,0
1949	and	0,0,7
1950	add	10,10,0
1951
1952	lvx	0,0,6
1953	lvx	1,3,6
1954	addi	3,3,16
1955	vperm	2,2,4,5
1956	vperm	0,1,0,7
1957	vxor	2,2,8
1958	vxor	2,2,0
1959	lvx	0,3,6
1960	addi	3,3,16
1961	mtctr	9
1962	b	.Loop_xts_enc
1963
1964.align	5
1965.Loop_xts_enc:
1966	vperm	1,0,1,7
1967	.long	0x10420D08
1968	lvx	1,3,6
1969	addi	3,3,16
1970	vperm	0,1,0,7
1971	.long	0x10420508
1972	lvx	0,3,6
1973	addi	3,3,16
1974	bdnz	.Loop_xts_enc
1975
1976	vperm	1,0,1,7
1977	.long	0x10420D08
1978	lvx	1,3,6
1979	li	3,16
1980	vperm	0,1,0,7
1981	vxor	0,0,8
1982	.long	0x10620509
1983
1984	vperm	11,3,3,6
1985
1986	.long	0x7D602799
1987
1988	addi	4,4,16
1989
1990	subic.	5,5,16
1991	beq	.Lxts_enc_done
1992
1993	vor	2,4,4
1994	lvx	4,0,10
1995	addi	10,10,16
1996	lvx	0,0,6
1997	lvx	1,3,6
1998	addi	3,3,16
1999
2000	subic	0,5,32
2001	subfe	0,0,0
2002	and	0,0,7
2003	add	10,10,0
2004
2005	vsrab	11,8,9
2006	vaddubm	8,8,8
2007	vsldoi	11,11,11,15
2008	vand	11,11,10
2009	vxor	8,8,11
2010
2011	vperm	2,2,4,5
2012	vperm	0,1,0,7
2013	vxor	2,2,8
2014	vxor	3,3,0
2015	vxor	2,2,0
2016	lvx	0,3,6
2017	addi	3,3,16
2018
2019	mtctr	9
2020	cmpldi	5,16
2021	bge	.Loop_xts_enc
2022
2023	vxor	3,3,8
2024	lvsr	5,0,5
2025	vxor	4,4,4
2026	vspltisb	11,-1
2027	vperm	4,4,11,5
2028	vsel	2,2,3,4
2029
2030	subi	11,4,17
2031	subi	4,4,16
2032	mtctr	5
2033	li	5,16
2034.Loop_xts_enc_steal:
2035	lbzu	0,1(11)
2036	stb	0,16(11)
2037	bdnz	.Loop_xts_enc_steal
2038
2039	mtctr	9
2040	b	.Loop_xts_enc
2041
2042.Lxts_enc_done:
2043	cmpldi	8,0
2044	beq	.Lxts_enc_ret
2045
2046	vsrab	11,8,9
2047	vaddubm	8,8,8
2048	vsldoi	11,11,11,15
2049	vand	11,11,10
2050	vxor	8,8,11
2051
2052	vperm	8,8,8,6
2053	.long	0x7D004799
2054
2055.Lxts_enc_ret:
2056	or	12,12,12
2057	li	3,0
2058	blr
2059.long	0
2060.byte	0,12,0x04,0,0x80,6,6,0
2061.long	0
2062.size	aes_p8_xts_encrypt,.-aes_p8_xts_encrypt
2063
2064.globl	aes_p8_xts_decrypt
2065.type	aes_p8_xts_decrypt,@function
2066.align	5
2067aes_p8_xts_decrypt:
2068.localentry	aes_p8_xts_decrypt,0
2069
2070	mr	10,3
2071	li	3,-1
2072	cmpldi	5,16
2073	.long	0x4dc00020
2074
2075	lis	0,0xfff8
2076	li	12,-1
2077	li	11,0
2078	or	0,0,0
2079
2080	andi.	0,5,15
2081	neg	0,0
2082	andi.	0,0,16
2083	sub	5,5,0
2084
2085	vspltisb	9,0x07
2086	lvsl	6,11,11
2087	vspltisb	11,0x0f
2088	vxor	6,6,9
2089
2090	li	3,15
2091	lvx	8,0,8
2092	lvsl	5,0,8
2093	lvx	4,3,8
2094	vxor	5,5,11
2095	vperm	8,8,4,5
2096
2097	neg	11,10
2098	lvsr	5,0,11
2099	lvx	2,0,10
2100	addi	10,10,15
2101	vxor	5,5,11
2102
2103	cmpldi	7,0
2104	beq	.Lxts_dec_no_key2
2105
2106	lvsr	7,0,7
2107	lwz	9,240(7)
2108	srwi	9,9,1
2109	subi	9,9,1
2110	li	3,16
2111
2112	lvx	0,0,7
2113	lvx	1,3,7
2114	addi	3,3,16
2115	vperm	0,1,0,7
2116	vxor	8,8,0
2117	lvx	0,3,7
2118	addi	3,3,16
2119	mtctr	9
2120
2121.Ltweak_xts_dec:
2122	vperm	1,0,1,7
2123	.long	0x11080D08
2124	lvx	1,3,7
2125	addi	3,3,16
2126	vperm	0,1,0,7
2127	.long	0x11080508
2128	lvx	0,3,7
2129	addi	3,3,16
2130	bdnz	.Ltweak_xts_dec
2131
2132	vperm	1,0,1,7
2133	.long	0x11080D08
2134	lvx	1,3,7
2135	vperm	0,1,0,7
2136	.long	0x11080509
2137
2138	li	8,0
2139	b	.Lxts_dec
2140
2141.Lxts_dec_no_key2:
2142	neg	3,5
2143	andi.	3,3,15
2144	add	5,5,3
2145
2146
2147.Lxts_dec:
2148	lvx	4,0,10
2149	addi	10,10,16
2150
2151	lvsr	7,0,6
2152	lwz	9,240(6)
2153	srwi	9,9,1
2154	subi	9,9,1
2155	li	3,16
2156
2157	vslb	10,9,9
2158	vor	10,10,9
2159	vspltisb	11,1
2160	vsldoi	10,10,11,15
2161
2162	cmpldi	5,96
2163	bge	_aesp8_xts_decrypt6x
2164
2165	lvx	0,0,6
2166	lvx	1,3,6
2167	addi	3,3,16
2168	vperm	2,2,4,5
2169	vperm	0,1,0,7
2170	vxor	2,2,8
2171	vxor	2,2,0
2172	lvx	0,3,6
2173	addi	3,3,16
2174	mtctr	9
2175
2176	cmpldi	5,16
2177	blt	.Ltail_xts_dec
2178
2179
2180.align	5
2181.Loop_xts_dec:
2182	vperm	1,0,1,7
2183	.long	0x10420D48
2184	lvx	1,3,6
2185	addi	3,3,16
2186	vperm	0,1,0,7
2187	.long	0x10420548
2188	lvx	0,3,6
2189	addi	3,3,16
2190	bdnz	.Loop_xts_dec
2191
2192	vperm	1,0,1,7
2193	.long	0x10420D48
2194	lvx	1,3,6
2195	li	3,16
2196	vperm	0,1,0,7
2197	vxor	0,0,8
2198	.long	0x10620549
2199
2200	vperm	11,3,3,6
2201
2202	.long	0x7D602799
2203
2204	addi	4,4,16
2205
2206	subic.	5,5,16
2207	beq	.Lxts_dec_done
2208
2209	vor	2,4,4
2210	lvx	4,0,10
2211	addi	10,10,16
2212	lvx	0,0,6
2213	lvx	1,3,6
2214	addi	3,3,16
2215
2216	vsrab	11,8,9
2217	vaddubm	8,8,8
2218	vsldoi	11,11,11,15
2219	vand	11,11,10
2220	vxor	8,8,11
2221
2222	vperm	2,2,4,5
2223	vperm	0,1,0,7
2224	vxor	2,2,8
2225	vxor	2,2,0
2226	lvx	0,3,6
2227	addi	3,3,16
2228
2229	mtctr	9
2230	cmpldi	5,16
2231	bge	.Loop_xts_dec
2232
2233.Ltail_xts_dec:
2234	vsrab	11,8,9
2235	vaddubm	12,8,8
2236	vsldoi	11,11,11,15
2237	vand	11,11,10
2238	vxor	12,12,11
2239
2240	subi	10,10,16
2241	add	10,10,5
2242
2243	vxor	2,2,8
2244	vxor	2,2,12
2245
2246.Loop_xts_dec_short:
2247	vperm	1,0,1,7
2248	.long	0x10420D48
2249	lvx	1,3,6
2250	addi	3,3,16
2251	vperm	0,1,0,7
2252	.long	0x10420548
2253	lvx	0,3,6
2254	addi	3,3,16
2255	bdnz	.Loop_xts_dec_short
2256
2257	vperm	1,0,1,7
2258	.long	0x10420D48
2259	lvx	1,3,6
2260	li	3,16
2261	vperm	0,1,0,7
2262	vxor	0,0,12
2263	.long	0x10620549
2264
2265	vperm	11,3,3,6
2266
2267	.long	0x7D602799
2268
2269
2270	vor	2,4,4
2271	lvx	4,0,10
2272
2273	lvx	0,0,6
2274	lvx	1,3,6
2275	addi	3,3,16
2276	vperm	2,2,4,5
2277	vperm	0,1,0,7
2278
2279	lvsr	5,0,5
2280	vxor	4,4,4
2281	vspltisb	11,-1
2282	vperm	4,4,11,5
2283	vsel	2,2,3,4
2284
2285	vxor	0,0,8
2286	vxor	2,2,0
2287	lvx	0,3,6
2288	addi	3,3,16
2289
2290	subi	11,4,1
2291	mtctr	5
2292	li	5,16
2293.Loop_xts_dec_steal:
2294	lbzu	0,1(11)
2295	stb	0,16(11)
2296	bdnz	.Loop_xts_dec_steal
2297
2298	mtctr	9
2299	b	.Loop_xts_dec
2300
2301.Lxts_dec_done:
2302	cmpldi	8,0
2303	beq	.Lxts_dec_ret
2304
2305	vsrab	11,8,9
2306	vaddubm	8,8,8
2307	vsldoi	11,11,11,15
2308	vand	11,11,10
2309	vxor	8,8,11
2310
2311	vperm	8,8,8,6
2312	.long	0x7D004799
2313
2314.Lxts_dec_ret:
2315	or	12,12,12
2316	li	3,0
2317	blr
2318.long	0
2319.byte	0,12,0x04,0,0x80,6,6,0
2320.long	0
2321.size	aes_p8_xts_decrypt,.-aes_p8_xts_decrypt
2322.align	5
2323_aesp8_xts_encrypt6x:
2324	stdu	1,-448(1)
2325	mflr	11
2326	li	7,207
2327	li	3,223
2328	std	11,464(1)
2329	stvx	20,7,1
2330	addi	7,7,32
2331	stvx	21,3,1
2332	addi	3,3,32
2333	stvx	22,7,1
2334	addi	7,7,32
2335	stvx	23,3,1
2336	addi	3,3,32
2337	stvx	24,7,1
2338	addi	7,7,32
2339	stvx	25,3,1
2340	addi	3,3,32
2341	stvx	26,7,1
2342	addi	7,7,32
2343	stvx	27,3,1
2344	addi	3,3,32
2345	stvx	28,7,1
2346	addi	7,7,32
2347	stvx	29,3,1
2348	addi	3,3,32
2349	stvx	30,7,1
2350	stvx	31,3,1
2351	li	0,-1
2352	stw	12,396(1)
2353	li	3,0x10
2354	std	26,400(1)
2355	li	26,0x20
2356	std	27,408(1)
2357	li	27,0x30
2358	std	28,416(1)
2359	li	28,0x40
2360	std	29,424(1)
2361	li	29,0x50
2362	std	30,432(1)
2363	li	30,0x60
2364	std	31,440(1)
2365	li	31,0x70
2366	or	0,0,0
2367
2368
2369	xxlor	2, 32+10, 32+10
2370	vsldoi	10,11,10,1
2371	xxlor	1, 32+10, 32+10
2372
2373
2374	mr	31, 6
2375	bl	.Lconsts
2376	lxvw4x	0, 28, 6
2377	mr	6, 31
2378	li	31,0x70
2379
2380	subi	9,9,3
2381
2382	lvx	23,0,6
2383	lvx	30,3,6
2384	addi	6,6,0x20
2385	lvx	31,0,6
2386	vperm	23,30,23,7
2387	addi	7,1,64+15
2388	mtctr	9
2389
2390.Load_xts_enc_key:
2391	vperm	24,31,30,7
2392	lvx	30,3,6
2393	addi	6,6,0x20
2394	stvx	24,0,7
2395	vperm	25,30,31,7
2396	lvx	31,0,6
2397	stvx	25,3,7
2398	addi	7,7,0x20
2399	bdnz	.Load_xts_enc_key
2400
2401	lvx	26,3,6
2402	vperm	24,31,30,7
2403	lvx	27,26,6
2404	stvx	24,0,7
2405	vperm	25,26,31,7
2406	lvx	28,27,6
2407	stvx	25,3,7
2408	addi	7,1,64+15
2409	vperm	26,27,26,7
2410	lvx	29,28,6
2411	vperm	27,28,27,7
2412	lvx	30,29,6
2413	vperm	28,29,28,7
2414	lvx	31,30,6
2415	vperm	29,30,29,7
2416	lvx	22,31,6
2417	vperm	30,31,30,7
2418	lvx	24,0,7
2419	vperm	31,22,31,7
2420	lvx	25,3,7
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430	vperm	0,2,4,5
2431	subi	10,10,31
2432	vxor	17,8,23
2433	vsrab	11,8,9
2434	vaddubm	8,8,8
2435	vand	11,11,10
2436	vxor	7,0,17
2437	xxlor	32+1, 0, 0
2438	vpermxor	8, 8, 11, 1
2439
2440	.long	0x7C235699
2441	vxor	18,8,23
2442	vsrab	11,8,9
2443	vaddubm	8,8,8
2444	vperm	1,1,1,6
2445	vand	11,11,10
2446	vxor	12,1,18
2447	xxlor	32+2, 0, 0
2448	vpermxor	8, 8, 11, 2
2449
2450	.long	0x7C5A5699
2451	andi.	31,5,15
2452	vxor	19,8,23
2453	vsrab	11,8,9
2454	vaddubm	8,8,8
2455	vperm	2,2,2,6
2456	vand	11,11,10
2457	vxor	13,2,19
2458	xxlor	32+3, 0, 0
2459	vpermxor	8, 8, 11, 3
2460
2461	.long	0x7C7B5699
2462	sub	5,5,31
2463	vxor	20,8,23
2464	vsrab	11,8,9
2465	vaddubm	8,8,8
2466	vperm	3,3,3,6
2467	vand	11,11,10
2468	vxor	14,3,20
2469	xxlor	32+4, 0, 0
2470	vpermxor	8, 8, 11, 4
2471
2472	.long	0x7C9C5699
2473	subi	5,5,0x60
2474	vxor	21,8,23
2475	vsrab	11,8,9
2476	vaddubm	8,8,8
2477	vperm	4,4,4,6
2478	vand	11,11,10
2479	vxor	15,4,21
2480	xxlor	32+5, 0, 0
2481	vpermxor	8, 8, 11, 5
2482
2483	.long	0x7CBD5699
2484	addi	10,10,0x60
2485	vxor	22,8,23
2486	vsrab	11,8,9
2487	vaddubm	8,8,8
2488	vperm	5,5,5,6
2489	vand	11,11,10
2490	vxor	16,5,22
2491	xxlor	32+0, 0, 0
2492	vpermxor	8, 8, 11, 0
2493
2494	vxor	31,31,23
2495	mtctr	9
2496	b	.Loop_xts_enc6x
2497
2498.align	5
2499.Loop_xts_enc6x:
2500	.long	0x10E7C508
2501	.long	0x118CC508
2502	.long	0x11ADC508
2503	.long	0x11CEC508
2504	.long	0x11EFC508
2505	.long	0x1210C508
2506	lvx	24,26,7
2507	addi	7,7,0x20
2508
2509	.long	0x10E7CD08
2510	.long	0x118CCD08
2511	.long	0x11ADCD08
2512	.long	0x11CECD08
2513	.long	0x11EFCD08
2514	.long	0x1210CD08
2515	lvx	25,3,7
2516	bdnz	.Loop_xts_enc6x
2517
2518	xxlor	32+10, 1, 1
2519
2520	subic	5,5,96
2521	vxor	0,17,31
2522	.long	0x10E7C508
2523	.long	0x118CC508
2524	vsrab	11,8,9
2525	vxor	17,8,23
2526	vaddubm	8,8,8
2527	.long	0x11ADC508
2528	.long	0x11CEC508
2529	.long	0x11EFC508
2530	.long	0x1210C508
2531
2532	subfe.	0,0,0
2533	vand	11,11,10
2534	.long	0x10E7CD08
2535	.long	0x118CCD08
2536	xxlor	32+1, 0, 0
2537	vpermxor	8, 8, 11, 1
2538	.long	0x11ADCD08
2539	.long	0x11CECD08
2540	vxor	1,18,31
2541	vsrab	11,8,9
2542	vxor	18,8,23
2543	.long	0x11EFCD08
2544	.long	0x1210CD08
2545
2546	and	0,0,5
2547	vaddubm	8,8,8
2548	.long	0x10E7D508
2549	.long	0x118CD508
2550	vand	11,11,10
2551	.long	0x11ADD508
2552	.long	0x11CED508
2553	xxlor	32+2, 0, 0
2554	vpermxor	8, 8, 11, 2
2555	.long	0x11EFD508
2556	.long	0x1210D508
2557
2558	add	10,10,0
2559
2560
2561
2562	vxor	2,19,31
2563	vsrab	11,8,9
2564	vxor	19,8,23
2565	vaddubm	8,8,8
2566	.long	0x10E7DD08
2567	.long	0x118CDD08
2568	.long	0x11ADDD08
2569	.long	0x11CEDD08
2570	vand	11,11,10
2571	.long	0x11EFDD08
2572	.long	0x1210DD08
2573
2574	addi	7,1,64+15
2575	xxlor	32+3, 0, 0
2576	vpermxor	8, 8, 11, 3
2577	.long	0x10E7E508
2578	.long	0x118CE508
2579	vxor	3,20,31
2580	vsrab	11,8,9
2581	vxor	20,8,23
2582	.long	0x11ADE508
2583	.long	0x11CEE508
2584	vaddubm	8,8,8
2585	.long	0x11EFE508
2586	.long	0x1210E508
2587	lvx	24,0,7
2588	vand	11,11,10
2589
2590	.long	0x10E7ED08
2591	.long	0x118CED08
2592	xxlor	32+4, 0, 0
2593	vpermxor	8, 8, 11, 4
2594	.long	0x11ADED08
2595	.long	0x11CEED08
2596	vxor	4,21,31
2597	vsrab	11,8,9
2598	vxor	21,8,23
2599	.long	0x11EFED08
2600	.long	0x1210ED08
2601	lvx	25,3,7
2602	vaddubm	8,8,8
2603
2604	.long	0x10E7F508
2605	.long	0x118CF508
2606	vand	11,11,10
2607	.long	0x11ADF508
2608	.long	0x11CEF508
2609	xxlor	32+5, 0, 0
2610	vpermxor	8, 8, 11, 5
2611	.long	0x11EFF508
2612	.long	0x1210F508
2613	vxor	5,22,31
2614	vsrab	11,8,9
2615	vxor	22,8,23
2616
2617	.long	0x10E70509
2618	.long	0x7C005699
2619	vaddubm	8,8,8
2620	.long	0x118C0D09
2621	.long	0x7C235699
2622	.long	0x11AD1509
2623	vperm	0,0,0,6
2624	.long	0x7C5A5699
2625	vand	11,11,10
2626	.long	0x11CE1D09
2627	vperm	1,1,1,6
2628	.long	0x7C7B5699
2629	.long	0x11EF2509
2630	vperm	2,2,2,6
2631	.long	0x7C9C5699
2632	xxlor	10, 32+0, 32+0
2633	xxlor	32+0, 0, 0
2634	vpermxor	8, 8, 11, 0
2635	xxlor	32+0, 10, 10
2636	.long	0x11702D09
2637
2638	vperm	3,3,3,6
2639	.long	0x7CBD5699
2640	addi	10,10,0x60
2641	vperm	4,4,4,6
2642	vperm	5,5,5,6
2643
2644	vperm	7,7,7,6
2645	vperm	12,12,12,6
2646	.long	0x7CE02799
2647	vxor	7,0,17
2648	vperm	13,13,13,6
2649	.long	0x7D832799
2650	vxor	12,1,18
2651	vperm	14,14,14,6
2652	.long	0x7DBA2799
2653	vxor	13,2,19
2654	vperm	15,15,15,6
2655	.long	0x7DDB2799
2656	vxor	14,3,20
2657	vperm	16,11,11,6
2658	.long	0x7DFC2799
2659	vxor	15,4,21
2660	.long	0x7E1D2799
2661
2662	vxor	16,5,22
2663	addi	4,4,0x60
2664
2665	mtctr	9
2666	beq	.Loop_xts_enc6x
2667
2668	xxlor	32+10, 2, 2
2669
2670	addic.	5,5,0x60
2671	beq	.Lxts_enc6x_zero
2672	cmpwi	5,0x20
2673	blt	.Lxts_enc6x_one
2674	nop
2675	beq	.Lxts_enc6x_two
2676	cmpwi	5,0x40
2677	blt	.Lxts_enc6x_three
2678	nop
2679	beq	.Lxts_enc6x_four
2680
2681.Lxts_enc6x_five:
2682	vxor	7,1,17
2683	vxor	12,2,18
2684	vxor	13,3,19
2685	vxor	14,4,20
2686	vxor	15,5,21
2687
2688	bl	_aesp8_xts_enc5x
2689
2690	vperm	7,7,7,6
2691	vor	17,22,22
2692	vperm	12,12,12,6
2693	.long	0x7CE02799
2694	vperm	13,13,13,6
2695	.long	0x7D832799
2696	vperm	14,14,14,6
2697	.long	0x7DBA2799
2698	vxor	11,15,22
2699	vperm	15,15,15,6
2700	.long	0x7DDB2799
2701	.long	0x7DFC2799
2702	addi	4,4,0x50
2703	bne	.Lxts_enc6x_steal
2704	b	.Lxts_enc6x_done
2705
2706.align	4
2707.Lxts_enc6x_four:
2708	vxor	7,2,17
2709	vxor	12,3,18
2710	vxor	13,4,19
2711	vxor	14,5,20
2712	vxor	15,15,15
2713
2714	bl	_aesp8_xts_enc5x
2715
2716	vperm	7,7,7,6
2717	vor	17,21,21
2718	vperm	12,12,12,6
2719	.long	0x7CE02799
2720	vperm	13,13,13,6
2721	.long	0x7D832799
2722	vxor	11,14,21
2723	vperm	14,14,14,6
2724	.long	0x7DBA2799
2725	.long	0x7DDB2799
2726	addi	4,4,0x40
2727	bne	.Lxts_enc6x_steal
2728	b	.Lxts_enc6x_done
2729
2730.align	4
2731.Lxts_enc6x_three:
2732	vxor	7,3,17
2733	vxor	12,4,18
2734	vxor	13,5,19
2735	vxor	14,14,14
2736	vxor	15,15,15
2737
2738	bl	_aesp8_xts_enc5x
2739
2740	vperm	7,7,7,6
2741	vor	17,20,20
2742	vperm	12,12,12,6
2743	.long	0x7CE02799
2744	vxor	11,13,20
2745	vperm	13,13,13,6
2746	.long	0x7D832799
2747	.long	0x7DBA2799
2748	addi	4,4,0x30
2749	bne	.Lxts_enc6x_steal
2750	b	.Lxts_enc6x_done
2751
2752.align	4
2753.Lxts_enc6x_two:
2754	vxor	7,4,17
2755	vxor	12,5,18
2756	vxor	13,13,13
2757	vxor	14,14,14
2758	vxor	15,15,15
2759
2760	bl	_aesp8_xts_enc5x
2761
2762	vperm	7,7,7,6
2763	vor	17,19,19
2764	vxor	11,12,19
2765	vperm	12,12,12,6
2766	.long	0x7CE02799
2767	.long	0x7D832799
2768	addi	4,4,0x20
2769	bne	.Lxts_enc6x_steal
2770	b	.Lxts_enc6x_done
2771
2772.align	4
2773.Lxts_enc6x_one:
2774	vxor	7,5,17
2775	nop
2776.Loop_xts_enc1x:
2777	.long	0x10E7C508
2778	lvx	24,26,7
2779	addi	7,7,0x20
2780
2781	.long	0x10E7CD08
2782	lvx	25,3,7
2783	bdnz	.Loop_xts_enc1x
2784
2785	add	10,10,31
2786	cmpwi	31,0
2787	.long	0x10E7C508
2788
2789	subi	10,10,16
2790	.long	0x10E7CD08
2791
2792	lvsr	5,0,31
2793	.long	0x10E7D508
2794
2795	.long	0x7C005699
2796	.long	0x10E7DD08
2797
2798	addi	7,1,64+15
2799	.long	0x10E7E508
2800	lvx	24,0,7
2801
2802	.long	0x10E7ED08
2803	lvx	25,3,7
2804	vxor	17,17,31
2805
2806	vperm	0,0,0,6
2807	.long	0x10E7F508
2808
2809	vperm	0,0,0,5
2810	.long	0x10E78D09
2811
2812	vor	17,18,18
2813	vxor	11,7,18
2814	vperm	7,7,7,6
2815	.long	0x7CE02799
2816	addi	4,4,0x10
2817	bne	.Lxts_enc6x_steal
2818	b	.Lxts_enc6x_done
2819
2820.align	4
2821.Lxts_enc6x_zero:
2822	cmpwi	31,0
2823	beq	.Lxts_enc6x_done
2824
2825	add	10,10,31
2826	subi	10,10,16
2827	.long	0x7C005699
2828	lvsr	5,0,31
2829	vperm	0,0,0,6
2830	vperm	0,0,0,5
2831	vxor	11,11,17
2832.Lxts_enc6x_steal:
2833	vxor	0,0,17
2834	vxor	7,7,7
2835	vspltisb	12,-1
2836	vperm	7,7,12,5
2837	vsel	7,0,11,7
2838
2839	subi	30,4,17
2840	subi	4,4,16
2841	mtctr	31
2842.Loop_xts_enc6x_steal:
2843	lbzu	0,1(30)
2844	stb	0,16(30)
2845	bdnz	.Loop_xts_enc6x_steal
2846
2847	li	31,0
2848	mtctr	9
2849	b	.Loop_xts_enc1x
2850
2851.align	4
2852.Lxts_enc6x_done:
2853	cmpldi	8,0
2854	beq	.Lxts_enc6x_ret
2855
2856	vxor	8,17,23
2857	vperm	8,8,8,6
2858	.long	0x7D004799
2859
2860.Lxts_enc6x_ret:
2861	mtlr	11
2862	li	10,79
2863	li	11,95
2864	stvx	9,10,1
2865	addi	10,10,32
2866	stvx	9,11,1
2867	addi	11,11,32
2868	stvx	9,10,1
2869	addi	10,10,32
2870	stvx	9,11,1
2871	addi	11,11,32
2872	stvx	9,10,1
2873	addi	10,10,32
2874	stvx	9,11,1
2875	addi	11,11,32
2876	stvx	9,10,1
2877	addi	10,10,32
2878	stvx	9,11,1
2879	addi	11,11,32
2880
2881	or	12,12,12
2882	lvx	20,10,1
2883	addi	10,10,32
2884	lvx	21,11,1
2885	addi	11,11,32
2886	lvx	22,10,1
2887	addi	10,10,32
2888	lvx	23,11,1
2889	addi	11,11,32
2890	lvx	24,10,1
2891	addi	10,10,32
2892	lvx	25,11,1
2893	addi	11,11,32
2894	lvx	26,10,1
2895	addi	10,10,32
2896	lvx	27,11,1
2897	addi	11,11,32
2898	lvx	28,10,1
2899	addi	10,10,32
2900	lvx	29,11,1
2901	addi	11,11,32
2902	lvx	30,10,1
2903	lvx	31,11,1
2904	ld	26,400(1)
2905	ld	27,408(1)
2906	ld	28,416(1)
2907	ld	29,424(1)
2908	ld	30,432(1)
2909	ld	31,440(1)
2910	addi	1,1,448
2911	blr
2912.long	0
2913.byte	0,12,0x04,1,0x80,6,6,0
2914.long	0
2915
2916.align	5
2917_aesp8_xts_enc5x:
2918	.long	0x10E7C508
2919	.long	0x118CC508
2920	.long	0x11ADC508
2921	.long	0x11CEC508
2922	.long	0x11EFC508
2923	lvx	24,26,7
2924	addi	7,7,0x20
2925
2926	.long	0x10E7CD08
2927	.long	0x118CCD08
2928	.long	0x11ADCD08
2929	.long	0x11CECD08
2930	.long	0x11EFCD08
2931	lvx	25,3,7
2932	bdnz	_aesp8_xts_enc5x
2933
2934	add	10,10,31
2935	cmpwi	31,0
2936	.long	0x10E7C508
2937	.long	0x118CC508
2938	.long	0x11ADC508
2939	.long	0x11CEC508
2940	.long	0x11EFC508
2941
2942	subi	10,10,16
2943	.long	0x10E7CD08
2944	.long	0x118CCD08
2945	.long	0x11ADCD08
2946	.long	0x11CECD08
2947	.long	0x11EFCD08
2948	vxor	17,17,31
2949
2950	.long	0x10E7D508
2951	lvsr	5,0,31
2952	.long	0x118CD508
2953	.long	0x11ADD508
2954	.long	0x11CED508
2955	.long	0x11EFD508
2956	vxor	1,18,31
2957
2958	.long	0x10E7DD08
2959	.long	0x7C005699
2960	.long	0x118CDD08
2961	.long	0x11ADDD08
2962	.long	0x11CEDD08
2963	.long	0x11EFDD08
2964	vxor	2,19,31
2965
2966	addi	7,1,64+15
2967	.long	0x10E7E508
2968	.long	0x118CE508
2969	.long	0x11ADE508
2970	.long	0x11CEE508
2971	.long	0x11EFE508
2972	lvx	24,0,7
2973	vxor	3,20,31
2974
2975	.long	0x10E7ED08
2976	vperm	0,0,0,6
2977	.long	0x118CED08
2978	.long	0x11ADED08
2979	.long	0x11CEED08
2980	.long	0x11EFED08
2981	lvx	25,3,7
2982	vxor	4,21,31
2983
2984	.long	0x10E7F508
2985	vperm	0,0,0,5
2986	.long	0x118CF508
2987	.long	0x11ADF508
2988	.long	0x11CEF508
2989	.long	0x11EFF508
2990
2991	.long	0x10E78D09
2992	.long	0x118C0D09
2993	.long	0x11AD1509
2994	.long	0x11CE1D09
2995	.long	0x11EF2509
2996	blr
2997.long	0
2998.byte	0,12,0x14,0,0,0,0,0
2999
3000.align	5
3001_aesp8_xts_decrypt6x:
3002	stdu	1,-448(1)
3003	mflr	11
3004	li	7,207
3005	li	3,223
3006	std	11,464(1)
3007	stvx	20,7,1
3008	addi	7,7,32
3009	stvx	21,3,1
3010	addi	3,3,32
3011	stvx	22,7,1
3012	addi	7,7,32
3013	stvx	23,3,1
3014	addi	3,3,32
3015	stvx	24,7,1
3016	addi	7,7,32
3017	stvx	25,3,1
3018	addi	3,3,32
3019	stvx	26,7,1
3020	addi	7,7,32
3021	stvx	27,3,1
3022	addi	3,3,32
3023	stvx	28,7,1
3024	addi	7,7,32
3025	stvx	29,3,1
3026	addi	3,3,32
3027	stvx	30,7,1
3028	stvx	31,3,1
3029	li	0,-1
3030	stw	12,396(1)
3031	li	3,0x10
3032	std	26,400(1)
3033	li	26,0x20
3034	std	27,408(1)
3035	li	27,0x30
3036	std	28,416(1)
3037	li	28,0x40
3038	std	29,424(1)
3039	li	29,0x50
3040	std	30,432(1)
3041	li	30,0x60
3042	std	31,440(1)
3043	li	31,0x70
3044	or	0,0,0
3045
3046
3047	xxlor	2, 32+10, 32+10
3048	vsldoi	10,11,10,1
3049	xxlor	1, 32+10, 32+10
3050
3051
3052	mr	31, 6
3053	bl	.Lconsts
3054	lxvw4x	0, 28, 6
3055	mr	6, 31
3056	li	31,0x70
3057
3058	subi	9,9,3
3059
3060	lvx	23,0,6
3061	lvx	30,3,6
3062	addi	6,6,0x20
3063	lvx	31,0,6
3064	vperm	23,30,23,7
3065	addi	7,1,64+15
3066	mtctr	9
3067
3068.Load_xts_dec_key:
3069	vperm	24,31,30,7
3070	lvx	30,3,6
3071	addi	6,6,0x20
3072	stvx	24,0,7
3073	vperm	25,30,31,7
3074	lvx	31,0,6
3075	stvx	25,3,7
3076	addi	7,7,0x20
3077	bdnz	.Load_xts_dec_key
3078
3079	lvx	26,3,6
3080	vperm	24,31,30,7
3081	lvx	27,26,6
3082	stvx	24,0,7
3083	vperm	25,26,31,7
3084	lvx	28,27,6
3085	stvx	25,3,7
3086	addi	7,1,64+15
3087	vperm	26,27,26,7
3088	lvx	29,28,6
3089	vperm	27,28,27,7
3090	lvx	30,29,6
3091	vperm	28,29,28,7
3092	lvx	31,30,6
3093	vperm	29,30,29,7
3094	lvx	22,31,6
3095	vperm	30,31,30,7
3096	lvx	24,0,7
3097	vperm	31,22,31,7
3098	lvx	25,3,7
3099
3100	vperm	0,2,4,5
3101	subi	10,10,31
3102	vxor	17,8,23
3103	vsrab	11,8,9
3104	vaddubm	8,8,8
3105	vand	11,11,10
3106	vxor	7,0,17
3107	xxlor	32+1, 0, 0
3108	vpermxor	8, 8, 11, 1
3109
3110	.long	0x7C235699
3111	vxor	18,8,23
3112	vsrab	11,8,9
3113	vaddubm	8,8,8
3114	vperm	1,1,1,6
3115	vand	11,11,10
3116	vxor	12,1,18
3117	xxlor	32+2, 0, 0
3118	vpermxor	8, 8, 11, 2
3119
3120	.long	0x7C5A5699
3121	andi.	31,5,15
3122	vxor	19,8,23
3123	vsrab	11,8,9
3124	vaddubm	8,8,8
3125	vperm	2,2,2,6
3126	vand	11,11,10
3127	vxor	13,2,19
3128	xxlor	32+3, 0, 0
3129	vpermxor	8, 8, 11, 3
3130
3131	.long	0x7C7B5699
3132	sub	5,5,31
3133	vxor	20,8,23
3134	vsrab	11,8,9
3135	vaddubm	8,8,8
3136	vperm	3,3,3,6
3137	vand	11,11,10
3138	vxor	14,3,20
3139	xxlor	32+4, 0, 0
3140	vpermxor	8, 8, 11, 4
3141
3142	.long	0x7C9C5699
3143	subi	5,5,0x60
3144	vxor	21,8,23
3145	vsrab	11,8,9
3146	vaddubm	8,8,8
3147	vperm	4,4,4,6
3148	vand	11,11,10
3149	vxor	15,4,21
3150	xxlor	32+5, 0, 0
3151	vpermxor	8, 8, 11, 5
3152
3153	.long	0x7CBD5699
3154	addi	10,10,0x60
3155	vxor	22,8,23
3156	vsrab	11,8,9
3157	vaddubm	8,8,8
3158	vperm	5,5,5,6
3159	vand	11,11,10
3160	vxor	16,5,22
3161	xxlor	32+0, 0, 0
3162	vpermxor	8, 8, 11, 0
3163
3164	vxor	31,31,23
3165	mtctr	9
3166	b	.Loop_xts_dec6x
3167
3168.align	5
3169.Loop_xts_dec6x:
3170	.long	0x10E7C548
3171	.long	0x118CC548
3172	.long	0x11ADC548
3173	.long	0x11CEC548
3174	.long	0x11EFC548
3175	.long	0x1210C548
3176	lvx	24,26,7
3177	addi	7,7,0x20
3178
3179	.long	0x10E7CD48
3180	.long	0x118CCD48
3181	.long	0x11ADCD48
3182	.long	0x11CECD48
3183	.long	0x11EFCD48
3184	.long	0x1210CD48
3185	lvx	25,3,7
3186	bdnz	.Loop_xts_dec6x
3187
3188	xxlor	32+10, 1, 1
3189
3190	subic	5,5,96
3191	vxor	0,17,31
3192	.long	0x10E7C548
3193	.long	0x118CC548
3194	vsrab	11,8,9
3195	vxor	17,8,23
3196	vaddubm	8,8,8
3197	.long	0x11ADC548
3198	.long	0x11CEC548
3199	.long	0x11EFC548
3200	.long	0x1210C548
3201
3202	subfe.	0,0,0
3203	vand	11,11,10
3204	.long	0x10E7CD48
3205	.long	0x118CCD48
3206	xxlor	32+1, 0, 0
3207	vpermxor	8, 8, 11, 1
3208	.long	0x11ADCD48
3209	.long	0x11CECD48
3210	vxor	1,18,31
3211	vsrab	11,8,9
3212	vxor	18,8,23
3213	.long	0x11EFCD48
3214	.long	0x1210CD48
3215
3216	and	0,0,5
3217	vaddubm	8,8,8
3218	.long	0x10E7D548
3219	.long	0x118CD548
3220	vand	11,11,10
3221	.long	0x11ADD548
3222	.long	0x11CED548
3223	xxlor	32+2, 0, 0
3224	vpermxor	8, 8, 11, 2
3225	.long	0x11EFD548
3226	.long	0x1210D548
3227
3228	add	10,10,0
3229
3230
3231
3232	vxor	2,19,31
3233	vsrab	11,8,9
3234	vxor	19,8,23
3235	vaddubm	8,8,8
3236	.long	0x10E7DD48
3237	.long	0x118CDD48
3238	.long	0x11ADDD48
3239	.long	0x11CEDD48
3240	vand	11,11,10
3241	.long	0x11EFDD48
3242	.long	0x1210DD48
3243
3244	addi	7,1,64+15
3245	xxlor	32+3, 0, 0
3246	vpermxor	8, 8, 11, 3
3247	.long	0x10E7E548
3248	.long	0x118CE548
3249	vxor	3,20,31
3250	vsrab	11,8,9
3251	vxor	20,8,23
3252	.long	0x11ADE548
3253	.long	0x11CEE548
3254	vaddubm	8,8,8
3255	.long	0x11EFE548
3256	.long	0x1210E548
3257	lvx	24,0,7
3258	vand	11,11,10
3259
3260	.long	0x10E7ED48
3261	.long	0x118CED48
3262	xxlor	32+4, 0, 0
3263	vpermxor	8, 8, 11, 4
3264	.long	0x11ADED48
3265	.long	0x11CEED48
3266	vxor	4,21,31
3267	vsrab	11,8,9
3268	vxor	21,8,23
3269	.long	0x11EFED48
3270	.long	0x1210ED48
3271	lvx	25,3,7
3272	vaddubm	8,8,8
3273
3274	.long	0x10E7F548
3275	.long	0x118CF548
3276	vand	11,11,10
3277	.long	0x11ADF548
3278	.long	0x11CEF548
3279	xxlor	32+5, 0, 0
3280	vpermxor	8, 8, 11, 5
3281	.long	0x11EFF548
3282	.long	0x1210F548
3283	vxor	5,22,31
3284	vsrab	11,8,9
3285	vxor	22,8,23
3286
3287	.long	0x10E70549
3288	.long	0x7C005699
3289	vaddubm	8,8,8
3290	.long	0x118C0D49
3291	.long	0x7C235699
3292	.long	0x11AD1549
3293	vperm	0,0,0,6
3294	.long	0x7C5A5699
3295	vand	11,11,10
3296	.long	0x11CE1D49
3297	vperm	1,1,1,6
3298	.long	0x7C7B5699
3299	.long	0x11EF2549
3300	vperm	2,2,2,6
3301	.long	0x7C9C5699
3302	xxlor	10, 32+0, 32+0
3303	xxlor	32+0, 0, 0
3304	vpermxor	8, 8, 11, 0
3305	xxlor	32+0, 10, 10
3306	.long	0x12102D49
3307	vperm	3,3,3,6
3308	.long	0x7CBD5699
3309	addi	10,10,0x60
3310	vperm	4,4,4,6
3311	vperm	5,5,5,6
3312
3313	vperm	7,7,7,6
3314	vperm	12,12,12,6
3315	.long	0x7CE02799
3316	vxor	7,0,17
3317	vperm	13,13,13,6
3318	.long	0x7D832799
3319	vxor	12,1,18
3320	vperm	14,14,14,6
3321	.long	0x7DBA2799
3322	vxor	13,2,19
3323	vperm	15,15,15,6
3324	.long	0x7DDB2799
3325	vxor	14,3,20
3326	vperm	16,16,16,6
3327	.long	0x7DFC2799
3328	vxor	15,4,21
3329	.long	0x7E1D2799
3330	vxor	16,5,22
3331	addi	4,4,0x60
3332
3333	mtctr	9
3334	beq	.Loop_xts_dec6x
3335
3336	xxlor	32+10, 2, 2
3337
3338	addic.	5,5,0x60
3339	beq	.Lxts_dec6x_zero
3340	cmpwi	5,0x20
3341	blt	.Lxts_dec6x_one
3342	nop
3343	beq	.Lxts_dec6x_two
3344	cmpwi	5,0x40
3345	blt	.Lxts_dec6x_three
3346	nop
3347	beq	.Lxts_dec6x_four
3348
3349.Lxts_dec6x_five:
3350	vxor	7,1,17
3351	vxor	12,2,18
3352	vxor	13,3,19
3353	vxor	14,4,20
3354	vxor	15,5,21
3355
3356	bl	_aesp8_xts_dec5x
3357
3358	vperm	7,7,7,6
3359	vor	17,22,22
3360	vxor	18,8,23
3361	vperm	12,12,12,6
3362	.long	0x7CE02799
3363	vxor	7,0,18
3364	vperm	13,13,13,6
3365	.long	0x7D832799
3366	vperm	14,14,14,6
3367	.long	0x7DBA2799
3368	vperm	15,15,15,6
3369	.long	0x7DDB2799
3370	.long	0x7DFC2799
3371	addi	4,4,0x50
3372	bne	.Lxts_dec6x_steal
3373	b	.Lxts_dec6x_done
3374
3375.align	4
3376.Lxts_dec6x_four:
3377	vxor	7,2,17
3378	vxor	12,3,18
3379	vxor	13,4,19
3380	vxor	14,5,20
3381	vxor	15,15,15
3382
3383	bl	_aesp8_xts_dec5x
3384
3385	vperm	7,7,7,6
3386	vor	17,21,21
3387	vor	18,22,22
3388	vperm	12,12,12,6
3389	.long	0x7CE02799
3390	vxor	7,0,22
3391	vperm	13,13,13,6
3392	.long	0x7D832799
3393	vperm	14,14,14,6
3394	.long	0x7DBA2799
3395	.long	0x7DDB2799
3396	addi	4,4,0x40
3397	bne	.Lxts_dec6x_steal
3398	b	.Lxts_dec6x_done
3399
3400.align	4
3401.Lxts_dec6x_three:
3402	vxor	7,3,17
3403	vxor	12,4,18
3404	vxor	13,5,19
3405	vxor	14,14,14
3406	vxor	15,15,15
3407
3408	bl	_aesp8_xts_dec5x
3409
3410	vperm	7,7,7,6
3411	vor	17,20,20
3412	vor	18,21,21
3413	vperm	12,12,12,6
3414	.long	0x7CE02799
3415	vxor	7,0,21
3416	vperm	13,13,13,6
3417	.long	0x7D832799
3418	.long	0x7DBA2799
3419	addi	4,4,0x30
3420	bne	.Lxts_dec6x_steal
3421	b	.Lxts_dec6x_done
3422
3423.align	4
3424.Lxts_dec6x_two:
3425	vxor	7,4,17
3426	vxor	12,5,18
3427	vxor	13,13,13
3428	vxor	14,14,14
3429	vxor	15,15,15
3430
3431	bl	_aesp8_xts_dec5x
3432
3433	vperm	7,7,7,6
3434	vor	17,19,19
3435	vor	18,20,20
3436	vperm	12,12,12,6
3437	.long	0x7CE02799
3438	vxor	7,0,20
3439	.long	0x7D832799
3440	addi	4,4,0x20
3441	bne	.Lxts_dec6x_steal
3442	b	.Lxts_dec6x_done
3443
3444.align	4
3445.Lxts_dec6x_one:
3446	vxor	7,5,17
3447	nop
3448.Loop_xts_dec1x:
3449	.long	0x10E7C548
3450	lvx	24,26,7
3451	addi	7,7,0x20
3452
3453	.long	0x10E7CD48
3454	lvx	25,3,7
3455	bdnz	.Loop_xts_dec1x
3456
3457	subi	0,31,1
3458	.long	0x10E7C548
3459
3460	andi.	0,0,16
3461	cmpwi	31,0
3462	.long	0x10E7CD48
3463
3464	sub	10,10,0
3465	.long	0x10E7D548
3466
3467	.long	0x7C005699
3468	.long	0x10E7DD48
3469
3470	addi	7,1,64+15
3471	.long	0x10E7E548
3472	lvx	24,0,7
3473
3474	.long	0x10E7ED48
3475	lvx	25,3,7
3476	vxor	17,17,31
3477
3478	vperm	0,0,0,6
3479	.long	0x10E7F548
3480
3481	mtctr	9
3482	.long	0x10E78D49
3483
3484	vor	17,18,18
3485	vor	18,19,19
3486	vperm	7,7,7,6
3487	.long	0x7CE02799
3488	addi	4,4,0x10
3489	vxor	7,0,19
3490	bne	.Lxts_dec6x_steal
3491	b	.Lxts_dec6x_done
3492
3493.align	4
3494.Lxts_dec6x_zero:
3495	cmpwi	31,0
3496	beq	.Lxts_dec6x_done
3497
3498	.long	0x7C005699
3499	vperm	0,0,0,6
3500	vxor	7,0,18
3501.Lxts_dec6x_steal:
3502	.long	0x10E7C548
3503	lvx	24,26,7
3504	addi	7,7,0x20
3505
3506	.long	0x10E7CD48
3507	lvx	25,3,7
3508	bdnz	.Lxts_dec6x_steal
3509
3510	add	10,10,31
3511	.long	0x10E7C548
3512
3513	cmpwi	31,0
3514	.long	0x10E7CD48
3515
3516	.long	0x7C005699
3517	.long	0x10E7D548
3518
3519	lvsr	5,0,31
3520	.long	0x10E7DD48
3521
3522	addi	7,1,64+15
3523	.long	0x10E7E548
3524	lvx	24,0,7
3525
3526	.long	0x10E7ED48
3527	lvx	25,3,7
3528	vxor	18,18,31
3529
3530	vperm	0,0,0,6
3531	.long	0x10E7F548
3532
3533	vperm	0,0,0,5
3534	.long	0x11679549
3535
3536	vperm	7,11,11,6
3537	.long	0x7CE02799
3538
3539
3540	vxor	7,7,7
3541	vspltisb	12,-1
3542	vperm	7,7,12,5
3543	vsel	7,0,11,7
3544	vxor	7,7,17
3545
3546	subi	30,4,1
3547	mtctr	31
3548.Loop_xts_dec6x_steal:
3549	lbzu	0,1(30)
3550	stb	0,16(30)
3551	bdnz	.Loop_xts_dec6x_steal
3552
3553	li	31,0
3554	mtctr	9
3555	b	.Loop_xts_dec1x
3556
3557.align	4
3558.Lxts_dec6x_done:
3559	cmpldi	8,0
3560	beq	.Lxts_dec6x_ret
3561
3562	vxor	8,17,23
3563	vperm	8,8,8,6
3564	.long	0x7D004799
3565
3566.Lxts_dec6x_ret:
3567	mtlr	11
3568	li	10,79
3569	li	11,95
3570	stvx	9,10,1
3571	addi	10,10,32
3572	stvx	9,11,1
3573	addi	11,11,32
3574	stvx	9,10,1
3575	addi	10,10,32
3576	stvx	9,11,1
3577	addi	11,11,32
3578	stvx	9,10,1
3579	addi	10,10,32
3580	stvx	9,11,1
3581	addi	11,11,32
3582	stvx	9,10,1
3583	addi	10,10,32
3584	stvx	9,11,1
3585	addi	11,11,32
3586
3587	or	12,12,12
3588	lvx	20,10,1
3589	addi	10,10,32
3590	lvx	21,11,1
3591	addi	11,11,32
3592	lvx	22,10,1
3593	addi	10,10,32
3594	lvx	23,11,1
3595	addi	11,11,32
3596	lvx	24,10,1
3597	addi	10,10,32
3598	lvx	25,11,1
3599	addi	11,11,32
3600	lvx	26,10,1
3601	addi	10,10,32
3602	lvx	27,11,1
3603	addi	11,11,32
3604	lvx	28,10,1
3605	addi	10,10,32
3606	lvx	29,11,1
3607	addi	11,11,32
3608	lvx	30,10,1
3609	lvx	31,11,1
3610	ld	26,400(1)
3611	ld	27,408(1)
3612	ld	28,416(1)
3613	ld	29,424(1)
3614	ld	30,432(1)
3615	ld	31,440(1)
3616	addi	1,1,448
3617	blr
3618.long	0
3619.byte	0,12,0x04,1,0x80,6,6,0
3620.long	0
3621
3622.align	5
3623_aesp8_xts_dec5x:
3624	.long	0x10E7C548
3625	.long	0x118CC548
3626	.long	0x11ADC548
3627	.long	0x11CEC548
3628	.long	0x11EFC548
3629	lvx	24,26,7
3630	addi	7,7,0x20
3631
3632	.long	0x10E7CD48
3633	.long	0x118CCD48
3634	.long	0x11ADCD48
3635	.long	0x11CECD48
3636	.long	0x11EFCD48
3637	lvx	25,3,7
3638	bdnz	_aesp8_xts_dec5x
3639
3640	subi	0,31,1
3641	.long	0x10E7C548
3642	.long	0x118CC548
3643	.long	0x11ADC548
3644	.long	0x11CEC548
3645	.long	0x11EFC548
3646
3647	andi.	0,0,16
3648	cmpwi	31,0
3649	.long	0x10E7CD48
3650	.long	0x118CCD48
3651	.long	0x11ADCD48
3652	.long	0x11CECD48
3653	.long	0x11EFCD48
3654	vxor	17,17,31
3655
3656	sub	10,10,0
3657	.long	0x10E7D548
3658	.long	0x118CD548
3659	.long	0x11ADD548
3660	.long	0x11CED548
3661	.long	0x11EFD548
3662	vxor	1,18,31
3663
3664	.long	0x10E7DD48
3665	.long	0x7C005699
3666	.long	0x118CDD48
3667	.long	0x11ADDD48
3668	.long	0x11CEDD48
3669	.long	0x11EFDD48
3670	vxor	2,19,31
3671
3672	addi	7,1,64+15
3673	.long	0x10E7E548
3674	.long	0x118CE548
3675	.long	0x11ADE548
3676	.long	0x11CEE548
3677	.long	0x11EFE548
3678	lvx	24,0,7
3679	vxor	3,20,31
3680
3681	.long	0x10E7ED48
3682	vperm	0,0,0,6
3683	.long	0x118CED48
3684	.long	0x11ADED48
3685	.long	0x11CEED48
3686	.long	0x11EFED48
3687	lvx	25,3,7
3688	vxor	4,21,31
3689
3690	.long	0x10E7F548
3691	.long	0x118CF548
3692	.long	0x11ADF548
3693	.long	0x11CEF548
3694	.long	0x11EFF548
3695
3696	.long	0x10E78D49
3697	.long	0x118C0D49
3698	.long	0x11AD1549
3699	.long	0x11CE1D49
3700	.long	0x11EF2549
3701	mtctr	9
3702	blr
3703.long	0
3704.byte	0,12,0x14,0,0,0,0,0
3705