Debian Codegraph @

src/Assembly/Parse/Examples/boringssl_nasm_full_mul_p256.v

raw
1 From Coq Require Import String List.
2 Import ListNotations.
3 Local Open Scope string_scope.
4 Local Open Scope list_scope.
5 Example example : list string := [
6 "default rel";
7 "";
8 "section .text code align=64";
9 "";
10 "ALIGN 64";
11 "$L$poly:";
12 " DQ 0xffffffffffffffff,0x00000000ffffffff,0x0000000000000000,0xffffffff00000001";
13 "";
14 "";
15 "global ecp_nistz256_mul_mont";
16 "";
17 "ALIGN 32";
18 "ecp_nistz256_mul_mont:";
19 " mov QWORD[8+rsp],rdi ;WIN64 prologue";
20 " mov QWORD[16+rsp],rsi";
21 " mov rax,rsp";
22 "$L$SEH_begin_ecp_nistz256_mul_mont:";
23 " mov rdi,rcx";
24 " mov rsi,rdx";
25 " mov rdx,r8";
26 "";
27 "";
28 "";
29 (*" lea rcx,[OPENSSL_ia32cap_P]";*)
30 " mov rcx,QWORD[8+rcx]";
31 " and ecx,0x80100";
32 "$L$mul_mont:";
33 " push rbp";
34 "";
35 " push rbx";
36 "";
37 " push r12";
38 "";
39 " push r13";
40 "";
41 " push r14";
42 "";
43 " push r15";
44 "";
45 "$L$mul_body:";
46 " cmp ecx,0x80100";
47 " je NEAR $L$mul_montx";
48 " mov rbx,rdx";
49 " mov rax,QWORD[rdx]";
50 " mov r9,QWORD[rsi]";
51 " mov r10,QWORD[8+rsi]";
52 " mov r11,QWORD[16+rsi]";
53 " mov r12,QWORD[24+rsi]";
54 "";
55 " call __ecp_nistz256_mul_montq";
56 " jmp NEAR $L$mul_mont_done";
57 "";
58 "ALIGN 32";
59 "$L$mul_montx:";
60 " mov rbx,rdx";
61 " mov rdx,QWORD[rdx]";
62 " mov r9,QWORD[rsi]";
63 " mov r10,QWORD[8+rsi]";
64 " mov r11,QWORD[16+rsi]";
65 " mov r12,QWORD[24+rsi]";
66 " lea rsi,[((-128))+rsi]";
67 "";
68 " call __ecp_nistz256_mul_montx";
69 "$L$mul_mont_done:";
70 " mov r15,QWORD[rsp]";
71 "";
72 " mov r14,QWORD[8+rsp]";
73 "";
74 " mov r13,QWORD[16+rsp]";
75 "";
76 " mov r12,QWORD[24+rsp]";
77 "";
78 " mov rbx,QWORD[32+rsp]";
79 "";
80 " mov rbp,QWORD[40+rsp]";
81 "";
82 " lea rsp,[48+rsp]";
83 "";
84 "$L$mul_epilogue:";
85 " mov rdi,QWORD[8+rsp] ;WIN64 epilogue";
86 " mov rsi,QWORD[16+rsp]";
87 " DB 0xF3,0xC3 ;repret";
88 "";
89 "$L$SEH_end_ecp_nistz256_mul_mont:";
90 "";
91 "";
92 "ALIGN 32";
93 "__ecp_nistz256_mul_montq:";
94 "";
95 "";
96 "";
97 " mov rbp,rax";
98 " mul r9";
99 " mov r14,QWORD[(($L$poly+8))]";
100 " mov r8,rax";
101 " mov rax,rbp";
102 " mov r9,rdx";
103 "";
104 " mul r10";
105 " mov r15,QWORD[(($L$poly+24))]";
106 " add r9,rax";
107 " mov rax,rbp";
108 " adc rdx,0";
109 " mov r10,rdx";
110 "";
111 " mul r11";
112 " add r10,rax";
113 " mov rax,rbp";
114 " adc rdx,0";
115 " mov r11,rdx";
116 "";
117 " mul r12";
118 " add r11,rax";
119 " mov rax,r8";
120 " adc rdx,0";
121 " xor r13,r13";
122 " mov r12,rdx";
123 "";
124 "";
125 "";
126 "";
127 "";
128 "";
129 "";
130 "";
131 "";
132 "";
133 " mov rbp,r8";
134 " shl r8,32";
135 " mul r15";
136 " shr rbp,32";
137 " add r9,r8";
138 " adc r10,rbp";
139 " adc r11,rax";
140 " mov rax,QWORD[8+rbx]";
141 " adc r12,rdx";
142 " adc r13,0";
143 " xor r8,r8";
144 "";
145 "";
146 "";
147 " mov rbp,rax";
148 " mul QWORD[rsi]";
149 " add r9,rax";
150 " mov rax,rbp";
151 " adc rdx,0";
152 " mov rcx,rdx";
153 "";
154 " mul QWORD[8+rsi]";
155 " add r10,rcx";
156 " adc rdx,0";
157 " add r10,rax";
158 " mov rax,rbp";
159 " adc rdx,0";
160 " mov rcx,rdx";
161 "";
162 " mul QWORD[16+rsi]";
163 " add r11,rcx";
164 " adc rdx,0";
165 " add r11,rax";
166 " mov rax,rbp";
167 " adc rdx,0";
168 " mov rcx,rdx";
169 "";
170 " mul QWORD[24+rsi]";
171 " add r12,rcx";
172 " adc rdx,0";
173 " add r12,rax";
174 " mov rax,r9";
175 " adc r13,rdx";
176 " adc r8,0";
177 "";
178 "";
179 "";
180 " mov rbp,r9";
181 " shl r9,32";
182 " mul r15";
183 " shr rbp,32";
184 " add r10,r9";
185 " adc r11,rbp";
186 " adc r12,rax";
187 " mov rax,QWORD[16+rbx]";
188 " adc r13,rdx";
189 " adc r8,0";
190 " xor r9,r9";
191 "";
192 "";
193 "";
194 " mov rbp,rax";
195 " mul QWORD[rsi]";
196 " add r10,rax";
197 " mov rax,rbp";
198 " adc rdx,0";
199 " mov rcx,rdx";
200 "";
201 " mul QWORD[8+rsi]";
202 " add r11,rcx";
203 " adc rdx,0";
204 " add r11,rax";
205 " mov rax,rbp";
206 " adc rdx,0";
207 " mov rcx,rdx";
208 "";
209 " mul QWORD[16+rsi]";
210 " add r12,rcx";
211 " adc rdx,0";
212 " add r12,rax";
213 " mov rax,rbp";
214 " adc rdx,0";
215 " mov rcx,rdx";
216 "";
217 " mul QWORD[24+rsi]";
218 " add r13,rcx";
219 " adc rdx,0";
220 " add r13,rax";
221 " mov rax,r10";
222 " adc r8,rdx";
223 " adc r9,0";
224 "";
225 "";
226 "";
227 " mov rbp,r10";
228 " shl r10,32";
229 " mul r15";
230 " shr rbp,32";
231 " add r11,r10";
232 " adc r12,rbp";
233 " adc r13,rax";
234 " mov rax,QWORD[24+rbx]";
235 " adc r8,rdx";
236 " adc r9,0";
237 " xor r10,r10";
238 "";
239 "";
240 "";
241 " mov rbp,rax";
242 " mul QWORD[rsi]";
243 " add r11,rax";
244 " mov rax,rbp";
245 " adc rdx,0";
246 " mov rcx,rdx";
247 "";
248 " mul QWORD[8+rsi]";
249 " add r12,rcx";
250 " adc rdx,0";
251 " add r12,rax";
252 " mov rax,rbp";
253 " adc rdx,0";
254 " mov rcx,rdx";
255 "";
256 " mul QWORD[16+rsi]";
257 " add r13,rcx";
258 " adc rdx,0";
259 " add r13,rax";
260 " mov rax,rbp";
261 " adc rdx,0";
262 " mov rcx,rdx";
263 "";
264 " mul QWORD[24+rsi]";
265 " add r8,rcx";
266 " adc rdx,0";
267 " add r8,rax";
268 " mov rax,r11";
269 " adc r9,rdx";
270 " adc r10,0";
271 "";
272 "";
273 "";
274 " mov rbp,r11";
275 " shl r11,32";
276 " mul r15";
277 " shr rbp,32";
278 " add r12,r11";
279 " adc r13,rbp";
280 " mov rcx,r12";
281 " adc r8,rax";
282 " adc r9,rdx";
283 " mov rbp,r13";
284 " adc r10,0";
285 "";
286 "";
287 "";
288 " sub r12,-1";
289 " mov rbx,r8";
290 " sbb r13,r14";
291 " sbb r8,0";
292 " mov rdx,r9";
293 " sbb r9,r15";
294 " sbb r10,0";
295 "";
296 " cmovc r12,rcx";
297 " cmovc r13,rbp";
298 " mov QWORD[rdi],r12";
299 " cmovc r8,rbx";
300 " mov QWORD[8+rdi],r13";
301 " cmovc r9,rdx";
302 " mov QWORD[16+rdi],r8";
303 " mov QWORD[24+rdi],r9";
304 "";
305 " DB 0xF3,0xC3 ;repret";
306 "";
307 "";
308 "ALIGN 32";
309 "__ecp_nistz256_mul_montx:";
310 "";
311 "";
312 "";
313 " mulx r9,r8,r9";
314 " mulx r10,rcx,r10";
315 " mov r14,32";
316 " xor r13,r13";
317 " mulx r11,rbp,r11";
318 " mov r15,QWORD[(($L$poly+24))]";
319 " adc r9,rcx";
320 " mulx r12,rcx,r12";
321 " mov rdx,r8";
322 " adc r10,rbp";
323 " shlx rbp,r8,r14";
324 " adc r11,rcx";
325 " shrx rcx,r8,r14";
326 " adc r12,0";
327 "";
328 "";
329 "";
330 " add r9,rbp";
331 " adc r10,rcx";
332 "";
333 " mulx rbp,rcx,r15";
334 " mov rdx,QWORD[8+rbx]";
335 " adc r11,rcx";
336 " adc r12,rbp";
337 " adc r13,0";
338 " xor r8,r8";
339 "";
340 "";
341 "";
342 " mulx rbp,rcx,QWORD[((0+128))+rsi]";
343 " adcx r9,rcx";
344 " adox r10,rbp";
345 "";
346 " mulx rbp,rcx,QWORD[((8+128))+rsi]";
347 " adcx r10,rcx";
348 " adox r11,rbp";
349 "";
350 " mulx rbp,rcx,QWORD[((16+128))+rsi]";
351 " adcx r11,rcx";
352 " adox r12,rbp";
353 "";
354 " mulx rbp,rcx,QWORD[((24+128))+rsi]";
355 " mov rdx,r9";
356 " adcx r12,rcx";
357 " shlx rcx,r9,r14";
358 " adox r13,rbp";
359 " shrx rbp,r9,r14";
360 "";
361 " adcx r13,r8";
362 " adox r8,r8";
363 " adc r8,0";
364 "";
365 "";
366 "";
367 " add r10,rcx";
368 " adc r11,rbp";
369 "";
370 " mulx rbp,rcx,r15";
371 " mov rdx,QWORD[16+rbx]";
372 " adc r12,rcx";
373 " adc r13,rbp";
374 " adc r8,0";
375 " xor r9,r9";
376 "";
377 "";
378 "";
379 " mulx rbp,rcx,QWORD[((0+128))+rsi]";
380 " adcx r10,rcx";
381 " adox r11,rbp";
382 "";
383 " mulx rbp,rcx,QWORD[((8+128))+rsi]";
384 " adcx r11,rcx";
385 " adox r12,rbp";
386 "";
387 " mulx rbp,rcx,QWORD[((16+128))+rsi]";
388 " adcx r12,rcx";
389 " adox r13,rbp";
390 "";
391 " mulx rbp,rcx,QWORD[((24+128))+rsi]";
392 " mov rdx,r10";
393 " adcx r13,rcx";
394 " shlx rcx,r10,r14";
395 " adox r8,rbp";
396 " shrx rbp,r10,r14";
397 "";
398 " adcx r8,r9";
399 " adox r9,r9";
400 " adc r9,0";
401 "";
402 "";
403 "";
404 " add r11,rcx";
405 " adc r12,rbp";
406 "";
407 " mulx rbp,rcx,r15";
408 " mov rdx,QWORD[24+rbx]";
409 " adc r13,rcx";
410 " adc r8,rbp";
411 " adc r9,0";
412 " xor r10,r10";
413 "";
414 "";
415 "";
416 " mulx rbp,rcx,QWORD[((0+128))+rsi]";
417 " adcx r11,rcx";
418 " adox r12,rbp";
419 "";
420 " mulx rbp,rcx,QWORD[((8+128))+rsi]";
421 " adcx r12,rcx";
422 " adox r13,rbp";
423 "";
424 " mulx rbp,rcx,QWORD[((16+128))+rsi]";
425 " adcx r13,rcx";
426 " adox r8,rbp";
427 "";
428 " mulx rbp,rcx,QWORD[((24+128))+rsi]";
429 " mov rdx,r11";
430 " adcx r8,rcx";
431 " shlx rcx,r11,r14";
432 " adox r9,rbp";
433 " shrx rbp,r11,r14";
434 "";
435 " adcx r9,r10";
436 " adox r10,r10";
437 " adc r10,0";
438 "";
439 "";
440 "";
441 " add r12,rcx";
442 " adc r13,rbp";
443 "";
444 " mulx rbp,rcx,r15";
445 " mov rbx,r12";
446 " mov r14,QWORD[(($L$poly+8))]";
447 " adc r8,rcx";
448 " mov rdx,r13";
449 " adc r9,rbp";
450 " adc r10,0";
451 "";
452 "";
453 "";
454 " xor eax,eax";
455 " mov rcx,r8";
456 " sbb r12,-1";
457 " sbb r13,r14";
458 " sbb r8,0";
459 " mov rbp,r9";
460 " sbb r9,r15";
461 " sbb r10,0";
462 "";
463 " cmovc r12,rbx";
464 " cmovc r13,rdx";
465 " mov QWORD[rdi],r12";
466 " cmovc r8,rcx";
467 " mov QWORD[8+rdi],r13";
468 " cmovc r9,rbp";
469 " mov QWORD[16+rdi],r8";
470 " mov QWORD[24+rdi],r9";
471 "";
472 " DB 0xF3,0xC3 ;repret";
473 ""].