Debian Codegraph @

crypto_nP/montgomery25519/arm64-maa4-redmul/fe25519_square.S

raw
1 #include "crypto_asm_property.h"
2 #include "crypto_asm_hidden.h"
3 // linker define fe25519_square
4
5 /* Assembly for field squaring */
6
7 .p2align 4
8 ASM_HIDDEN _CRYPTO_SHARED_NAMESPACE(fe25519_square)
9 .globl _CRYPTO_SHARED_NAMESPACE(fe25519_square)
10 ASM_HIDDEN CRYPTO_SHARED_NAMESPACE(fe25519_square)
11 .globl CRYPTO_SHARED_NAMESPACE(fe25519_square)
12
13 _CRYPTO_SHARED_NAMESPACE(fe25519_square):
14 CRYPTO_SHARED_NAMESPACE(fe25519_square):
15
16 ldp x3, x4, [x1, #0]
17 ldp x5, x6, [x1, #16]
18
19 mov x2, #38
20
21 mul x8, x4, x6
22 adds x8, x8, x8
23 cset x9, cs
24 mul x1, x5, x5
25 adds x8, x8, x1
26 adc x9, x9, xzr
27 umulh x1, x3, x6
28 adds x8, x8, x1
29 adc x9, x9, xzr
30 adds x8, x8, x1
31 adc x9, x9, xzr
32 umulh x1, x4, x5
33 adds x8, x8, x1
34 adc x9, x9, xzr
35 adds x10, x8, x1
36 adc x9, x9, xzr
37
38 mul x8, x2, x10
39 umulh x10, x2, x10
40 mul x9, x2, x9
41 add x9, x9, x10
42
43 mul x1, x3, x3
44 adds x8, x8, x1
45 adc x9, x9, xzr
46
47 mul x10, x5, x6
48 adds x10, x10, x10
49 cset x11, cs
50 umulh x1, x5, x5
51 adds x10, x10, x1
52 adc x11, x11, xzr
53 umulh x1, x4, x6
54 adds x10, x10, x1
55 adc x11, x11, xzr
56 adds x12, x10, x1
57 adc x11, x11, xzr
58
59 mul x10, x2, x12
60 umulh x12, x2, x12
61 mul x11, x2, x11
62 add x11, x11, x12
63
64 mul x1, x3, x4
65 adds x10, x10, x1
66 adc x11, x11, xzr
67 adds x10, x10, x1
68 adc x11, x11, xzr
69 umulh x1, x3, x3
70 adds x10, x10, x1
71 adcs x11, x11, xzr
72
73 mul x12, x6, x6
74 cset x13, cs
75 umulh x1, x5, x6
76 adds x12, x12, x1
77 adc x13, x13, xzr
78 adds x14, x12, x1
79 adc x13, x13, xzr
80
81 mul x12, x2, x14
82 umulh x14, x2, x14
83 mul x13, x2, x13
84 add x13, x13, x14
85
86 mul x1, x3, x5
87 adds x12, x12, x1
88 adc x13, x13, xzr
89 adds x12, x12, x1
90 adc x13, x13, xzr
91 mul x1, x4, x4
92 adds x12, x12, x1
93 adc x13, x13, xzr
94 umulh x1, x3, x4
95 adds x12, x12, x1
96 adc x13, x13, xzr
97 adds x12, x12, x1
98 adc x13, x13, xzr
99
100 umulh x15, x6, x6
101 mul x14, x2, x15
102 umulh x15, x2, x15
103
104 mul x1, x3, x6
105 adds x14, x14, x1
106 adc x15, x15, xzr
107 adds x14, x14, x1
108 adc x15, x15, xzr
109 mul x1, x4, x5
110 adds x14, x14, x1
111 adc x15, x15, xzr
112 adds x14, x14, x1
113 adc x15, x15, xzr
114 umulh x1, x3, x5
115 adds x14, x14, x1
116 adc x15, x15, xzr
117 adds x14, x14, x1
118 adc x15, x15, xzr
119 umulh x1, x4, x4
120 adds x14, x14, x1
121 adc x15, x15, xzr
122
123 adds x10, x10, x9
124 adcs x12, x12, x11
125 adcs x14, x14, x13
126 adc x15, x15, xzr
127
128 cmn x14, x14
129 adc x15, x15, x15
130 mov x18, #19
131 mul x15, x15, x18
132
133 bic x14, x14, #0x8000000000000000
134 adds x8, x8, x15
135 adcs x10, x10, xzr
136 adcs x12, x12, xzr
137 adc x14, x14, xzr
138
139 stp x8, x10, [x0, #0]
140 stp x12, x14, [x0, #16]
141
142 ret
143 .section .note.GNU-stack,"",@progbits