Debian Codegraph @

crypto_nP/montgomery25519/amd64-maa4/fe25519_nsquare.S

raw
1 #include "crypto_asm_property.h"
2 #include "crypto_asm_hidden.h"
3 // linker define fe25519_nsquare
4 // linker use mask63
5
6 /* Assembly for feedback field squaring. */
7
8 #define mask63 CRYPTO_SHARED_NAMESPACE(mask63)
9
10 .p2align 5
11 ASM_HIDDEN _CRYPTO_SHARED_NAMESPACE(fe25519_nsquare)
12 .globl _CRYPTO_SHARED_NAMESPACE(fe25519_nsquare)
13 ASM_HIDDEN CRYPTO_SHARED_NAMESPACE(fe25519_nsquare)
14 .globl CRYPTO_SHARED_NAMESPACE(fe25519_nsquare)
15 _CRYPTO_SHARED_NAMESPACE(fe25519_nsquare):
16 CRYPTO_SHARED_NAMESPACE(fe25519_nsquare):
17
18 movq %rsp,%r11
19 andq $-32,%rsp
20 subq $64,%rsp
21
22 movq %r11,0(%rsp)
23 movq %r12,8(%rsp)
24 movq %r13,16(%rsp)
25 movq %r14,24(%rsp)
26 movq %r15,32(%rsp)
27 movq %rbx,40(%rsp)
28 movq %rbp,48(%rsp)
29 movq %rdi,56(%rsp)
30
31 movq 0(%rsi),%rbx
32 movq 8(%rsi),%rbp
33 movq 16(%rsi),%rcx
34 movq 24(%rsi),%rsi
35
36 movq %rdx,%rdi
37
38 .L:
39
40 movq %rsi,%rax
41 mulq %rsi
42 movq %rax,%r12
43 movq $0,%r13
44
45 movq $38,%rax
46 mulq %rdx
47 movq %rax,%r14
48 movq %rdx,%r15
49
50 movq %rbp,%rax
51 mulq %rsi
52 movq %rax,%r8
53 movq $0,%r9
54 movq %rdx,%r10
55 movq $0,%r11
56
57 addq %rax,%r8
58 adcq $0,%r9
59 addq %rdx,%r10
60 adcq $0,%r11
61
62 movq %rcx,%rax
63 mulq %rcx
64 addq %rax,%r8
65 adcq $0,%r9
66 addq %rdx,%r10
67 adcq $0,%r11
68
69 movq %rcx,%rax
70 mulq %rsi
71 addq %rax,%r10
72 adcq $0,%r11
73 addq %rdx,%r12
74 adcq $0,%r13
75
76
77 addq %rax,%r10
78 adcq $0,%r11
79 addq %rdx,%r12
80 adcq $0,%r13
81
82 movq $38,%rax
83 mulq %r10
84 imul $38,%r11,%r11
85 movq %rax,%r10
86 addq %rdx,%r11
87
88 movq $38,%rax
89 mulq %r12
90 imul $38,%r13,%r13
91 movq %rax,%r12
92 addq %rdx,%r13
93
94 movq %rbx,%rax
95 mulq %rsi
96 addq %rax,%r14
97 adcq $0,%r15
98 addq %rdx,%r8
99 adcq $0,%r9
100
101 addq %rax,%r14
102 adcq $0,%r15
103 addq %rdx,%r8
104 adcq $0,%r9
105
106 movq %rbp,%rax
107 mulq %rcx
108 addq %rax,%r14
109 adcq $0,%r15
110 addq %rdx,%r8
111 adcq $0,%r9
112
113 addq %rax,%r14
114 adcq $0,%r15
115 addq %rdx,%r8
116 adcq $0,%r9
117
118 movq $38,%rax
119 mulq %r8
120 imul $38,%r9,%r9
121 movq %rax,%r8
122 addq %rdx,%r9
123
124 movq %rbx,%rax
125 mulq %rbx
126 addq %rax,%r8
127 adcq $0,%r9
128 addq %rdx,%r10
129 adcq $0,%r11
130
131 movq %rbx,%rax
132 mulq %rbp
133 addq %rax,%r10
134 adcq $0,%r11
135 addq %rdx,%r12
136 adcq $0,%r13
137
138 addq %rax,%r10
139 adcq $0,%r11
140 addq %rdx,%r12
141 adcq $0,%r13
142
143 movq %rbx,%rax
144 mulq %rcx
145 addq %rax,%r12
146 adcq $0,%r13
147 addq %rdx,%r14
148 adcq $0,%r15
149
150 addq %rax,%r12
151 adcq $0,%r13
152 addq %rdx,%r14
153 adcq $0,%r15
154
155 movq %rbp,%rax
156 mulq %rbp
157 addq %rax,%r12
158 adcq $0,%r13
159 addq %rdx,%r14
160 adcq $0,%r15
161
162 movq %r10,%rbp
163 addq %r9,%rbp
164 adcq $0,%r11
165
166 movq %r12,%rcx
167 addq %r11,%rcx
168 adcq $0,%r13
169
170 movq %r14,%rsi
171 addq %r13,%rsi
172 adcq $0,%r15
173
174 shld $1,%rsi,%r15
175 imul $19,%r15,%rbx
176 andq mask63(%rip),%rsi
177
178 addq %r8,%rbx
179 adcq $0,%rbp
180 adcq $0,%rcx
181 adcq $0,%rsi
182
183 subq $1,%rdi
184 cmpq $0,%rdi
185
186 jne .L
187
188 movq 56(%rsp),%rdi
189
190 movq %rbx,0(%rdi)
191 movq %rbp,8(%rdi)
192 movq %rcx,16(%rdi)
193 movq %rsi,24(%rdi)
194
195 movq 0(%rsp),%r11
196 movq 8(%rsp),%r12
197 movq 16(%rsp),%r13
198 movq 24(%rsp),%r14
199 movq 32(%rsp),%r15
200 movq 40(%rsp),%rbx
201 movq 48(%rsp),%rbp
202
203 movq %r11,%rsp
204
205 ret
206 .section .note.GNU-stack,"",@progbits