Debian Codegraph @

crypto_nG/merged25519/amd64-maax-opt/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),%rax
34 movq 24(%rsi),%rsi
35
36 movq %rdx,%rdi
37
38 .L:
39
40 xorq %r13,%r13
41 movq %rbx,%rdx
42
43 mulx %rbp,%r9,%r10
44
45 mulx %rax,%rcx,%r11
46 adcx %rcx,%r10
47
48 mulx %rsi,%rcx,%r12
49 adcx %rcx,%r11
50 adcx %r13,%r12
51
52 movq %rbp,%rdx
53 xorq %r14,%r14
54
55 mulx %rax,%rcx,%rdx
56 adcx %rcx,%r11
57 adox %rdx,%r12
58
59 movq %rbp,%rdx
60 mulx %rsi,%rcx,%rdx
61 adcx %rcx,%r12
62 adox %rdx,%r13
63 adcx %r14,%r13
64
65 xorq %r15,%r15
66 movq %rax,%rdx
67
68 mulx %rsi,%rcx,%r14
69 adcx %rcx,%r13
70 adcx %r15,%r14
71
72 shld $1,%r14,%r15
73 shld $1,%r13,%r14
74 shld $1,%r12,%r13
75 shld $1,%r11,%r12
76 shld $1,%r10,%r11
77 shld $1,%r9,%r10
78 shlq $1,%r9
79
80 xorq %rdx,%rdx
81 movq %rbx,%rdx
82 mulx %rdx,%r8,%rdx
83 adcx %rdx,%r9
84
85 movq %rbp,%rdx
86 mulx %rdx,%rcx,%rdx
87 adcx %rcx,%r10
88 adcx %rdx,%r11
89
90 movq %rax,%rdx
91 mulx %rdx,%rcx,%rdx
92 adcx %rcx,%r12
93 adcx %rdx,%r13
94
95 movq %rsi,%rdx
96 mulx %rdx,%rcx,%rdx
97 adcx %rcx,%r14
98 adcx %rdx,%r15
99
100 xorq %rbx,%rbx
101 movq $38,%rdx
102
103 mulx %r12,%r12,%rbp
104 adcx %r8,%r12
105 adox %r9,%rbp
106
107 mulx %r13,%rcx,%rax
108 adcx %rcx,%rbp
109 adox %r10,%rax
110
111 mulx %r14,%rcx,%rsi
112 adcx %rcx,%rax
113 adox %r11,%rsi
114
115 mulx %r15,%rcx,%r15
116 adcx %rcx,%rsi
117 adox %rbx,%r15
118 adcx %rbx,%r15
119
120 shld $1,%rsi,%r15
121 andq mask63(%rip),%rsi
122
123 imul $19,%r15,%rbx
124 addq %r12,%rbx
125 adcq $0,%rbp
126 adcq $0,%rax
127 adcq $0,%rsi
128
129 subq $1,%rdi
130 cmpq $0,%rdi
131
132 jne .L
133
134 movq 56(%rsp),%rdi
135
136 movq %rbx,0(%rdi)
137 movq %rbp,8(%rdi)
138 movq %rax,16(%rdi)
139 movq %rsi,24(%rdi)
140
141 movq 0(%rsp),%r11
142 movq 8(%rsp),%r12
143 movq 16(%rsp),%r13
144 movq 24(%rsp),%r14
145 movq 32(%rsp),%r15
146 movq 40(%rsp),%rbx
147 movq 48(%rsp),%rbp
148
149 movq %r11,%rsp
150
151 ret
152 .section .note.GNU-stack,"",@progbits