Debian Codegraph @

crypto_nP/montgomery25519/amd64-mxaa/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
16 _CRYPTO_SHARED_NAMESPACE(fe25519_nsquare):
17 CRYPTO_SHARED_NAMESPACE(fe25519_nsquare):
18
19 movq %rsp,%r11
20 andq $-32,%rsp
21 subq $56,%rsp
22
23 movq %r11,0(%rsp)
24 movq %r12,8(%rsp)
25 movq %r13,16(%rsp)
26 movq %r14,24(%rsp)
27 movq %r15,32(%rsp)
28 movq %rbp,40(%rsp)
29 movq %rbx,48(%rsp)
30
31 movq 0(%rsi),%r8
32 movq 8(%rsi),%r9
33 movq 16(%rsi),%r10
34 movq 24(%rsi),%r11
35
36 movq %r8,0(%rdi)
37 movq %r9,8(%rdi)
38 movq %r10,16(%rdi)
39 movq %r11,24(%rdi)
40
41 mov %rdx,%rbp
42
43 .L:
44 movq 0(%rdi),%rdx
45
46 mulx 8(%rdi),%r9,%r10
47 mulx 16(%rdi),%rcx,%r11
48 addq %rcx,%r10
49
50 mulx 24(%rdi),%rcx,%r12
51 adcq %rcx,%r11
52 adcq $0,%r12
53
54 movq 8(%rdi),%rdx
55
56 mulx 16(%rdi),%rax,%rbx
57 mulx 24(%rdi),%rcx,%r13
58 addq %rcx,%rbx
59 adcq $0,%r13
60
61 addq %rax,%r11
62 adcq %rbx,%r12
63
64 movq 16(%rdi),%rdx
65
66 mulx 24(%rdi),%rax,%r14
67
68 adcq %rax,%r13
69 adcq $0,%r14
70
71 movq $0,%r15
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 movq 0(%rdi),%rdx
81 mulx %rdx,%r8,%rax
82 addq %rax,%r9
83
84 movq 8(%rdi),%rdx
85 mulx %rdx,%rax,%rbx
86 adcq %rax,%r10
87 adcq %rbx,%r11
88
89 movq 16(%rdi),%rdx
90 mulx %rdx,%rax,%rbx
91 adcq %rax,%r12
92 adcq %rbx,%r13
93
94 movq 24(%rdi),%rdx
95 mulx %rdx,%rax,%rbx
96 adcq %rax,%r14
97 adcq %rbx,%r15
98
99 movq $38,%rdx
100
101 mulx %r12,%r12,%rbx
102 mulx %r13,%r13,%rcx
103 addq %rbx,%r13
104
105 mulx %r14,%r14,%rbx
106 adcq %rcx,%r14
107
108 mulx %r15,%r15,%rcx
109 adcq %rbx,%r15
110 adcq $0,%rcx
111
112 addq %r12,%r8
113 adcq %r13,%r9
114 adcq %r14,%r10
115 adcq %r15,%r11
116 adcq $0,%rcx
117
118 shld $1,%r11,%rcx
119 andq mask63(%rip),%r11
120
121 imul $19,%rcx,%rcx
122 addq %rcx,%r8
123 adcq $0,%r9
124 adcq $0,%r10
125 adcq $0,%r11
126
127 movq %r8,0(%rdi)
128 movq %r9,8(%rdi)
129 movq %r10,16(%rdi)
130 movq %r11,24(%rdi)
131
132 subq $1,%rbp
133 cmpq $0,%rbp
134
135 jne .L
136
137 movq 0(%rsp),%r11
138 movq 8(%rsp),%r12
139 movq 16(%rsp),%r13
140 movq 24(%rsp),%r14
141 movq 32(%rsp),%r15
142 movq 40(%rsp),%rbp
143 movq 48(%rsp),%rbx
144
145 movq %r11,%rsp
146
147 ret
148 .section .note.GNU-stack,"",@progbits