Debian Codegraph @

src/f32-igemm/gen/f32-igemm-1x8-minmax-asm-aarch64-neonfma-cortex-a75.S

raw
1 // Auto-generated file. Do not edit!
2 // Template: src/f32-igemm/1x8-aarch64-neonfma-cortex-a75.S.in
3 // Generator: tools/xngen
4 //
5 // Copyright 2019 Google LLC
6 //
7 // This source code is licensed under the BSD-style license found in the
8 // LICENSE file in the root directory of this source tree.
9
10 #include "xnnpack/assembly.h"
11
12 # void xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_cortex_a75(
13 # size_t mr, (x0) - unused. mr = 1
14 # size_t nc, x1
15 # size_t kc, x2 / x0
16 # size_t ks, x3 / x9
17 # const float** restrict a, x4
18 # const float* restrict w, x5
19 # float* restrict c, x6
20 # size_t cm_stride, (x7) - unused
21 # size_t cn_stride, [sp] -> x10
22 # size_t a_offset, [sp + 8] -> x11
23 # const float* zero, [sp + 16] -> x12
24 # const xnn_f32_minmax_params params [sp + 24] -> (x7)
25
26 # d8-d15, x19-x30 need to be preserved if used. x18 is reserved by the OS.
27
28 # Register usage
29 # A0 x8 v0 v1
30 # B x5 v20 v21 v22 v23
31 # B v24 v25 v26 v27
32 # C0 x6 v16 v17
33 # Clamp v30 v31
34
35 BEGIN_FUNCTION xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_cortex_a75
36
37 # Load cn_stride, a_offset
38 LDP x10, x11, [sp]
39
40 # Load zero, params pointer
41 LDP x12, x7, [sp, 16]
42
43 # Load min/max values
44 LD2R {v30.4s, v31.4s}, [x7]
45
46 0:
47 # Load initial bias from w into accumulators
48 LDP q16, q17, [x5], 32
49 MOVI v18.4s, 0 // second set of C for pipelining FMLA
50 MOVI v19.4s, 0
51
52 MOV x9, x3 // p = ks
53
54 1:
55 # Load next A pointer
56 LDR x8, [x4], 8
57
58 CMP x8, x12 // if a0 == zero
59 ADD x8, x8, x11 // a0 += a_offset
60 CSEL x8, x12, x8, EQ // a0 = zero, else += a0 + a_offset
61
62 # Is there at least 8 floats (32 bytes) for prologue + epilogue?
63 SUBS x0, x2, 32 // k = kc - 32
64 B.LO 4f
65
66 # 16 prologue
67 # Read first block of A and B.
68 LDP q20, q21, [x5], 32
69 LDP q22, q23, [x5], 32
70 LDP q24, q25, [x5], 32
71 LDP q26, q27, [x5], 32
72 LDR q0, [x8], 16
73
74 # Is there at least 8. yes do main loop
75 SUBS x0, x0, 32
76 B.LO 3f
77
78 # Main loop - 8 floats of A (32 bytes)
79 2:
80 # First block of 4. FMA for first 4, loads for 2nd block of 4.
81 FMLA v16.4s, v20.4s, v0.s[0]
82 LDR q1, [x8], 16
83 FMLA v17.4s, v21.4s, v0.s[0]
84 LDP q20, q21, [x5], 32
85 FMLA v18.4s, v22.4s, v0.s[1]
86 FMLA v19.4s, v23.4s, v0.s[1]
87 LDP q22, q23, [x5], 32
88 FMLA v16.4s, v24.4s, v0.s[2]
89 FMLA v17.4s, v25.4s, v0.s[2]
90 LDP q24, q25, [x5], 32
91 FMLA v18.4s, v26.4s, v0.s[3]
92 FMLA v19.4s, v27.4s, v0.s[3]
93 LDP q26, q27, [x5], 32
94
95 # Second block of 4. FMA for second 4, loads for 1st block of 4.
96 FMLA v16.4s, v20.4s, v1.s[0]
97 LDR q0, [x8], 16
98 FMLA v17.4s, v21.4s, v1.s[0]
99 LDP q20, q21, [x5], 32
100 FMLA v18.4s, v22.4s, v1.s[1]
101 FMLA v19.4s, v23.4s, v1.s[1]
102 LDP q22, q23, [x5], 32
103 FMLA v16.4s, v24.4s, v1.s[2]
104 FMLA v17.4s, v25.4s, v1.s[2]
105 LDP q24, q25, [x5], 32
106 FMLA v18.4s, v26.4s, v1.s[3]
107 FMLA v19.4s, v27.4s, v1.s[3]
108 SUBS x0, x0, 32
109 LDP q26, q27, [x5], 32
110 B.HS 2b
111
112 3:
113 # Epilogue
114
115 # First block of 4. FMA for first 4, loads for 2nd block of 4.
116 FMLA v16.4s, v20.4s, v0.s[0]
117 LDR q1, [x8], 16
118 FMLA v17.4s, v21.4s, v0.s[0]
119 LDP q20, q21, [x5], 32
120 FMLA v18.4s, v22.4s, v0.s[1]
121 FMLA v19.4s, v23.4s, v0.s[1]
122 LDP q22, q23, [x5], 32
123 FMLA v16.4s, v24.4s, v0.s[2]
124 FMLA v17.4s, v25.4s, v0.s[2]
125 LDP q24, q25, [x5], 32
126 FMLA v18.4s, v26.4s, v0.s[3]
127 FMLA v19.4s, v27.4s, v0.s[3]
128 LDP q26, q27, [x5], 32
129
130 # Second block of 4. no loads
131 FMLA v16.4s, v20.4s, v1.s[0]
132 FMLA v17.4s, v21.4s, v1.s[0]
133 FMLA v18.4s, v22.4s, v1.s[1]
134 FMLA v19.4s, v23.4s, v1.s[1]
135 FMLA v16.4s, v24.4s, v1.s[2]
136 FMLA v17.4s, v25.4s, v1.s[2]
137 FMLA v18.4s, v26.4s, v1.s[3]
138 FMLA v19.4s, v27.4s, v1.s[3]
139
140 4:
141 # Is there a remainder?- 4 floats of A (16 bytes)
142 TBNZ x0, 4, 6f
143 # Is there a remainder?- 2 floats of A (8 bytes)
144 TBNZ x0, 3, 7f
145 # Is there a remainder?- 1 float of A (4 bytes)
146 TBNZ x0, 2, 9f
147
148 5:
149 # ks loop
150 SUBS x9, x9, 8 // ks -= MR * sizeof(void*)
151 B.HI 1b
152
153 FADD v16.4s, v16.4s, v18.4s
154 FADD v17.4s, v17.4s, v19.4s
155
156 # Clamp
157 FMAX v16.4s, v16.4s, v30.4s
158 FMAX v17.4s, v17.4s, v30.4s
159 FMIN v16.4s, v16.4s, v31.4s
160 FMIN v17.4s, v17.4s, v31.4s
161
162 # Store full 1 x 8
163 SUBS x1, x1, 8
164 B.LO 10f
165
166 STP q16, q17, [x6]
167 ADD x6, x6, x10
168
169 SUB x4, x4, x3 // a -= ks
170
171 # nc loop
172 B.HI 0b
173
174 RET
175
176 6:
177 # Remainder- 4 floats of A (16 bytes)
178 LDP q20, q21, [x5], 32
179 LDR q0, [x8], 16
180 FMLA v16.4s, v20.4s, v0.s[0]
181 FMLA v17.4s, v21.4s, v0.s[0]
182 LDP q22, q23, [x5], 32
183 LDP q24, q25, [x5], 32
184 LDP q26, q27, [x5], 32
185 FMLA v18.4s, v22.4s, v0.s[1]
186 FMLA v19.4s, v23.4s, v0.s[1]
187 FMLA v16.4s, v24.4s, v0.s[2]
188 FMLA v17.4s, v25.4s, v0.s[2]
189 FMLA v18.4s, v26.4s, v0.s[3]
190 FMLA v19.4s, v27.4s, v0.s[3]
191
192 TBZ x0, 3, 8f
193 7:
194 # Remainder- 2 floats of A (8 bytes)
195 LDP q20, q21, [x5], 32
196 LDR d0, [x8], 8
197 FMLA v16.4s, v20.4s, v0.s[0]
198 FMLA v17.4s, v21.4s, v0.s[0]
199 LDP q22, q23, [x5], 32
200 FMLA v18.4s, v22.4s, v0.s[1]
201 FMLA v19.4s, v23.4s, v0.s[1]
202 8:
203 TBZ x0, 2, 5b
204 9:
205 # Remainder- 1 float of A (4 bytes)
206 LDP q20, q21, [x5], 32
207 LDR s0, [x8], 4
208 FMLA v16.4s, v20.4s, v0.s[0]
209 FMLA v17.4s, v21.4s, v0.s[0]
210 B 5b
211
212 10:
213 # Store odd channels
214 TBZ x1, 2, 11f
215 STR q16, [x6], 16
216 MOV v16.16b, v17.16b
217
218 11:
219 TBZ x1, 1, 12f
220 STR d16, [x6], 8
221 DUP d16, v16.d[1]
222
223 12:
224 TBZ x1, 0, 13f
225 STR s16, [x6], 4
226 13:
227 RET
228
229 END_FUNCTION xnn_f32_igemm_minmax_ukernel_1x8__asm_aarch64_neonfma_cortex_a75
230
231 #ifdef __ELF__
232 .section ".note.GNU-stack","",%progbits
233 #endif