VirtualBox

source: vbox/trunk/src/libs/openssl-1.1.1i/crypto/genasm-nasm/x86_64-gf2m.S@ 87083

Last change on this file since 87083 was 83531, checked in by vboxsync, 5 years ago

setting svn:sync-process=export for openssl-1.1.1f, all files except tests

File size: 6.5 KB
Line 
1default rel
2%define XMMWORD
3%define YMMWORD
4%define ZMMWORD
5section .text code align=64
6
7
8
9ALIGN 16
10_mul_1x1:
11
12 sub rsp,128+8
13
14 mov r9,-1
15 lea rsi,[rax*1+rax]
16 shr r9,3
17 lea rdi,[rax*4]
18 and r9,rax
19 lea r12,[rax*8]
20 sar rax,63
21 lea r10,[r9*1+r9]
22 sar rsi,63
23 lea r11,[r9*4]
24 and rax,rbp
25 sar rdi,63
26 mov rdx,rax
27 shl rax,63
28 and rsi,rbp
29 shr rdx,1
30 mov rcx,rsi
31 shl rsi,62
32 and rdi,rbp
33 shr rcx,2
34 xor rax,rsi
35 mov rbx,rdi
36 shl rdi,61
37 xor rdx,rcx
38 shr rbx,3
39 xor rax,rdi
40 xor rdx,rbx
41
42 mov r13,r9
43 mov QWORD[rsp],0
44 xor r13,r10
45 mov QWORD[8+rsp],r9
46 mov r14,r11
47 mov QWORD[16+rsp],r10
48 xor r14,r12
49 mov QWORD[24+rsp],r13
50
51 xor r9,r11
52 mov QWORD[32+rsp],r11
53 xor r10,r11
54 mov QWORD[40+rsp],r9
55 xor r13,r11
56 mov QWORD[48+rsp],r10
57 xor r9,r14
58 mov QWORD[56+rsp],r13
59 xor r10,r14
60
61 mov QWORD[64+rsp],r12
62 xor r13,r14
63 mov QWORD[72+rsp],r9
64 xor r9,r11
65 mov QWORD[80+rsp],r10
66 xor r10,r11
67 mov QWORD[88+rsp],r13
68
69 xor r13,r11
70 mov QWORD[96+rsp],r14
71 mov rsi,r8
72 mov QWORD[104+rsp],r9
73 and rsi,rbp
74 mov QWORD[112+rsp],r10
75 shr rbp,4
76 mov QWORD[120+rsp],r13
77 mov rdi,r8
78 and rdi,rbp
79 shr rbp,4
80
81 movq xmm0,QWORD[rsi*8+rsp]
82 mov rsi,r8
83 and rsi,rbp
84 shr rbp,4
85 mov rcx,QWORD[rdi*8+rsp]
86 mov rdi,r8
87 mov rbx,rcx
88 shl rcx,4
89 and rdi,rbp
90 movq xmm1,QWORD[rsi*8+rsp]
91 shr rbx,60
92 xor rax,rcx
93 pslldq xmm1,1
94 mov rsi,r8
95 shr rbp,4
96 xor rdx,rbx
97 and rsi,rbp
98 shr rbp,4
99 pxor xmm0,xmm1
100 mov rcx,QWORD[rdi*8+rsp]
101 mov rdi,r8
102 mov rbx,rcx
103 shl rcx,12
104 and rdi,rbp
105 movq xmm1,QWORD[rsi*8+rsp]
106 shr rbx,52
107 xor rax,rcx
108 pslldq xmm1,2
109 mov rsi,r8
110 shr rbp,4
111 xor rdx,rbx
112 and rsi,rbp
113 shr rbp,4
114 pxor xmm0,xmm1
115 mov rcx,QWORD[rdi*8+rsp]
116 mov rdi,r8
117 mov rbx,rcx
118 shl rcx,20
119 and rdi,rbp
120 movq xmm1,QWORD[rsi*8+rsp]
121 shr rbx,44
122 xor rax,rcx
123 pslldq xmm1,3
124 mov rsi,r8
125 shr rbp,4
126 xor rdx,rbx
127 and rsi,rbp
128 shr rbp,4
129 pxor xmm0,xmm1
130 mov rcx,QWORD[rdi*8+rsp]
131 mov rdi,r8
132 mov rbx,rcx
133 shl rcx,28
134 and rdi,rbp
135 movq xmm1,QWORD[rsi*8+rsp]
136 shr rbx,36
137 xor rax,rcx
138 pslldq xmm1,4
139 mov rsi,r8
140 shr rbp,4
141 xor rdx,rbx
142 and rsi,rbp
143 shr rbp,4
144 pxor xmm0,xmm1
145 mov rcx,QWORD[rdi*8+rsp]
146 mov rdi,r8
147 mov rbx,rcx
148 shl rcx,36
149 and rdi,rbp
150 movq xmm1,QWORD[rsi*8+rsp]
151 shr rbx,28
152 xor rax,rcx
153 pslldq xmm1,5
154 mov rsi,r8
155 shr rbp,4
156 xor rdx,rbx
157 and rsi,rbp
158 shr rbp,4
159 pxor xmm0,xmm1
160 mov rcx,QWORD[rdi*8+rsp]
161 mov rdi,r8
162 mov rbx,rcx
163 shl rcx,44
164 and rdi,rbp
165 movq xmm1,QWORD[rsi*8+rsp]
166 shr rbx,20
167 xor rax,rcx
168 pslldq xmm1,6
169 mov rsi,r8
170 shr rbp,4
171 xor rdx,rbx
172 and rsi,rbp
173 shr rbp,4
174 pxor xmm0,xmm1
175 mov rcx,QWORD[rdi*8+rsp]
176 mov rdi,r8
177 mov rbx,rcx
178 shl rcx,52
179 and rdi,rbp
180 movq xmm1,QWORD[rsi*8+rsp]
181 shr rbx,12
182 xor rax,rcx
183 pslldq xmm1,7
184 mov rsi,r8
185 shr rbp,4
186 xor rdx,rbx
187 and rsi,rbp
188 shr rbp,4
189 pxor xmm0,xmm1
190 mov rcx,QWORD[rdi*8+rsp]
191 mov rbx,rcx
192 shl rcx,60
193DB 102,72,15,126,198
194 shr rbx,4
195 xor rax,rcx
196 psrldq xmm0,8
197 xor rdx,rbx
198DB 102,72,15,126,199
199 xor rax,rsi
200 xor rdx,rdi
201
202 add rsp,128+8
203
204 DB 0F3h,0C3h ;repret
205$L$end_mul_1x1:
206
207
208EXTERN OPENSSL_ia32cap_P
209global bn_GF2m_mul_2x2
210
211ALIGN 16
212bn_GF2m_mul_2x2:
213
214 mov rax,rsp
215 mov r10,QWORD[OPENSSL_ia32cap_P]
216 bt r10,33
217 jnc NEAR $L$vanilla_mul_2x2
218
219DB 102,72,15,110,194
220DB 102,73,15,110,201
221DB 102,73,15,110,208
222 movq xmm3,QWORD[40+rsp]
223 movdqa xmm4,xmm0
224 movdqa xmm5,xmm1
225DB 102,15,58,68,193,0
226 pxor xmm4,xmm2
227 pxor xmm5,xmm3
228DB 102,15,58,68,211,0
229DB 102,15,58,68,229,0
230 xorps xmm4,xmm0
231 xorps xmm4,xmm2
232 movdqa xmm5,xmm4
233 pslldq xmm4,8
234 psrldq xmm5,8
235 pxor xmm2,xmm4
236 pxor xmm0,xmm5
237 movdqu XMMWORD[rcx],xmm2
238 movdqu XMMWORD[16+rcx],xmm0
239 DB 0F3h,0C3h ;repret
240
241ALIGN 16
242$L$vanilla_mul_2x2:
243 lea rsp,[((-136))+rsp]
244
245 mov r10,QWORD[176+rsp]
246 mov QWORD[120+rsp],rdi
247 mov QWORD[128+rsp],rsi
248 mov QWORD[80+rsp],r14
249
250 mov QWORD[88+rsp],r13
251
252 mov QWORD[96+rsp],r12
253
254 mov QWORD[104+rsp],rbp
255
256 mov QWORD[112+rsp],rbx
257
258$L$body_mul_2x2:
259 mov QWORD[32+rsp],rcx
260 mov QWORD[40+rsp],rdx
261 mov QWORD[48+rsp],r8
262 mov QWORD[56+rsp],r9
263 mov QWORD[64+rsp],r10
264
265 mov r8,0xf
266 mov rax,rdx
267 mov rbp,r9
268 call _mul_1x1
269 mov QWORD[16+rsp],rax
270 mov QWORD[24+rsp],rdx
271
272 mov rax,QWORD[48+rsp]
273 mov rbp,QWORD[64+rsp]
274 call _mul_1x1
275 mov QWORD[rsp],rax
276 mov QWORD[8+rsp],rdx
277
278 mov rax,QWORD[40+rsp]
279 mov rbp,QWORD[56+rsp]
280 xor rax,QWORD[48+rsp]
281 xor rbp,QWORD[64+rsp]
282 call _mul_1x1
283 mov rbx,QWORD[rsp]
284 mov rcx,QWORD[8+rsp]
285 mov rdi,QWORD[16+rsp]
286 mov rsi,QWORD[24+rsp]
287 mov rbp,QWORD[32+rsp]
288
289 xor rax,rdx
290 xor rdx,rcx
291 xor rax,rbx
292 mov QWORD[rbp],rbx
293 xor rdx,rdi
294 mov QWORD[24+rbp],rsi
295 xor rax,rsi
296 xor rdx,rsi
297 xor rax,rdx
298 mov QWORD[16+rbp],rdx
299 mov QWORD[8+rbp],rax
300
301 mov r14,QWORD[80+rsp]
302
303 mov r13,QWORD[88+rsp]
304
305 mov r12,QWORD[96+rsp]
306
307 mov rbp,QWORD[104+rsp]
308
309 mov rbx,QWORD[112+rsp]
310
311 mov rdi,QWORD[120+rsp]
312 mov rsi,QWORD[128+rsp]
313 lea rsp,[136+rsp]
314
315$L$epilogue_mul_2x2:
316 DB 0F3h,0C3h ;repret
317$L$end_mul_2x2:
318
319
320DB 71,70,40,50,94,109,41,32,77,117,108,116,105,112,108,105
321DB 99,97,116,105,111,110,32,102,111,114,32,120,56,54,95,54
322DB 52,44,32,67,82,89,80,84,79,71,65,77,83,32,98,121
323DB 32,60,97,112,112,114,111,64,111,112,101,110,115,115,108,46
324DB 111,114,103,62,0
325ALIGN 16
326EXTERN __imp_RtlVirtualUnwind
327
328
329ALIGN 16
330se_handler:
331 push rsi
332 push rdi
333 push rbx
334 push rbp
335 push r12
336 push r13
337 push r14
338 push r15
339 pushfq
340 sub rsp,64
341
342 mov rax,QWORD[120+r8]
343 mov rbx,QWORD[248+r8]
344
345 lea r10,[$L$body_mul_2x2]
346 cmp rbx,r10
347 jb NEAR $L$in_prologue
348
349 mov rax,QWORD[152+r8]
350
351 lea r10,[$L$epilogue_mul_2x2]
352 cmp rbx,r10
353 jae NEAR $L$in_prologue
354
355 mov r14,QWORD[80+rax]
356 mov r13,QWORD[88+rax]
357 mov r12,QWORD[96+rax]
358 mov rbp,QWORD[104+rax]
359 mov rbx,QWORD[112+rax]
360 mov rdi,QWORD[120+rax]
361 mov rsi,QWORD[128+rax]
362
363 mov QWORD[144+r8],rbx
364 mov QWORD[160+r8],rbp
365 mov QWORD[168+r8],rsi
366 mov QWORD[176+r8],rdi
367 mov QWORD[216+r8],r12
368 mov QWORD[224+r8],r13
369 mov QWORD[232+r8],r14
370
371 lea rax,[136+rax]
372
373$L$in_prologue:
374 mov QWORD[152+r8],rax
375
376 mov rdi,QWORD[40+r9]
377 mov rsi,r8
378 mov ecx,154
379 DD 0xa548f3fc
380
381 mov rsi,r9
382 xor rcx,rcx
383 mov rdx,QWORD[8+rsi]
384 mov r8,QWORD[rsi]
385 mov r9,QWORD[16+rsi]
386 mov r10,QWORD[40+rsi]
387 lea r11,[56+rsi]
388 lea r12,[24+rsi]
389 mov QWORD[32+rsp],r10
390 mov QWORD[40+rsp],r11
391 mov QWORD[48+rsp],r12
392 mov QWORD[56+rsp],rcx
393 call QWORD[__imp_RtlVirtualUnwind]
394
395 mov eax,1
396 add rsp,64
397 popfq
398 pop r15
399 pop r14
400 pop r13
401 pop r12
402 pop rbp
403 pop rbx
404 pop rdi
405 pop rsi
406 DB 0F3h,0C3h ;repret
407
408
409section .pdata rdata align=4
410ALIGN 4
411 DD _mul_1x1 wrt ..imagebase
412 DD $L$end_mul_1x1 wrt ..imagebase
413 DD $L$SEH_info_1x1 wrt ..imagebase
414
415 DD $L$vanilla_mul_2x2 wrt ..imagebase
416 DD $L$end_mul_2x2 wrt ..imagebase
417 DD $L$SEH_info_2x2 wrt ..imagebase
418section .xdata rdata align=8
419ALIGN 8
420$L$SEH_info_1x1:
421DB 0x01,0x07,0x02,0x00
422DB 0x07,0x01,0x11,0x00
423$L$SEH_info_2x2:
424DB 9,0,0,0
425 DD se_handler wrt ..imagebase
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette