27 #include "../../bfloat.hpp"
31 void a64_interleaved_bf16fp32_dot_8x12_x1(
const bfloat16 *Apanel,
const bfloat16 *Bpanel,
float *Cpanel,
int ablocks,
int bblocks,
int K) {
33 float *c_ptr = Cpanel;
36 const long loops_count = (
K / 2) - 1;
37 const long tails_count =
K % 2;
39 for (
int yb=0; yb<ablocks; yb++) {
43 for (
int xb=0; xb<bblocks; xb++) {
45 long loops = loops_count;
46 long tails = tails_count;
50 "ldr q0, [%[a_ptr]]\n"
52 "ldr q2, [%[b_ptr]]\n"
54 "ldr q3, [%[b_ptr], #0x10]\n"
56 "add %[a_ptr], %[a_ptr], #0x20\n"
58 "add %[b_ptr], %[b_ptr], #0x30\n"
80 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
81 "ldr q4, [%[b_ptr], #-0x10]\n"
82 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
83 "ldr q1, [%[a_ptr], #-0x10]\n"
84 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
85 "subs %[loops], %[loops], #0x1\n"
86 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
87 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
88 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
89 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
90 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
91 "ldr q2, [%[b_ptr]]\n"
92 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
93 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
94 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
95 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
96 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
97 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
98 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
99 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
100 "ldr q3, [%[b_ptr], #0x10]\n"
101 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
102 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
103 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
104 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
105 "ldr q0, [%[a_ptr]]\n"
106 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
107 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
108 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
109 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
110 "ldr q4, [%[b_ptr], #0x20]\n"
111 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
112 "ldr q1, [%[a_ptr], #0x10]\n"
113 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
114 "add %[a_ptr], %[a_ptr], #0x40\n"
115 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
116 "add %[b_ptr], %[b_ptr], #0x60\n"
117 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
118 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
119 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
120 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
121 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
122 "ldr q2, [%[b_ptr], #-0x30]\n"
123 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
124 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
125 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
126 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
127 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
128 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
129 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
130 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
131 "ldr q3, [%[b_ptr], #-0x20]\n"
132 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
133 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
134 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
135 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
136 "ldr q0, [%[a_ptr], #-0x20]\n"
137 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
138 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
139 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
140 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
144 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
145 "ldr q4, [%[b_ptr], #-0x10]\n"
146 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
147 "ldr q1, [%[a_ptr], #-0x10]\n"
148 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
149 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
150 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
151 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
152 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
153 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
154 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
155 "ldr q2, [%[b_ptr]]\n"
156 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
157 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
158 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
159 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
160 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
161 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
162 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
163 "ldr q3, [%[b_ptr], #0x10]\n"
164 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
165 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
166 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
167 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
168 "ldr q0, [%[a_ptr]]\n"
169 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
170 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
171 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
172 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
173 "ldr q4, [%[b_ptr], #0x20]\n"
174 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
175 "ldr q1, [%[a_ptr], #0x10]\n"
176 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
177 "add %[a_ptr], %[a_ptr], #0x40\n"
178 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
179 "add %[b_ptr], %[b_ptr], #0x60\n"
180 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
181 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
182 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
183 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
184 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
185 "ldr q2, [%[b_ptr], #-0x30]\n"
186 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
187 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
188 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
189 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
190 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
191 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
192 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
193 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
194 "ldr q3, [%[b_ptr], #-0x20]\n"
195 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
196 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
197 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
198 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
199 "ldr q0, [%[a_ptr], #-0x20]\n"
200 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
201 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
202 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
203 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
204 "ldr q4, [%[b_ptr], #-0x10]\n"
205 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
206 "ldr q1, [%[a_ptr], #-0x10]\n"
207 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
208 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
209 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
210 "str q8, [%[c_ptr]]\n"
211 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
212 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
213 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
214 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
215 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
216 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
217 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
218 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
219 "str q12, [%[c_ptr], #0x10]\n"
220 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
221 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
222 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
223 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
224 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
225 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
226 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
227 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
228 "str q16, [%[c_ptr], #0x20]\n"
229 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
230 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
231 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
232 "str q9, [%[c_ptr], #0x30]\n"
233 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
236 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
237 "ldr q4, [%[b_ptr], #-0x10]\n"
238 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
239 "ldr q1, [%[a_ptr], #-0x10]\n"
240 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
241 "add %[a_ptr], %[a_ptr], #0x20\n"
242 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
243 "add %[b_ptr], %[b_ptr], #0x30\n"
244 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
245 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
246 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
247 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
248 "ldr q2, [%[b_ptr], #-0x30]\n"
249 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
250 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
251 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
252 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
253 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
254 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
255 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
256 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
257 "ldr q3, [%[b_ptr], #-0x20]\n"
258 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
259 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
260 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
261 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
262 "ldr q0, [%[a_ptr], #-0x20]\n"
263 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
264 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
265 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
266 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
267 "ldr q4, [%[b_ptr], #-0x10]\n"
268 ".inst 0x4f40f048 // bfdot v8.4s, v2.8h, v0.h[0]\n"
269 "ldr q1, [%[a_ptr], #-0x10]\n"
270 ".inst 0x4f60f049 // bfdot v9.4s, v2.8h, v0.h[1]\n"
271 ".inst 0x4f40f84a // bfdot v10.4s, v2.8h, v0.h[2]\n"
272 ".inst 0x4f60f84b // bfdot v11.4s, v2.8h, v0.h[3]\n"
273 "str q8, [%[c_ptr]]\n"
274 ".inst 0x4f41f054 // bfdot v20.4s, v2.8h, v1.h[0]\n"
275 ".inst 0x4f61f055 // bfdot v21.4s, v2.8h, v1.h[1]\n"
276 ".inst 0x4f41f856 // bfdot v22.4s, v2.8h, v1.h[2]\n"
277 ".inst 0x4f61f857 // bfdot v23.4s, v2.8h, v1.h[3]\n"
278 ".inst 0x4f40f06c // bfdot v12.4s, v3.8h, v0.h[0]\n"
279 ".inst 0x4f60f06d // bfdot v13.4s, v3.8h, v0.h[1]\n"
280 ".inst 0x4f40f86e // bfdot v14.4s, v3.8h, v0.h[2]\n"
281 ".inst 0x4f60f86f // bfdot v15.4s, v3.8h, v0.h[3]\n"
282 "str q12, [%[c_ptr], #0x10]\n"
283 ".inst 0x4f41f078 // bfdot v24.4s, v3.8h, v1.h[0]\n"
284 ".inst 0x4f61f079 // bfdot v25.4s, v3.8h, v1.h[1]\n"
285 ".inst 0x4f41f87a // bfdot v26.4s, v3.8h, v1.h[2]\n"
286 ".inst 0x4f61f87b // bfdot v27.4s, v3.8h, v1.h[3]\n"
287 ".inst 0x4f40f090 // bfdot v16.4s, v4.8h, v0.h[0]\n"
288 ".inst 0x4f60f091 // bfdot v17.4s, v4.8h, v0.h[1]\n"
289 ".inst 0x4f40f892 // bfdot v18.4s, v4.8h, v0.h[2]\n"
290 ".inst 0x4f60f893 // bfdot v19.4s, v4.8h, v0.h[3]\n"
291 "str q16, [%[c_ptr], #0x20]\n"
292 ".inst 0x4f41f09c // bfdot v28.4s, v4.8h, v1.h[0]\n"
293 ".inst 0x4f61f09d // bfdot v29.4s, v4.8h, v1.h[1]\n"
294 ".inst 0x4f41f89e // bfdot v30.4s, v4.8h, v1.h[2]\n"
295 "str q9, [%[c_ptr], #0x30]\n"
296 ".inst 0x4f61f89f // bfdot v31.4s, v4.8h, v1.h[3]\n"
298 "str q13, [%[c_ptr], #0x40]\n"
299 "str q17, [%[c_ptr], #0x50]\n"
300 "str q10, [%[c_ptr], #0x60]\n"
301 "str q14, [%[c_ptr], #0x70]\n"
302 "str q18, [%[c_ptr], #0x80]\n"
303 "str q11, [%[c_ptr], #0x90]\n"
304 "str q15, [%[c_ptr], #0xa0]\n"
305 "str q19, [%[c_ptr], #0xb0]\n"
306 "str q20, [%[c_ptr], #0xc0]\n"
307 "str q24, [%[c_ptr], #0xd0]\n"
308 "str q28, [%[c_ptr], #0xe0]\n"
309 "str q21, [%[c_ptr], #0xf0]\n"
310 "str q25, [%[c_ptr], #0x100]\n"
311 "str q29, [%[c_ptr], #0x110]\n"
312 "str q22, [%[c_ptr], #0x120]\n"
313 "str q26, [%[c_ptr], #0x130]\n"
314 "str q30, [%[c_ptr], #0x140]\n"
315 "str q23, [%[c_ptr], #0x150]\n"
316 "str q27, [%[c_ptr], #0x160]\n"
317 "str q31, [%[c_ptr], #0x170]\n"
318 "add %[c_ptr], %[c_ptr], #0x180\n"
319 : [a_ptr]
"+r" (a_ptr), [b_ptr]
"+r" (b_ptr), [c_ptr]
"+r" (c_ptr),
320 [loops]
"+r" (loops), [tails]
"+r" (tails)
322 :
"v0",
"v1",
"v2",
"v3",
"v4",
"v8",
"v9",
"v10",
"v11",
"v12",
"v13",
"v14",
"v15",
"v16",
"v17",
"v18",
"v19",
"v20",
"v21",
"v22",
"v23",
"v24",
"v25",
"v26",
"v27",
"v28",
"v29",
"v30",
"v31",
"cc",
"memory"
330 #endif // __aarch64__