• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// This file is generated from a similarly-named Perl script in the BoringSSL
2// source tree. Do not edit by hand.
3
4#if defined(__has_feature)
5#if __has_feature(memory_sanitizer) && !defined(OPENSSL_NO_ASM)
6#define OPENSSL_NO_ASM
7#endif
8#endif
9
10#if !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
11#if defined(BORINGSSL_PREFIX)
12#include <boringssl_prefix_symbols_asm.h>
13#endif
14.text
15.globl	bn_mul_mont
16.hidden	bn_mul_mont
17.type	bn_mul_mont,@function
18.align	16
19bn_mul_mont:
20.L_bn_mul_mont_begin:
21	pushl	%ebp
22	pushl	%ebx
23	pushl	%esi
24	pushl	%edi
25	xorl	%eax,%eax
26	movl	40(%esp),%edi
27	cmpl	$4,%edi
28	jl	.L000just_leave
29	leal	20(%esp),%esi
30	leal	24(%esp),%edx
31	addl	$2,%edi
32	negl	%edi
33	leal	-32(%esp,%edi,4),%ebp
34	negl	%edi
35	movl	%ebp,%eax
36	subl	%edx,%eax
37	andl	$2047,%eax
38	subl	%eax,%ebp
39	xorl	%ebp,%edx
40	andl	$2048,%edx
41	xorl	$2048,%edx
42	subl	%edx,%ebp
43	andl	$-64,%ebp
44	movl	%esp,%eax
45	subl	%ebp,%eax
46	andl	$-4096,%eax
47	movl	%esp,%edx
48	leal	(%ebp,%eax,1),%esp
49	movl	(%esp),%eax
50	cmpl	%ebp,%esp
51	ja	.L001page_walk
52	jmp	.L002page_walk_done
53.align	16
54.L001page_walk:
55	leal	-4096(%esp),%esp
56	movl	(%esp),%eax
57	cmpl	%ebp,%esp
58	ja	.L001page_walk
59.L002page_walk_done:
60	movl	(%esi),%eax
61	movl	4(%esi),%ebx
62	movl	8(%esi),%ecx
63	movl	12(%esi),%ebp
64	movl	16(%esi),%esi
65	movl	(%esi),%esi
66	movl	%eax,4(%esp)
67	movl	%ebx,8(%esp)
68	movl	%ecx,12(%esp)
69	movl	%ebp,16(%esp)
70	movl	%esi,20(%esp)
71	leal	-3(%edi),%ebx
72	movl	%edx,24(%esp)
73	call	.L003PIC_me_up
74.L003PIC_me_up:
75	popl	%eax
76	leal	OPENSSL_ia32cap_P-.L003PIC_me_up(%eax),%eax
77	btl	$26,(%eax)
78	jnc	.L004non_sse2
79	movl	$-1,%eax
80	movd	%eax,%mm7
81	movl	8(%esp),%esi
82	movl	12(%esp),%edi
83	movl	16(%esp),%ebp
84	xorl	%edx,%edx
85	xorl	%ecx,%ecx
86	movd	(%edi),%mm4
87	movd	(%esi),%mm5
88	movd	(%ebp),%mm3
89	pmuludq	%mm4,%mm5
90	movq	%mm5,%mm2
91	movq	%mm5,%mm0
92	pand	%mm7,%mm0
93	pmuludq	20(%esp),%mm5
94	pmuludq	%mm5,%mm3
95	paddq	%mm0,%mm3
96	movd	4(%ebp),%mm1
97	movd	4(%esi),%mm0
98	psrlq	$32,%mm2
99	psrlq	$32,%mm3
100	incl	%ecx
101.align	16
102.L0051st:
103	pmuludq	%mm4,%mm0
104	pmuludq	%mm5,%mm1
105	paddq	%mm0,%mm2
106	paddq	%mm1,%mm3
107	movq	%mm2,%mm0
108	pand	%mm7,%mm0
109	movd	4(%ebp,%ecx,4),%mm1
110	paddq	%mm0,%mm3
111	movd	4(%esi,%ecx,4),%mm0
112	psrlq	$32,%mm2
113	movd	%mm3,28(%esp,%ecx,4)
114	psrlq	$32,%mm3
115	leal	1(%ecx),%ecx
116	cmpl	%ebx,%ecx
117	jl	.L0051st
118	pmuludq	%mm4,%mm0
119	pmuludq	%mm5,%mm1
120	paddq	%mm0,%mm2
121	paddq	%mm1,%mm3
122	movq	%mm2,%mm0
123	pand	%mm7,%mm0
124	paddq	%mm0,%mm3
125	movd	%mm3,28(%esp,%ecx,4)
126	psrlq	$32,%mm2
127	psrlq	$32,%mm3
128	paddq	%mm2,%mm3
129	movq	%mm3,32(%esp,%ebx,4)
130	incl	%edx
131.L006outer:
132	xorl	%ecx,%ecx
133	movd	(%edi,%edx,4),%mm4
134	movd	(%esi),%mm5
135	movd	32(%esp),%mm6
136	movd	(%ebp),%mm3
137	pmuludq	%mm4,%mm5
138	paddq	%mm6,%mm5
139	movq	%mm5,%mm0
140	movq	%mm5,%mm2
141	pand	%mm7,%mm0
142	pmuludq	20(%esp),%mm5
143	pmuludq	%mm5,%mm3
144	paddq	%mm0,%mm3
145	movd	36(%esp),%mm6
146	movd	4(%ebp),%mm1
147	movd	4(%esi),%mm0
148	psrlq	$32,%mm2
149	psrlq	$32,%mm3
150	paddq	%mm6,%mm2
151	incl	%ecx
152	decl	%ebx
153.L007inner:
154	pmuludq	%mm4,%mm0
155	pmuludq	%mm5,%mm1
156	paddq	%mm0,%mm2
157	paddq	%mm1,%mm3
158	movq	%mm2,%mm0
159	movd	36(%esp,%ecx,4),%mm6
160	pand	%mm7,%mm0
161	movd	4(%ebp,%ecx,4),%mm1
162	paddq	%mm0,%mm3
163	movd	4(%esi,%ecx,4),%mm0
164	psrlq	$32,%mm2
165	movd	%mm3,28(%esp,%ecx,4)
166	psrlq	$32,%mm3
167	paddq	%mm6,%mm2
168	decl	%ebx
169	leal	1(%ecx),%ecx
170	jnz	.L007inner
171	movl	%ecx,%ebx
172	pmuludq	%mm4,%mm0
173	pmuludq	%mm5,%mm1
174	paddq	%mm0,%mm2
175	paddq	%mm1,%mm3
176	movq	%mm2,%mm0
177	pand	%mm7,%mm0
178	paddq	%mm0,%mm3
179	movd	%mm3,28(%esp,%ecx,4)
180	psrlq	$32,%mm2
181	psrlq	$32,%mm3
182	movd	36(%esp,%ebx,4),%mm6
183	paddq	%mm2,%mm3
184	paddq	%mm6,%mm3
185	movq	%mm3,32(%esp,%ebx,4)
186	leal	1(%edx),%edx
187	cmpl	%ebx,%edx
188	jle	.L006outer
189	emms
190	jmp	.L008common_tail
191.align	16
192.L004non_sse2:
193	movl	8(%esp),%esi
194	leal	1(%ebx),%ebp
195	movl	12(%esp),%edi
196	xorl	%ecx,%ecx
197	movl	%esi,%edx
198	andl	$1,%ebp
199	subl	%edi,%edx
200	leal	4(%edi,%ebx,4),%eax
201	orl	%edx,%ebp
202	movl	(%edi),%edi
203	jz	.L009bn_sqr_mont
204	movl	%eax,28(%esp)
205	movl	(%esi),%eax
206	xorl	%edx,%edx
207.align	16
208.L010mull:
209	movl	%edx,%ebp
210	mull	%edi
211	addl	%eax,%ebp
212	leal	1(%ecx),%ecx
213	adcl	$0,%edx
214	movl	(%esi,%ecx,4),%eax
215	cmpl	%ebx,%ecx
216	movl	%ebp,28(%esp,%ecx,4)
217	jl	.L010mull
218	movl	%edx,%ebp
219	mull	%edi
220	movl	20(%esp),%edi
221	addl	%ebp,%eax
222	movl	16(%esp),%esi
223	adcl	$0,%edx
224	imull	32(%esp),%edi
225	movl	%eax,32(%esp,%ebx,4)
226	xorl	%ecx,%ecx
227	movl	%edx,36(%esp,%ebx,4)
228	movl	%ecx,40(%esp,%ebx,4)
229	movl	(%esi),%eax
230	mull	%edi
231	addl	32(%esp),%eax
232	movl	4(%esi),%eax
233	adcl	$0,%edx
234	incl	%ecx
235	jmp	.L0112ndmadd
236.align	16
237.L0121stmadd:
238	movl	%edx,%ebp
239	mull	%edi
240	addl	32(%esp,%ecx,4),%ebp
241	leal	1(%ecx),%ecx
242	adcl	$0,%edx
243	addl	%eax,%ebp
244	movl	(%esi,%ecx,4),%eax
245	adcl	$0,%edx
246	cmpl	%ebx,%ecx
247	movl	%ebp,28(%esp,%ecx,4)
248	jl	.L0121stmadd
249	movl	%edx,%ebp
250	mull	%edi
251	addl	32(%esp,%ebx,4),%eax
252	movl	20(%esp),%edi
253	adcl	$0,%edx
254	movl	16(%esp),%esi
255	addl	%eax,%ebp
256	adcl	$0,%edx
257	imull	32(%esp),%edi
258	xorl	%ecx,%ecx
259	addl	36(%esp,%ebx,4),%edx
260	movl	%ebp,32(%esp,%ebx,4)
261	adcl	$0,%ecx
262	movl	(%esi),%eax
263	movl	%edx,36(%esp,%ebx,4)
264	movl	%ecx,40(%esp,%ebx,4)
265	mull	%edi
266	addl	32(%esp),%eax
267	movl	4(%esi),%eax
268	adcl	$0,%edx
269	movl	$1,%ecx
270.align	16
271.L0112ndmadd:
272	movl	%edx,%ebp
273	mull	%edi
274	addl	32(%esp,%ecx,4),%ebp
275	leal	1(%ecx),%ecx
276	adcl	$0,%edx
277	addl	%eax,%ebp
278	movl	(%esi,%ecx,4),%eax
279	adcl	$0,%edx
280	cmpl	%ebx,%ecx
281	movl	%ebp,24(%esp,%ecx,4)
282	jl	.L0112ndmadd
283	movl	%edx,%ebp
284	mull	%edi
285	addl	32(%esp,%ebx,4),%ebp
286	adcl	$0,%edx
287	addl	%eax,%ebp
288	adcl	$0,%edx
289	movl	%ebp,28(%esp,%ebx,4)
290	xorl	%eax,%eax
291	movl	12(%esp),%ecx
292	addl	36(%esp,%ebx,4),%edx
293	adcl	40(%esp,%ebx,4),%eax
294	leal	4(%ecx),%ecx
295	movl	%edx,32(%esp,%ebx,4)
296	cmpl	28(%esp),%ecx
297	movl	%eax,36(%esp,%ebx,4)
298	je	.L008common_tail
299	movl	(%ecx),%edi
300	movl	8(%esp),%esi
301	movl	%ecx,12(%esp)
302	xorl	%ecx,%ecx
303	xorl	%edx,%edx
304	movl	(%esi),%eax
305	jmp	.L0121stmadd
306.align	16
307.L009bn_sqr_mont:
308	movl	%ebx,(%esp)
309	movl	%ecx,12(%esp)
310	movl	%edi,%eax
311	mull	%edi
312	movl	%eax,32(%esp)
313	movl	%edx,%ebx
314	shrl	$1,%edx
315	andl	$1,%ebx
316	incl	%ecx
317.align	16
318.L013sqr:
319	movl	(%esi,%ecx,4),%eax
320	movl	%edx,%ebp
321	mull	%edi
322	addl	%ebp,%eax
323	leal	1(%ecx),%ecx
324	adcl	$0,%edx
325	leal	(%ebx,%eax,2),%ebp
326	shrl	$31,%eax
327	cmpl	(%esp),%ecx
328	movl	%eax,%ebx
329	movl	%ebp,28(%esp,%ecx,4)
330	jl	.L013sqr
331	movl	(%esi,%ecx,4),%eax
332	movl	%edx,%ebp
333	mull	%edi
334	addl	%ebp,%eax
335	movl	20(%esp),%edi
336	adcl	$0,%edx
337	movl	16(%esp),%esi
338	leal	(%ebx,%eax,2),%ebp
339	imull	32(%esp),%edi
340	shrl	$31,%eax
341	movl	%ebp,32(%esp,%ecx,4)
342	leal	(%eax,%edx,2),%ebp
343	movl	(%esi),%eax
344	shrl	$31,%edx
345	movl	%ebp,36(%esp,%ecx,4)
346	movl	%edx,40(%esp,%ecx,4)
347	mull	%edi
348	addl	32(%esp),%eax
349	movl	%ecx,%ebx
350	adcl	$0,%edx
351	movl	4(%esi),%eax
352	movl	$1,%ecx
353.align	16
354.L0143rdmadd:
355	movl	%edx,%ebp
356	mull	%edi
357	addl	32(%esp,%ecx,4),%ebp
358	adcl	$0,%edx
359	addl	%eax,%ebp
360	movl	4(%esi,%ecx,4),%eax
361	adcl	$0,%edx
362	movl	%ebp,28(%esp,%ecx,4)
363	movl	%edx,%ebp
364	mull	%edi
365	addl	36(%esp,%ecx,4),%ebp
366	leal	2(%ecx),%ecx
367	adcl	$0,%edx
368	addl	%eax,%ebp
369	movl	(%esi,%ecx,4),%eax
370	adcl	$0,%edx
371	cmpl	%ebx,%ecx
372	movl	%ebp,24(%esp,%ecx,4)
373	jl	.L0143rdmadd
374	movl	%edx,%ebp
375	mull	%edi
376	addl	32(%esp,%ebx,4),%ebp
377	adcl	$0,%edx
378	addl	%eax,%ebp
379	adcl	$0,%edx
380	movl	%ebp,28(%esp,%ebx,4)
381	movl	12(%esp),%ecx
382	xorl	%eax,%eax
383	movl	8(%esp),%esi
384	addl	36(%esp,%ebx,4),%edx
385	adcl	40(%esp,%ebx,4),%eax
386	movl	%edx,32(%esp,%ebx,4)
387	cmpl	%ebx,%ecx
388	movl	%eax,36(%esp,%ebx,4)
389	je	.L008common_tail
390	movl	4(%esi,%ecx,4),%edi
391	leal	1(%ecx),%ecx
392	movl	%edi,%eax
393	movl	%ecx,12(%esp)
394	mull	%edi
395	addl	32(%esp,%ecx,4),%eax
396	adcl	$0,%edx
397	movl	%eax,32(%esp,%ecx,4)
398	xorl	%ebp,%ebp
399	cmpl	%ebx,%ecx
400	leal	1(%ecx),%ecx
401	je	.L015sqrlast
402	movl	%edx,%ebx
403	shrl	$1,%edx
404	andl	$1,%ebx
405.align	16
406.L016sqradd:
407	movl	(%esi,%ecx,4),%eax
408	movl	%edx,%ebp
409	mull	%edi
410	addl	%ebp,%eax
411	leal	(%eax,%eax,1),%ebp
412	adcl	$0,%edx
413	shrl	$31,%eax
414	addl	32(%esp,%ecx,4),%ebp
415	leal	1(%ecx),%ecx
416	adcl	$0,%eax
417	addl	%ebx,%ebp
418	adcl	$0,%eax
419	cmpl	(%esp),%ecx
420	movl	%ebp,28(%esp,%ecx,4)
421	movl	%eax,%ebx
422	jle	.L016sqradd
423	movl	%edx,%ebp
424	addl	%edx,%edx
425	shrl	$31,%ebp
426	addl	%ebx,%edx
427	adcl	$0,%ebp
428.L015sqrlast:
429	movl	20(%esp),%edi
430	movl	16(%esp),%esi
431	imull	32(%esp),%edi
432	addl	32(%esp,%ecx,4),%edx
433	movl	(%esi),%eax
434	adcl	$0,%ebp
435	movl	%edx,32(%esp,%ecx,4)
436	movl	%ebp,36(%esp,%ecx,4)
437	mull	%edi
438	addl	32(%esp),%eax
439	leal	-1(%ecx),%ebx
440	adcl	$0,%edx
441	movl	$1,%ecx
442	movl	4(%esi),%eax
443	jmp	.L0143rdmadd
444.align	16
445.L008common_tail:
446	movl	16(%esp),%ebp
447	movl	4(%esp),%edi
448	leal	32(%esp),%esi
449	movl	(%esi),%eax
450	movl	%ebx,%ecx
451	xorl	%edx,%edx
452.align	16
453.L017sub:
454	sbbl	(%ebp,%edx,4),%eax
455	movl	%eax,(%edi,%edx,4)
456	decl	%ecx
457	movl	4(%esi,%edx,4),%eax
458	leal	1(%edx),%edx
459	jge	.L017sub
460	sbbl	$0,%eax
461	movl	$-1,%edx
462	xorl	%eax,%edx
463	jmp	.L018copy
464.align	16
465.L018copy:
466	movl	32(%esp,%ebx,4),%esi
467	movl	(%edi,%ebx,4),%ebp
468	movl	%ecx,32(%esp,%ebx,4)
469	andl	%eax,%esi
470	andl	%edx,%ebp
471	orl	%esi,%ebp
472	movl	%ebp,(%edi,%ebx,4)
473	decl	%ebx
474	jge	.L018copy
475	movl	24(%esp),%esp
476	movl	$1,%eax
477.L000just_leave:
478	popl	%edi
479	popl	%esi
480	popl	%ebx
481	popl	%ebp
482	ret
483.size	bn_mul_mont,.-.L_bn_mul_mont_begin
484.byte	77,111,110,116,103,111,109,101,114,121,32,77,117,108,116,105
485.byte	112,108,105,99,97,116,105,111,110,32,102,111,114,32,120,56
486.byte	54,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
487.byte	32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
488.byte	111,114,103,62,0
489#endif  // !defined(OPENSSL_NO_ASM) && defined(__i386__) && defined(__ELF__)
490#if defined(__ELF__)
491// See https://www.airs.com/blog/archives/518.
492.section .note.GNU-stack,"",%progbits
493#endif
494