blob: 454260ef1a0441dd4a106e2e84ca8f7616a7e70f [file] [log] [blame]
Georgios Pinitasc0b6f762020-11-02 01:37:17 +00001/*
Michael Tylerbe13cea2023-01-17 11:04:14 +00002 * Copyright (c) 2019-2021 Arm Limited.
Georgios Pinitasc0b6f762020-11-02 01:37:17 +00003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
Michael Tylerbe13cea2023-01-17 11:04:14 +000013 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000015 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Michael Tylerbe13cea2023-01-17 11:04:14 +000020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000023 */
24
25#ifdef __aarch64__
26
27template<>
28void interleave_block<8, 8, VLType::None, true>(
29 uint8_t * &out_ptr, const uint8_t * const * in, size_t width, size_t height,
30 size_t row_offset, bool first
31)
32{
33 __asm__ __volatile__(
Michael Tylerba209752022-12-15 12:39:29 +000034 "movi v5.8h, #0x0\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000035 "ldr x27, [%x[in], #0x0]\n"
36 "mov x19, #0x0\n"
Michael Tylerba209752022-12-15 12:39:29 +000037 "movi v4.8h, #0x0\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000038 "ldr x26, [%x[in], #0x8]\n"
39 "cmp %x[height], #0x8\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000040 "movi v3.8h, #0x0\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000041 "ldr x25, [%x[in], #0x10]\n"
Michael Tylerba209752022-12-15 12:39:29 +000042 "add x27, x27, %x[row_offset]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000043 "movi v2.8h, #0x0\n"
44 "ldr x24, [%x[in], #0x18]\n"
45 "movi v1.4s, #0x0\n"
46 "ldr x23, [%x[in], #0x20]\n"
Michael Tylerba209752022-12-15 12:39:29 +000047 "add x26, x26, %x[row_offset]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000048 "movi v0.4s, #0x0\n"
49 "ldr x22, [%x[in], #0x28]\n"
Michael Tylerba209752022-12-15 12:39:29 +000050 "add x25, x25, %x[row_offset]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000051 "movi v31.4s, #0x0\n"
52 "ldr x21, [%x[in], #0x30]\n"
Michael Tylerba209752022-12-15 12:39:29 +000053 "add x24, x24, %x[row_offset]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000054 "movi v30.4s, #0x0\n"
55 "ldr x20, [%x[in], #0x38]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000056 "add x23, x23, %x[row_offset]\n"
57 "add x22, x22, %x[row_offset]\n"
58 "add x21, x21, %x[row_offset]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000059 "add x20, x20, %x[row_offset]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000060 "beq 1f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000061 "mov x20, x27\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000062 "cmp %x[height], #0x2\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000063 "csel x26, x26, x27, GE\n"
64 "csel x25, x25, x27, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000065 "cmp %x[height], #0x4\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000066 "csel x24, x24, x27, GE\n"
67 "csel x23, x23, x27, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000068 "cmp %x[height], #0x6\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000069 "csel x22, x22, x27, GE\n"
70 "csel x21, x21, x27, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000071 "1:" // no_pointer_adj
Michael Tylerba209752022-12-15 12:39:29 +000072 "movi v29.4s, #0x0\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000073 "prfm pldl1keep, [x27, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000074 "movi v28.4s, #0x0\n"
75 "prfm pldl1keep, [x26, #0x0]\n"
76 "prfm pldl1keep, [x25, #0x0]\n"
77 "prfm pldl1keep, [x24, #0x0]\n"
78 "prfm pldl1keep, [x23, #0x0]\n"
79 "prfm pldl1keep, [x22, #0x0]\n"
80 "prfm pldl1keep, [x21, #0x0]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000081 "prfm pldl1keep, [x20, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000082 "prfm pldl1keep, [x27, #0x40]\n"
83 "prfm pldl1keep, [x26, #0x40]\n"
84 "prfm pldl1keep, [x25, #0x40]\n"
85 "prfm pldl1keep, [x24, #0x40]\n"
86 "prfm pldl1keep, [x23, #0x40]\n"
87 "prfm pldl1keep, [x22, #0x40]\n"
88 "prfm pldl1keep, [x21, #0x40]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000089 "prfm pldl1keep, [x20, #0x40]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000090 "cbnz %w[first], 2f\n"
91 "sub %x[out_ptr], %x[out_ptr], #0x20\n"
92 "ld1 { v29.4s }, [%x[out_ptr]]\n"
93 "ldr q28, [%x[out_ptr], #0x10]\n"
94 "2:" // first_pass
95 "cmp %x[width], #0x10\n"
96 "blt 5f\n"
97 "3:" // Main loop head
Michael Tylerbe13cea2023-01-17 11:04:14 +000098 "cmp x19, #0x3e\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000099 "ble 4f\n"
100 "uadalp v1.4s, v5.8h\n"
101 "movi v5.8h, #0x0\n"
102 "uadalp v0.4s, v4.8h\n"
103 "movi v4.8h, #0x0\n"
104 "uadalp v31.4s, v3.8h\n"
105 "movi v3.8h, #0x0\n"
106 "uadalp v30.4s, v2.8h\n"
107 "movi v2.8h, #0x0\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000108 "mov x19, #0x0\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000109 "4:" // no_accumulate_16
Michael Tylerbe13cea2023-01-17 11:04:14 +0000110 "ldr q27, [x27], #0x10\n"
111 "add x19, x19, #0x1\n"
112 "ldr q24, [x26], #0x10\n"
113 "zip1 v26.2d, v27.2d, v24.2d\n"
114 "ldr q25, [x25], #0x10\n"
Michael Tylerba209752022-12-15 12:39:29 +0000115 "subs %x[width], %x[width], #0x10\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000116 "zip2 v24.2d, v27.2d, v24.2d\n"
117 "ldr q21, [x24], #0x10\n"
118 "uadalp v5.8h, v26.16b\n"
119 "zip1 v23.2d, v25.2d, v21.2d\n"
120 "ldr q22, [x23], #0x10\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000121 "cmp %x[width], #0x10\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000122 "zip2 v21.2d, v25.2d, v21.2d\n"
123 "ldr q18, [x22], #0x10\n"
124 "uadalp v4.8h, v23.16b\n"
125 "zip1 v20.2d, v22.2d, v18.2d\n"
126 "ldr q19, [x21], #0x10\n"
127 "uadalp v5.8h, v24.16b\n"
128 "zip2 v18.2d, v22.2d, v18.2d\n"
129 "ldr q16, [x20], #0x10\n"
130 "uadalp v3.8h, v20.16b\n"
131 "zip1 v17.2d, v19.2d, v16.2d\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000132 "prfm pldl1keep, [x27, #0x70]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000133 "uadalp v4.8h, v21.16b\n"
134 "zip2 v16.2d, v19.2d, v16.2d\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000135 "prfm pldl1keep, [x26, #0x70]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000136 "uadalp v2.8h, v17.16b\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000137 "prfm pldl1keep, [x25, #0x70]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000138 "uadalp v3.8h, v18.16b\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000139 "prfm pldl1keep, [x24, #0x70]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000140 "uadalp v2.8h, v16.16b\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000141 "prfm pldl1keep, [x23, #0x70]\n"
142 "prfm pldl1keep, [x22, #0x70]\n"
143 "prfm pldl1keep, [x21, #0x70]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000144 "prfm pldl1keep, [x20, #0x70]\n"
145 "str q26, [%x[out_ptr], #0x0]\n"
146 "str q23, [%x[out_ptr], #0x10]\n"
147 "str q20, [%x[out_ptr], #0x20]\n"
148 "str q17, [%x[out_ptr], #0x30]\n"
149 "str q24, [%x[out_ptr], #0x40]\n"
150 "str q21, [%x[out_ptr], #0x50]\n"
151 "str q18, [%x[out_ptr], #0x60]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000152 "str q16, [%x[out_ptr], #0x70]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000153 "add %x[out_ptr], %x[out_ptr], #0x80\n"
154 "bge 3b\n"
155 "5:" // Main loop skip
156 "cbz %x[width], 14f\n"
157 "tbz %x[width], #3, 9f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000158 "ldr d27, [x27], #0x8\n"
159 "ldr d24, [x26], #0x8\n"
160 "ldr d25, [x25], #0x8\n"
161 "ldr d21, [x24], #0x8\n"
162 "ldr d22, [x23], #0x8\n"
163 "ldr d18, [x22], #0x8\n"
164 "ldr d19, [x21], #0x8\n"
165 "ldr d16, [x20], #0x8\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000166 "tbz %x[width], #2, 7f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000167 "ld1 { v27.s }[2], [x27], #0x4\n"
168 "ld1 { v24.s }[2], [x26], #0x4\n"
169 "ld1 { v25.s }[2], [x25], #0x4\n"
170 "ld1 { v21.s }[2], [x24], #0x4\n"
171 "ld1 { v22.s }[2], [x23], #0x4\n"
172 "ld1 { v18.s }[2], [x22], #0x4\n"
173 "ld1 { v19.s }[2], [x21], #0x4\n"
174 "ld1 { v16.s }[2], [x20], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000175 "tbz %x[width], #1, 6f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000176 "ld1 { v27.h }[6], [x27], #0x2\n"
177 "mov x19, #0x2\n"
178 "ld1 { v24.h }[6], [x26], #0x2\n"
179 "ld1 { v25.h }[6], [x25], #0x2\n"
180 "ld1 { v21.h }[6], [x24], #0x2\n"
181 "ld1 { v22.h }[6], [x23], #0x2\n"
182 "ld1 { v18.h }[6], [x22], #0x2\n"
183 "ld1 { v19.h }[6], [x21], #0x2\n"
184 "ld1 { v16.h }[6], [x20], #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000185 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000186 "ld1 { v27.b }[14], [x27]\n"
187 "ld1 { v24.b }[14], [x26]\n"
188 "ld1 { v25.b }[14], [x25]\n"
189 "ld1 { v21.b }[14], [x24]\n"
190 "ld1 { v22.b }[14], [x23]\n"
191 "ld1 { v18.b }[14], [x22]\n"
192 "ld1 { v19.b }[14], [x21]\n"
193 "ld1 { v16.b }[14], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000194 "b 13f\n"
195 "6:" // odd_loads_1_12
Michael Tylerbe13cea2023-01-17 11:04:14 +0000196 "mov x19, #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000197 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000198 "ld1 { v27.b }[12], [x27]\n"
199 "ld1 { v24.b }[12], [x26]\n"
200 "ld1 { v25.b }[12], [x25]\n"
201 "ld1 { v21.b }[12], [x24]\n"
202 "ld1 { v22.b }[12], [x23]\n"
203 "ld1 { v18.b }[12], [x22]\n"
204 "ld1 { v19.b }[12], [x21]\n"
205 "ld1 { v16.b }[12], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000206 "b 13f\n"
207 "7:" // odd_loads_2_8
208 "tbz %x[width], #1, 8f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000209 "ld1 { v27.h }[4], [x27], #0x2\n"
210 "ld1 { v24.h }[4], [x26], #0x2\n"
211 "mov x19, #0x2\n"
212 "ld1 { v25.h }[4], [x25], #0x2\n"
213 "ld1 { v21.h }[4], [x24], #0x2\n"
214 "ld1 { v22.h }[4], [x23], #0x2\n"
215 "ld1 { v18.h }[4], [x22], #0x2\n"
216 "ld1 { v19.h }[4], [x21], #0x2\n"
217 "ld1 { v16.h }[4], [x20], #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000218 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000219 "ld1 { v27.b }[10], [x27]\n"
220 "ld1 { v24.b }[10], [x26]\n"
221 "ld1 { v25.b }[10], [x25]\n"
222 "ld1 { v21.b }[10], [x24]\n"
223 "ld1 { v22.b }[10], [x23]\n"
224 "ld1 { v18.b }[10], [x22]\n"
225 "ld1 { v19.b }[10], [x21]\n"
226 "ld1 { v16.b }[10], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000227 "b 13f\n"
228 "8:" // odd_loads_1_8
Michael Tylerbe13cea2023-01-17 11:04:14 +0000229 "mov x19, #0x1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000230 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000231 "ld1 { v27.b }[8], [x27]\n"
232 "ld1 { v24.b }[8], [x26]\n"
233 "mov x19, #0x2\n"
234 "ld1 { v25.b }[8], [x25]\n"
235 "ld1 { v21.b }[8], [x24]\n"
236 "ld1 { v22.b }[8], [x23]\n"
237 "ld1 { v18.b }[8], [x22]\n"
238 "ld1 { v19.b }[8], [x21]\n"
239 "ld1 { v16.b }[8], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000240 "b 13f\n"
241 "9:" // odd_loads_4_0
242 "tbz %x[width], #2, 11f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000243 "ldr s27, [x27], #0x4\n"
244 "ldr s24, [x26], #0x4\n"
245 "ldr s25, [x25], #0x4\n"
246 "ldr s21, [x24], #0x4\n"
247 "ldr s22, [x23], #0x4\n"
248 "ldr s18, [x22], #0x4\n"
249 "ldr s19, [x21], #0x4\n"
250 "ldr s16, [x20], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000251 "tbz %x[width], #1, 10f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000252 "ld1 { v27.h }[2], [x27], #0x2\n"
253 "mov x19, #0x1\n"
254 "ld1 { v24.h }[2], [x26], #0x2\n"
255 "ld1 { v25.h }[2], [x25], #0x2\n"
256 "ld1 { v21.h }[2], [x24], #0x2\n"
257 "ld1 { v22.h }[2], [x23], #0x2\n"
258 "ld1 { v18.h }[2], [x22], #0x2\n"
259 "ld1 { v19.h }[2], [x21], #0x2\n"
260 "ld1 { v16.h }[2], [x20], #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000261 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000262 "ld1 { v27.b }[6], [x27]\n"
263 "ld1 { v24.b }[6], [x26]\n"
264 "ld1 { v25.b }[6], [x25]\n"
265 "ld1 { v21.b }[6], [x24]\n"
266 "ld1 { v22.b }[6], [x23]\n"
267 "ld1 { v18.b }[6], [x22]\n"
268 "ld1 { v19.b }[6], [x21]\n"
269 "ld1 { v16.b }[6], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000270 "b 13f\n"
271 "10:" // odd_loads_1_4
Michael Tylerbe13cea2023-01-17 11:04:14 +0000272 "mov x19, #0x1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000273 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000274 "ld1 { v27.b }[4], [x27]\n"
275 "ld1 { v24.b }[4], [x26]\n"
276 "ld1 { v25.b }[4], [x25]\n"
277 "ld1 { v21.b }[4], [x24]\n"
278 "ld1 { v22.b }[4], [x23]\n"
279 "ld1 { v18.b }[4], [x22]\n"
280 "ld1 { v19.b }[4], [x21]\n"
281 "ld1 { v16.b }[4], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000282 "b 13f\n"
283 "11:" // odd_loads_2_0
284 "tbz %x[width], #1, 12f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000285 "ldr h27, [x27], #0x2\n"
286 "ldr h24, [x26], #0x2\n"
287 "mov x19, #0x1\n"
288 "ldr h25, [x25], #0x2\n"
289 "ldr h21, [x24], #0x2\n"
290 "ldr h22, [x23], #0x2\n"
291 "ldr h18, [x22], #0x2\n"
292 "ldr h19, [x21], #0x2\n"
293 "ldr h16, [x20], #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000294 "tbz %x[width], #0, 13f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000295 "ld1 { v27.b }[2], [x27]\n"
296 "ld1 { v24.b }[2], [x26]\n"
297 "ld1 { v25.b }[2], [x25]\n"
298 "ld1 { v21.b }[2], [x24]\n"
299 "ld1 { v22.b }[2], [x23]\n"
300 "ld1 { v18.b }[2], [x22]\n"
301 "ld1 { v19.b }[2], [x21]\n"
302 "ld1 { v16.b }[2], [x20]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000303 "b 13f\n"
304 "12:" // odd_loads_1_0
Michael Tylerbe13cea2023-01-17 11:04:14 +0000305 "ldr b27, [x27, #0x0]\n"
306 "mov x19, #0x1\n"
307 "ldr b24, [x26, #0x0]\n"
308 "ldr b25, [x25, #0x0]\n"
309 "ldr b21, [x24, #0x0]\n"
310 "ldr b22, [x23, #0x0]\n"
311 "ldr b18, [x22, #0x0]\n"
312 "ldr b19, [x21, #0x0]\n"
313 "ldr b16, [x20, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000314 "13:" // Odd load end
Michael Tylerbe13cea2023-01-17 11:04:14 +0000315 "zip1 v26.2d, v27.2d, v24.2d\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000316 "str q26, [%x[out_ptr], #0x0]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000317 "zip1 v23.2d, v25.2d, v21.2d\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000318 "uadalp v5.8h, v26.16b\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000319 "zip1 v20.2d, v22.2d, v18.2d\n"
320 "str q23, [%x[out_ptr], #0x10]\n"
321 "uadalp v4.8h, v23.16b\n"
322 "zip1 v17.2d, v19.2d, v16.2d\n"
323 "str q20, [%x[out_ptr], #0x20]\n"
324 "uadalp v3.8h, v20.16b\n"
325 "str q17, [%x[out_ptr], #0x30]\n"
326 "uadalp v2.8h, v17.16b\n"
327 "subs x19, x19, #0x1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000328 "add %x[out_ptr], %x[out_ptr], #0x40\n"
329 "beq 14f\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000330 "zip2 v24.2d, v27.2d, v24.2d\n"
331 "str q24, [%x[out_ptr], #0x0]\n"
332 "zip2 v21.2d, v25.2d, v21.2d\n"
333 "uadalp v5.8h, v24.16b\n"
334 "zip2 v18.2d, v22.2d, v18.2d\n"
335 "str q21, [%x[out_ptr], #0x10]\n"
336 "uadalp v4.8h, v21.16b\n"
337 "zip2 v16.2d, v19.2d, v16.2d\n"
338 "str q18, [%x[out_ptr], #0x20]\n"
339 "uadalp v3.8h, v18.16b\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000340 "str q16, [%x[out_ptr], #0x30]\n"
341 "uadalp v2.8h, v16.16b\n"
342 "add %x[out_ptr], %x[out_ptr], #0x40\n"
343 "14:" // Odds skip
344 "uadalp v1.4s, v5.8h\n"
345 "uadalp v0.4s, v4.8h\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000346 "addp v1.4s, v1.4s, v0.4s\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000347 "uadalp v31.4s, v3.8h\n"
348 "uadalp v30.4s, v2.8h\n"
Michael Tylerba209752022-12-15 12:39:29 +0000349 "add v1.4s, v1.4s, v29.4s\n"
Michael Tylerba209752022-12-15 12:39:29 +0000350 "str q1, [%x[out_ptr], #0x0]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000351 "addp v0.4s, v31.4s, v30.4s\n"
352 "add v0.4s, v0.4s, v28.4s\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000353 "str q0, [%x[out_ptr], #0x10]\n"
354 "add %x[out_ptr], %x[out_ptr], #0x20\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000355 : [out_ptr] "+&r" (out_ptr), [width] "+&r" (width)
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000356 : [first] "r" (first), [height] "r" (height), [in] "r" (in), [row_offset] "r" (row_offset)
Michael Tylerbe13cea2023-01-17 11:04:14 +0000357 : "cc", "memory", "v0", "v1", "v2", "v3", "v4", "v5", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000358 );
359}
360
361
362#endif // __aarch64__