blob: a73792036ac7d620b526265ad091e421dcd3c754 [file] [log] [blame]
Georgios Pinitasc0b6f762020-11-02 01:37:17 +00001/*
Michael Tyler7d9a6262023-02-01 16:37:07 +00002 * Copyright (c) 2019-2021, 2023 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 Tyler7d9a6262023-02-01 16:37:07 +000013 * The above copyright notice and this permission notice shall be included in all
14 * 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 Tyler7d9a6262023-02-01 16:37:07 +000020 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000023 */
24
25#ifdef __aarch64__
26
27template<>
28void interleave_block<8, 1, VLType::None, true>(
29 int16_t * &out_ptr, const int16_t * const * in, size_t width, size_t height,
30 size_t row_offset, bool first
31)
32{
33 __asm__ __volatile__(
Michael Tyler7d9a6262023-02-01 16:37:07 +000034 "ldr x28, [%x[in], #0x0]\n"
35 "ldr x27, [%x[in], #0x8]\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +000036 "cmp %x[height], #0x8\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000037 "mov x20, #0x0\n"
38 "ldr x26, [%x[in], #0x10]\n"
39 "ldr x25, [%x[in], #0x18]\n"
40 "movi v2.8h, #0x0\n"
41 "movi v1.4s, #0x0\n"
42 "ldr x24, [%x[in], #0x20]\n"
43 "ldr x23, [%x[in], #0x28]\n"
44 "movi v0.4s, #0x0\n"
45 "add x28, x28, %x[row_offset], LSL #1\n"
46 "ldr x22, [%x[in], #0x30]\n"
47 "ldr x21, [%x[in], #0x38]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000048 "add x27, x27, %x[row_offset], LSL #1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000049 "add x26, x26, %x[row_offset], LSL #1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000050 "add x25, x25, %x[row_offset], LSL #1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000051 "add x24, x24, %x[row_offset], LSL #1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000052 "add x23, x23, %x[row_offset], LSL #1\n"
53 "add x22, x22, %x[row_offset], LSL #1\n"
54 "add x21, x21, %x[row_offset], LSL #1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000055 "beq 1f\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000056 "cmp %x[height], #0x2\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000057 "csel x27, x27, x28, GE\n"
58 "csel x26, x26, x28, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000059 "cmp %x[height], #0x4\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000060 "csel x25, x25, x28, GE\n"
61 "csel x24, x24, x28, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000062 "cmp %x[height], #0x6\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000063 "mov x21, x28\n"
64 "csel x23, x23, x28, GE\n"
65 "csel x22, x22, x28, GT\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000066 "1:" // no_pointer_adj
Michael Tyler7d9a6262023-02-01 16:37:07 +000067 "prfm pldl1keep, [x28, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000068 "prfm pldl1keep, [x27, #0x0]\n"
69 "prfm pldl1keep, [x26, #0x0]\n"
70 "prfm pldl1keep, [x25, #0x0]\n"
71 "prfm pldl1keep, [x24, #0x0]\n"
72 "prfm pldl1keep, [x23, #0x0]\n"
73 "prfm pldl1keep, [x22, #0x0]\n"
74 "prfm pldl1keep, [x21, #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000075 "prfm pldl1keep, [x28, #0x40]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000076 "prfm pldl1keep, [x27, #0x40]\n"
77 "prfm pldl1keep, [x26, #0x40]\n"
78 "prfm pldl1keep, [x25, #0x40]\n"
79 "prfm pldl1keep, [x24, #0x40]\n"
80 "prfm pldl1keep, [x23, #0x40]\n"
81 "prfm pldl1keep, [x22, #0x40]\n"
82 "prfm pldl1keep, [x21, #0x40]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000083 "cbnz %w[first], 2f\n"
84 "sub %x[out_ptr], %x[out_ptr], #0x20\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000085 "ld1 { v1.4s }, [%x[out_ptr]]\n"
86 "ldr q0, [%x[out_ptr], #0x10]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000087 "2:" // first_pass
88 "cmp %x[width], #0x8\n"
89 "blt 5f\n"
90 "3:" // Main loop head
Michael Tyler7d9a6262023-02-01 16:37:07 +000091 "cmp x20, #0xe\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000092 "ble 4f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +000093 "saddw v1.4s, v1.4s, v2.4h\n"
94 "saddw2 v0.4s, v0.4s, v2.8h\n"
95 "mov x20, #0x0\n"
96 "movi v2.8h, #0x0\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000097 "4:" // no_accumulate_16
Michael Tyler7d9a6262023-02-01 16:37:07 +000098 "ldr q31, [x28], #0x10\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +000099 "ldr q30, [x27], #0x10\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000100 "subs %x[width], %x[width], #0x8\n"
Michael Tylerbe13cea2023-01-17 11:04:14 +0000101 "cmp %x[width], #0x8\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000102 "ldr q29, [x26], #0x10\n"
103 "ldr q28, [x25], #0x10\n"
104 "add x20, x20, #0x1\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000105 "ldr q27, [x24], #0x10\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000106 "ldr q26, [x23], #0x10\n"
107 "zip1 v25.8h, v31.8h, v27.8h\n"
108 "zip1 v22.8h, v30.8h, v26.8h\n"
109 "ldr q24, [x22], #0x10\n"
110 "ldr q23, [x21], #0x10\n"
111 "zip1 v18.8h, v29.8h, v24.8h\n"
112 "zip1 v21.8h, v28.8h, v23.8h\n"
113 "zip1 v17.8h, v25.8h, v18.8h\n"
114 "zip1 v16.8h, v22.8h, v21.8h\n"
115 "prfm pldl1keep, [x28, #0x70]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000116 "prfm pldl1keep, [x27, #0x70]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000117 "zip1 v20.8h, v17.8h, v16.8h\n"
118 "add v2.8h, v2.8h, v20.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000119 "prfm pldl1keep, [x26, #0x70]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000120 "prfm pldl1keep, [x25, #0x70]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000121 "zip2 v19.8h, v17.8h, v16.8h\n"
122 "zip2 v18.8h, v25.8h, v18.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000123 "prfm pldl1keep, [x24, #0x70]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000124 "prfm pldl1keep, [x23, #0x70]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000125 "zip2 v17.8h, v22.8h, v21.8h\n"
126 "add v2.8h, v2.8h, v19.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000127 "prfm pldl1keep, [x22, #0x70]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000128 "prfm pldl1keep, [x21, #0x70]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000129 "zip1 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000130 "zip2 v22.8h, v31.8h, v27.8h\n"
131 "str q20, [%x[out_ptr], #0x0]\n"
132 "zip2 v21.8h, v29.8h, v24.8h\n"
133 "zip2 v20.8h, v30.8h, v26.8h\n"
134 "str q19, [%x[out_ptr], #0x10]\n"
135 "zip2 v19.8h, v28.8h, v23.8h\n"
136 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000137 "str q16, [%x[out_ptr], #0x20]\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000138 "zip2 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000139 "zip1 v18.8h, v22.8h, v21.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000140 "str q16, [%x[out_ptr], #0x30]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000141 "zip1 v17.8h, v20.8h, v19.8h\n"
142 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000143 "zip1 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000144 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000145 "str q16, [%x[out_ptr], #0x40]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000146 "zip2 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000147 "zip2 v18.8h, v22.8h, v21.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000148 "str q16, [%x[out_ptr], #0x50]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000149 "zip2 v17.8h, v20.8h, v19.8h\n"
150 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000151 "zip1 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000152 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000153 "str q16, [%x[out_ptr], #0x60]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000154 "zip2 v16.8h, v18.8h, v17.8h\n"
155 "str q16, [%x[out_ptr], #0x70]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000156 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000157 "add %x[out_ptr], %x[out_ptr], #0x80\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000158 "bge 3b\n"
159 "5:" // Main loop skip
160 "cbz %x[width], 10f\n"
161 "tbz %x[width], #2, 7f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000162 "ldr d31, [x28], #0x8\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000163 "ldr d30, [x27], #0x8\n"
164 "ldr d29, [x26], #0x8\n"
165 "ldr d28, [x25], #0x8\n"
166 "ldr d27, [x24], #0x8\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000167 "ldr d26, [x23], #0x8\n"
168 "ldr d24, [x22], #0x8\n"
169 "ldr d23, [x21], #0x8\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000170 "tbz %x[width], #1, 6f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000171 "ld1 { v31.s }[2], [x28], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000172 "ld1 { v30.s }[2], [x27], #0x4\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000173 "mov x20, #0x6\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000174 "ld1 { v29.s }[2], [x26], #0x4\n"
175 "ld1 { v28.s }[2], [x25], #0x4\n"
176 "ld1 { v27.s }[2], [x24], #0x4\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000177 "ld1 { v26.s }[2], [x23], #0x4\n"
178 "ld1 { v24.s }[2], [x22], #0x4\n"
179 "ld1 { v23.s }[2], [x21], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000180 "tbz %x[width], #0, 9f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000181 "ld1 { v31.h }[6], [x28]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000182 "ld1 { v30.h }[6], [x27]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000183 "mov x20, #0x7\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000184 "ld1 { v29.h }[6], [x26]\n"
185 "ld1 { v28.h }[6], [x25]\n"
186 "ld1 { v27.h }[6], [x24]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000187 "ld1 { v26.h }[6], [x23]\n"
188 "ld1 { v24.h }[6], [x22]\n"
189 "ld1 { v23.h }[6], [x21]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000190 "b 9f\n"
191 "6:" // odd_loads_1_4
Michael Tyler7d9a6262023-02-01 16:37:07 +0000192 "mov x20, #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000193 "tbz %x[width], #0, 9f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000194 "ld1 { v31.h }[4], [x28]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000195 "ld1 { v30.h }[4], [x27]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000196 "mov x20, #0x5\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000197 "ld1 { v29.h }[4], [x26]\n"
198 "ld1 { v28.h }[4], [x25]\n"
199 "ld1 { v27.h }[4], [x24]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000200 "ld1 { v26.h }[4], [x23]\n"
201 "ld1 { v24.h }[4], [x22]\n"
202 "ld1 { v23.h }[4], [x21]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000203 "b 9f\n"
204 "7:" // odd_loads_2_0
205 "tbz %x[width], #1, 8f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000206 "ldr s31, [x28], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000207 "ldr s30, [x27], #0x4\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000208 "mov x20, #0x2\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000209 "ldr s29, [x26], #0x4\n"
210 "ldr s28, [x25], #0x4\n"
211 "ldr s27, [x24], #0x4\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000212 "ldr s26, [x23], #0x4\n"
213 "ldr s24, [x22], #0x4\n"
214 "ldr s23, [x21], #0x4\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000215 "tbz %x[width], #0, 9f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000216 "ld1 { v31.h }[2], [x28]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000217 "ld1 { v30.h }[2], [x27]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000218 "mov x20, #0x3\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000219 "ld1 { v29.h }[2], [x26]\n"
220 "ld1 { v28.h }[2], [x25]\n"
221 "ld1 { v27.h }[2], [x24]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000222 "ld1 { v26.h }[2], [x23]\n"
223 "ld1 { v24.h }[2], [x22]\n"
224 "ld1 { v23.h }[2], [x21]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000225 "b 9f\n"
226 "8:" // odd_loads_1_0
Michael Tyler7d9a6262023-02-01 16:37:07 +0000227 "ldr h31, [x28, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000228 "ldr h30, [x27, #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000229 "mov x20, #0x1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000230 "ldr h29, [x26, #0x0]\n"
231 "ldr h28, [x25, #0x0]\n"
232 "ldr h27, [x24, #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000233 "ldr h26, [x23, #0x0]\n"
234 "ldr h24, [x22, #0x0]\n"
235 "ldr h23, [x21, #0x0]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000236 "9:" // Odd load end
Michael Tyler7d9a6262023-02-01 16:37:07 +0000237 "zip1 v25.8h, v31.8h, v27.8h\n"
238 "zip1 v18.8h, v29.8h, v24.8h\n"
239 "subs x20, x20, #0x1\n"
240 "zip1 v22.8h, v30.8h, v26.8h\n"
241 "zip1 v21.8h, v28.8h, v23.8h\n"
242 "zip1 v17.8h, v25.8h, v18.8h\n"
243 "zip1 v16.8h, v22.8h, v21.8h\n"
244 "zip1 v20.8h, v17.8h, v16.8h\n"
245 "str q20, [%x[out_ptr], #0x0]\n"
246 "add v2.8h, v2.8h, v20.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000247 "add %x[out_ptr], %x[out_ptr], #0x10\n"
248 "beq 10f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000249 "zip2 v19.8h, v17.8h, v16.8h\n"
250 "subs x20, x20, #0x1\n"
251 "str q19, [%x[out_ptr], #0x0]\n"
252 "add v2.8h, v2.8h, v19.8h\n"
253 "add %x[out_ptr], %x[out_ptr], #0x10\n"
254 "beq 10f\n"
255 "zip2 v18.8h, v25.8h, v18.8h\n"
256 "zip2 v17.8h, v22.8h, v21.8h\n"
257 "subs x20, x20, #0x1\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000258 "zip1 v16.8h, v18.8h, v17.8h\n"
259 "str q16, [%x[out_ptr], #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000260 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000261 "add %x[out_ptr], %x[out_ptr], #0x10\n"
262 "beq 10f\n"
263 "zip2 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000264 "subs x20, x20, #0x1\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000265 "str q16, [%x[out_ptr], #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000266 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000267 "add %x[out_ptr], %x[out_ptr], #0x10\n"
268 "beq 10f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000269 "zip2 v22.8h, v31.8h, v27.8h\n"
270 "zip2 v21.8h, v29.8h, v24.8h\n"
271 "subs x20, x20, #0x1\n"
272 "zip2 v20.8h, v30.8h, v26.8h\n"
273 "zip2 v19.8h, v28.8h, v23.8h\n"
274 "zip1 v18.8h, v22.8h, v21.8h\n"
275 "zip1 v17.8h, v20.8h, v19.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000276 "zip1 v16.8h, v18.8h, v17.8h\n"
277 "str q16, [%x[out_ptr], #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000278 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000279 "add %x[out_ptr], %x[out_ptr], #0x10\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000280 "beq 10f\n"
281 "zip2 v16.8h, v18.8h, v17.8h\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000282 "subs x20, x20, #0x1\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000283 "str q16, [%x[out_ptr], #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000284 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000285 "add %x[out_ptr], %x[out_ptr], #0x10\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000286 "beq 10f\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000287 "zip2 v18.8h, v22.8h, v21.8h\n"
288 "zip2 v17.8h, v20.8h, v19.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000289 "zip1 v16.8h, v18.8h, v17.8h\n"
290 "str q16, [%x[out_ptr], #0x0]\n"
Michael Tyler7d9a6262023-02-01 16:37:07 +0000291 "add v2.8h, v2.8h, v16.8h\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000292 "add %x[out_ptr], %x[out_ptr], #0x10\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000293 "10:" // Odds skip
Michael Tyler7d9a6262023-02-01 16:37:07 +0000294 "saddw v1.4s, v1.4s, v2.4h\n"
295 "saddw2 v0.4s, v0.4s, v2.8h\n"
296 "str q1, [%x[out_ptr], #0x0]\n"
297 "str q0, [%x[out_ptr], #0x10]\n"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000298 "add %x[out_ptr], %x[out_ptr], #0x20\n"
Georgios Pinitase28cf392021-01-31 05:18:43 +0000299 : [out_ptr] "+&r" (out_ptr), [width] "+&r" (width)
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000300 : [first] "r" (first), [height] "r" (height), [in] "r" (in), [row_offset] "r" (row_offset)
Michael Tyler7d9a6262023-02-01 16:37:07 +0000301 : "cc", "memory", "v0", "v1", "v2", "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31", "x20", "x21", "x22", "x23", "x24", "x25", "x26", "x27", "x28"
Georgios Pinitasc0b6f762020-11-02 01:37:17 +0000302 );
303}
304
305
306#endif // __aarch64__