xref: /aosp_15_r20/external/boringssl/src/gen/bcm/bn-586-linux.S (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1// This file is generated from a similarly-named Perl script in the BoringSSL
2// source tree. Do not edit by hand.
3
4#include <openssl/asm_base.h>
5
6#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86) && defined(__ELF__)
7.text
8.globl	bn_mul_add_words
9.hidden	bn_mul_add_words
10.type	bn_mul_add_words,@function
11.align	16
12bn_mul_add_words:
13.L_bn_mul_add_words_begin:
14	movl	4(%esp),%eax
15	movl	8(%esp),%edx
16	movl	12(%esp),%ecx
17	movd	16(%esp),%mm0
18	pxor	%mm1,%mm1
19	jmp	.L000maw_sse2_entry
20.align	16
21.L001maw_sse2_unrolled:
22	movd	(%eax),%mm3
23	paddq	%mm3,%mm1
24	movd	(%edx),%mm2
25	pmuludq	%mm0,%mm2
26	movd	4(%edx),%mm4
27	pmuludq	%mm0,%mm4
28	movd	8(%edx),%mm6
29	pmuludq	%mm0,%mm6
30	movd	12(%edx),%mm7
31	pmuludq	%mm0,%mm7
32	paddq	%mm2,%mm1
33	movd	4(%eax),%mm3
34	paddq	%mm4,%mm3
35	movd	8(%eax),%mm5
36	paddq	%mm6,%mm5
37	movd	12(%eax),%mm4
38	paddq	%mm4,%mm7
39	movd	%mm1,(%eax)
40	movd	16(%edx),%mm2
41	pmuludq	%mm0,%mm2
42	psrlq	$32,%mm1
43	movd	20(%edx),%mm4
44	pmuludq	%mm0,%mm4
45	paddq	%mm3,%mm1
46	movd	24(%edx),%mm6
47	pmuludq	%mm0,%mm6
48	movd	%mm1,4(%eax)
49	psrlq	$32,%mm1
50	movd	28(%edx),%mm3
51	addl	$32,%edx
52	pmuludq	%mm0,%mm3
53	paddq	%mm5,%mm1
54	movd	16(%eax),%mm5
55	paddq	%mm5,%mm2
56	movd	%mm1,8(%eax)
57	psrlq	$32,%mm1
58	paddq	%mm7,%mm1
59	movd	20(%eax),%mm5
60	paddq	%mm5,%mm4
61	movd	%mm1,12(%eax)
62	psrlq	$32,%mm1
63	paddq	%mm2,%mm1
64	movd	24(%eax),%mm5
65	paddq	%mm5,%mm6
66	movd	%mm1,16(%eax)
67	psrlq	$32,%mm1
68	paddq	%mm4,%mm1
69	movd	28(%eax),%mm5
70	paddq	%mm5,%mm3
71	movd	%mm1,20(%eax)
72	psrlq	$32,%mm1
73	paddq	%mm6,%mm1
74	movd	%mm1,24(%eax)
75	psrlq	$32,%mm1
76	paddq	%mm3,%mm1
77	movd	%mm1,28(%eax)
78	leal	32(%eax),%eax
79	psrlq	$32,%mm1
80	subl	$8,%ecx
81	jz	.L002maw_sse2_exit
82.L000maw_sse2_entry:
83	testl	$4294967288,%ecx
84	jnz	.L001maw_sse2_unrolled
85.align	4
86.L003maw_sse2_loop:
87	movd	(%edx),%mm2
88	movd	(%eax),%mm3
89	pmuludq	%mm0,%mm2
90	leal	4(%edx),%edx
91	paddq	%mm3,%mm1
92	paddq	%mm2,%mm1
93	movd	%mm1,(%eax)
94	subl	$1,%ecx
95	psrlq	$32,%mm1
96	leal	4(%eax),%eax
97	jnz	.L003maw_sse2_loop
98.L002maw_sse2_exit:
99	movd	%mm1,%eax
100	emms
101	ret
102	popl	%edi
103	popl	%esi
104	popl	%ebx
105	popl	%ebp
106	ret
107.size	bn_mul_add_words,.-.L_bn_mul_add_words_begin
108.globl	bn_mul_words
109.hidden	bn_mul_words
110.type	bn_mul_words,@function
111.align	16
112bn_mul_words:
113.L_bn_mul_words_begin:
114	movl	4(%esp),%eax
115	movl	8(%esp),%edx
116	movl	12(%esp),%ecx
117	movd	16(%esp),%mm0
118	pxor	%mm1,%mm1
119.align	16
120.L004mw_sse2_loop:
121	movd	(%edx),%mm2
122	pmuludq	%mm0,%mm2
123	leal	4(%edx),%edx
124	paddq	%mm2,%mm1
125	movd	%mm1,(%eax)
126	subl	$1,%ecx
127	psrlq	$32,%mm1
128	leal	4(%eax),%eax
129	jnz	.L004mw_sse2_loop
130	movd	%mm1,%eax
131	emms
132	ret
133	popl	%edi
134	popl	%esi
135	popl	%ebx
136	popl	%ebp
137	ret
138.size	bn_mul_words,.-.L_bn_mul_words_begin
139.globl	bn_sqr_words
140.hidden	bn_sqr_words
141.type	bn_sqr_words,@function
142.align	16
143bn_sqr_words:
144.L_bn_sqr_words_begin:
145	movl	4(%esp),%eax
146	movl	8(%esp),%edx
147	movl	12(%esp),%ecx
148.align	16
149.L005sqr_sse2_loop:
150	movd	(%edx),%mm0
151	pmuludq	%mm0,%mm0
152	leal	4(%edx),%edx
153	movq	%mm0,(%eax)
154	subl	$1,%ecx
155	leal	8(%eax),%eax
156	jnz	.L005sqr_sse2_loop
157	emms
158	ret
159	popl	%edi
160	popl	%esi
161	popl	%ebx
162	popl	%ebp
163	ret
164.size	bn_sqr_words,.-.L_bn_sqr_words_begin
165.globl	bn_div_words
166.hidden	bn_div_words
167.type	bn_div_words,@function
168.align	16
169bn_div_words:
170.L_bn_div_words_begin:
171	movl	4(%esp),%edx
172	movl	8(%esp),%eax
173	movl	12(%esp),%ecx
174	divl	%ecx
175	ret
176.size	bn_div_words,.-.L_bn_div_words_begin
177.globl	bn_add_words
178.hidden	bn_add_words
179.type	bn_add_words,@function
180.align	16
181bn_add_words:
182.L_bn_add_words_begin:
183	pushl	%ebp
184	pushl	%ebx
185	pushl	%esi
186	pushl	%edi
187
188	movl	20(%esp),%ebx
189	movl	24(%esp),%esi
190	movl	28(%esp),%edi
191	movl	32(%esp),%ebp
192	xorl	%eax,%eax
193	andl	$4294967288,%ebp
194	jz	.L006aw_finish
195.L007aw_loop:
196
197	movl	(%esi),%ecx
198	movl	(%edi),%edx
199	addl	%eax,%ecx
200	movl	$0,%eax
201	adcl	%eax,%eax
202	addl	%edx,%ecx
203	adcl	$0,%eax
204	movl	%ecx,(%ebx)
205
206	movl	4(%esi),%ecx
207	movl	4(%edi),%edx
208	addl	%eax,%ecx
209	movl	$0,%eax
210	adcl	%eax,%eax
211	addl	%edx,%ecx
212	adcl	$0,%eax
213	movl	%ecx,4(%ebx)
214
215	movl	8(%esi),%ecx
216	movl	8(%edi),%edx
217	addl	%eax,%ecx
218	movl	$0,%eax
219	adcl	%eax,%eax
220	addl	%edx,%ecx
221	adcl	$0,%eax
222	movl	%ecx,8(%ebx)
223
224	movl	12(%esi),%ecx
225	movl	12(%edi),%edx
226	addl	%eax,%ecx
227	movl	$0,%eax
228	adcl	%eax,%eax
229	addl	%edx,%ecx
230	adcl	$0,%eax
231	movl	%ecx,12(%ebx)
232
233	movl	16(%esi),%ecx
234	movl	16(%edi),%edx
235	addl	%eax,%ecx
236	movl	$0,%eax
237	adcl	%eax,%eax
238	addl	%edx,%ecx
239	adcl	$0,%eax
240	movl	%ecx,16(%ebx)
241
242	movl	20(%esi),%ecx
243	movl	20(%edi),%edx
244	addl	%eax,%ecx
245	movl	$0,%eax
246	adcl	%eax,%eax
247	addl	%edx,%ecx
248	adcl	$0,%eax
249	movl	%ecx,20(%ebx)
250
251	movl	24(%esi),%ecx
252	movl	24(%edi),%edx
253	addl	%eax,%ecx
254	movl	$0,%eax
255	adcl	%eax,%eax
256	addl	%edx,%ecx
257	adcl	$0,%eax
258	movl	%ecx,24(%ebx)
259
260	movl	28(%esi),%ecx
261	movl	28(%edi),%edx
262	addl	%eax,%ecx
263	movl	$0,%eax
264	adcl	%eax,%eax
265	addl	%edx,%ecx
266	adcl	$0,%eax
267	movl	%ecx,28(%ebx)
268
269	addl	$32,%esi
270	addl	$32,%edi
271	addl	$32,%ebx
272	subl	$8,%ebp
273	jnz	.L007aw_loop
274.L006aw_finish:
275	movl	32(%esp),%ebp
276	andl	$7,%ebp
277	jz	.L008aw_end
278
279	movl	(%esi),%ecx
280	movl	(%edi),%edx
281	addl	%eax,%ecx
282	movl	$0,%eax
283	adcl	%eax,%eax
284	addl	%edx,%ecx
285	adcl	$0,%eax
286	decl	%ebp
287	movl	%ecx,(%ebx)
288	jz	.L008aw_end
289
290	movl	4(%esi),%ecx
291	movl	4(%edi),%edx
292	addl	%eax,%ecx
293	movl	$0,%eax
294	adcl	%eax,%eax
295	addl	%edx,%ecx
296	adcl	$0,%eax
297	decl	%ebp
298	movl	%ecx,4(%ebx)
299	jz	.L008aw_end
300
301	movl	8(%esi),%ecx
302	movl	8(%edi),%edx
303	addl	%eax,%ecx
304	movl	$0,%eax
305	adcl	%eax,%eax
306	addl	%edx,%ecx
307	adcl	$0,%eax
308	decl	%ebp
309	movl	%ecx,8(%ebx)
310	jz	.L008aw_end
311
312	movl	12(%esi),%ecx
313	movl	12(%edi),%edx
314	addl	%eax,%ecx
315	movl	$0,%eax
316	adcl	%eax,%eax
317	addl	%edx,%ecx
318	adcl	$0,%eax
319	decl	%ebp
320	movl	%ecx,12(%ebx)
321	jz	.L008aw_end
322
323	movl	16(%esi),%ecx
324	movl	16(%edi),%edx
325	addl	%eax,%ecx
326	movl	$0,%eax
327	adcl	%eax,%eax
328	addl	%edx,%ecx
329	adcl	$0,%eax
330	decl	%ebp
331	movl	%ecx,16(%ebx)
332	jz	.L008aw_end
333
334	movl	20(%esi),%ecx
335	movl	20(%edi),%edx
336	addl	%eax,%ecx
337	movl	$0,%eax
338	adcl	%eax,%eax
339	addl	%edx,%ecx
340	adcl	$0,%eax
341	decl	%ebp
342	movl	%ecx,20(%ebx)
343	jz	.L008aw_end
344
345	movl	24(%esi),%ecx
346	movl	24(%edi),%edx
347	addl	%eax,%ecx
348	movl	$0,%eax
349	adcl	%eax,%eax
350	addl	%edx,%ecx
351	adcl	$0,%eax
352	movl	%ecx,24(%ebx)
353.L008aw_end:
354	popl	%edi
355	popl	%esi
356	popl	%ebx
357	popl	%ebp
358	ret
359.size	bn_add_words,.-.L_bn_add_words_begin
360.globl	bn_sub_words
361.hidden	bn_sub_words
362.type	bn_sub_words,@function
363.align	16
364bn_sub_words:
365.L_bn_sub_words_begin:
366	pushl	%ebp
367	pushl	%ebx
368	pushl	%esi
369	pushl	%edi
370
371	movl	20(%esp),%ebx
372	movl	24(%esp),%esi
373	movl	28(%esp),%edi
374	movl	32(%esp),%ebp
375	xorl	%eax,%eax
376	andl	$4294967288,%ebp
377	jz	.L009aw_finish
378.L010aw_loop:
379
380	movl	(%esi),%ecx
381	movl	(%edi),%edx
382	subl	%eax,%ecx
383	movl	$0,%eax
384	adcl	%eax,%eax
385	subl	%edx,%ecx
386	adcl	$0,%eax
387	movl	%ecx,(%ebx)
388
389	movl	4(%esi),%ecx
390	movl	4(%edi),%edx
391	subl	%eax,%ecx
392	movl	$0,%eax
393	adcl	%eax,%eax
394	subl	%edx,%ecx
395	adcl	$0,%eax
396	movl	%ecx,4(%ebx)
397
398	movl	8(%esi),%ecx
399	movl	8(%edi),%edx
400	subl	%eax,%ecx
401	movl	$0,%eax
402	adcl	%eax,%eax
403	subl	%edx,%ecx
404	adcl	$0,%eax
405	movl	%ecx,8(%ebx)
406
407	movl	12(%esi),%ecx
408	movl	12(%edi),%edx
409	subl	%eax,%ecx
410	movl	$0,%eax
411	adcl	%eax,%eax
412	subl	%edx,%ecx
413	adcl	$0,%eax
414	movl	%ecx,12(%ebx)
415
416	movl	16(%esi),%ecx
417	movl	16(%edi),%edx
418	subl	%eax,%ecx
419	movl	$0,%eax
420	adcl	%eax,%eax
421	subl	%edx,%ecx
422	adcl	$0,%eax
423	movl	%ecx,16(%ebx)
424
425	movl	20(%esi),%ecx
426	movl	20(%edi),%edx
427	subl	%eax,%ecx
428	movl	$0,%eax
429	adcl	%eax,%eax
430	subl	%edx,%ecx
431	adcl	$0,%eax
432	movl	%ecx,20(%ebx)
433
434	movl	24(%esi),%ecx
435	movl	24(%edi),%edx
436	subl	%eax,%ecx
437	movl	$0,%eax
438	adcl	%eax,%eax
439	subl	%edx,%ecx
440	adcl	$0,%eax
441	movl	%ecx,24(%ebx)
442
443	movl	28(%esi),%ecx
444	movl	28(%edi),%edx
445	subl	%eax,%ecx
446	movl	$0,%eax
447	adcl	%eax,%eax
448	subl	%edx,%ecx
449	adcl	$0,%eax
450	movl	%ecx,28(%ebx)
451
452	addl	$32,%esi
453	addl	$32,%edi
454	addl	$32,%ebx
455	subl	$8,%ebp
456	jnz	.L010aw_loop
457.L009aw_finish:
458	movl	32(%esp),%ebp
459	andl	$7,%ebp
460	jz	.L011aw_end
461
462	movl	(%esi),%ecx
463	movl	(%edi),%edx
464	subl	%eax,%ecx
465	movl	$0,%eax
466	adcl	%eax,%eax
467	subl	%edx,%ecx
468	adcl	$0,%eax
469	decl	%ebp
470	movl	%ecx,(%ebx)
471	jz	.L011aw_end
472
473	movl	4(%esi),%ecx
474	movl	4(%edi),%edx
475	subl	%eax,%ecx
476	movl	$0,%eax
477	adcl	%eax,%eax
478	subl	%edx,%ecx
479	adcl	$0,%eax
480	decl	%ebp
481	movl	%ecx,4(%ebx)
482	jz	.L011aw_end
483
484	movl	8(%esi),%ecx
485	movl	8(%edi),%edx
486	subl	%eax,%ecx
487	movl	$0,%eax
488	adcl	%eax,%eax
489	subl	%edx,%ecx
490	adcl	$0,%eax
491	decl	%ebp
492	movl	%ecx,8(%ebx)
493	jz	.L011aw_end
494
495	movl	12(%esi),%ecx
496	movl	12(%edi),%edx
497	subl	%eax,%ecx
498	movl	$0,%eax
499	adcl	%eax,%eax
500	subl	%edx,%ecx
501	adcl	$0,%eax
502	decl	%ebp
503	movl	%ecx,12(%ebx)
504	jz	.L011aw_end
505
506	movl	16(%esi),%ecx
507	movl	16(%edi),%edx
508	subl	%eax,%ecx
509	movl	$0,%eax
510	adcl	%eax,%eax
511	subl	%edx,%ecx
512	adcl	$0,%eax
513	decl	%ebp
514	movl	%ecx,16(%ebx)
515	jz	.L011aw_end
516
517	movl	20(%esi),%ecx
518	movl	20(%edi),%edx
519	subl	%eax,%ecx
520	movl	$0,%eax
521	adcl	%eax,%eax
522	subl	%edx,%ecx
523	adcl	$0,%eax
524	decl	%ebp
525	movl	%ecx,20(%ebx)
526	jz	.L011aw_end
527
528	movl	24(%esi),%ecx
529	movl	24(%edi),%edx
530	subl	%eax,%ecx
531	movl	$0,%eax
532	adcl	%eax,%eax
533	subl	%edx,%ecx
534	adcl	$0,%eax
535	movl	%ecx,24(%ebx)
536.L011aw_end:
537	popl	%edi
538	popl	%esi
539	popl	%ebx
540	popl	%ebp
541	ret
542.size	bn_sub_words,.-.L_bn_sub_words_begin
543#endif  // !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86) && defined(__ELF__)
544