Debian Codegraph @

third-party/simde/arm/neon/st2.h

raw
1 /* SPDX-License-Identifier: MIT
2 *
3 * Permission is hereby granted, free of charge, to any person
4 * obtaining a copy of this software and associated documentation
5 * files (the "Software"), to deal in the Software without
6 * restriction, including without limitation the rights to use, copy,
7 * modify, merge, publish, distribute, sublicense, and/or sell copies
8 * of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be
12 * included in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 * SOFTWARE.
22 *
23 * Copyright:
24 * 2020 Evan Nemerson <[email protected]>
25 * 2021 Zhi An Ng <[email protected]> (Copyright owned by Google, LLC)
26 */
27
28 #if !defined(SIMDE_ARM_NEON_ST2_H)
29 #define SIMDE_ARM_NEON_ST2_H
30
31 #include "types.h"
32 #include "zip.h"
33
34 HEDLEY_DIAGNOSTIC_PUSH
35 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
36 SIMDE_BEGIN_DECLS_
37
38 #if !defined(SIMDE_BUG_INTEL_857088)
39
40 SIMDE_FUNCTION_ATTRIBUTES
41 void
42 simde_vst2_f32(simde_float32_t *ptr, simde_float32x2x2_t val) {
43 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
44 vst2_f32(ptr, val);
45 #else
46 simde_float32_t buf[4];
47 simde_float32x2_private a_[2] = {simde_float32x2_to_private(val.val[0]),
48 simde_float32x2_to_private(val.val[1])};
49 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
50 buf[i] = a_[i % 2].values[i / 2];
51 }
52 simde_memcpy(ptr, buf, sizeof(buf));
53 #endif
54 }
55 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
56 #undef vst2_f32
57 #define vst2_f32(a, b) simde_vst2_f32((a), (b))
58 #endif
59
60 SIMDE_FUNCTION_ATTRIBUTES
61 void
62 simde_vst2_f64(simde_float64_t *ptr, simde_float64x1x2_t val) {
63 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
64 vst2_f64(ptr, val);
65 #else
66 simde_float64_t buf[2];
67 simde_float64x1_private a_[2] = {simde_float64x1_to_private(val.val[0]),
68 simde_float64x1_to_private(val.val[1])};
69 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
70 buf[i] = a_[i % 2].values[i / 2];
71 }
72 simde_memcpy(ptr, buf, sizeof(buf));
73 #endif
74 }
75 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
76 #undef vst2_f64
77 #define vst2_f64(a, b) simde_vst2_f64((a), (b))
78 #endif
79
80 SIMDE_FUNCTION_ATTRIBUTES
81 void
82 simde_vst2_s8(int8_t *ptr, simde_int8x8x2_t val) {
83 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
84 vst2_s8(ptr, val);
85 #else
86 int8_t buf[16];
87 simde_int8x8_private a_[2] = {simde_int8x8_to_private(val.val[0]),
88 simde_int8x8_to_private(val.val[1])};
89 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
90 buf[i] = a_[i % 2].values[i / 2];
91 }
92 simde_memcpy(ptr, buf, sizeof(buf));
93 #endif
94 }
95 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
96 #undef vst2_s8
97 #define vst2_s8(a, b) simde_vst2_s8((a), (b))
98 #endif
99
100 SIMDE_FUNCTION_ATTRIBUTES
101 void
102 simde_vst2_s16(int16_t *ptr, simde_int16x4x2_t val) {
103 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
104 vst2_s16(ptr, val);
105 #else
106 int16_t buf[8];
107 simde_int16x4_private a_[2] = {simde_int16x4_to_private(val.val[0]),
108 simde_int16x4_to_private(val.val[1])};
109 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
110 buf[i] = a_[i % 2].values[i / 2];
111 }
112 simde_memcpy(ptr, buf, sizeof(buf));
113 #endif
114 }
115 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
116 #undef vst2_s16
117 #define vst2_s16(a, b) simde_vst2_s16((a), (b))
118 #endif
119
120 SIMDE_FUNCTION_ATTRIBUTES
121 void
122 simde_vst2_s32(int32_t *ptr, simde_int32x2x2_t val) {
123 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
124 vst2_s32(ptr, val);
125 #else
126 int32_t buf[4];
127 simde_int32x2_private a_[2] = {simde_int32x2_to_private(val.val[0]),
128 simde_int32x2_to_private(val.val[1])};
129 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
130 buf[i] = a_[i % 2].values[i / 2];
131 }
132 simde_memcpy(ptr, buf, sizeof(buf));
133 #endif
134 }
135 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
136 #undef vst2_s32
137 #define vst2_s32(a, b) simde_vst2_s32((a), (b))
138 #endif
139
140 SIMDE_FUNCTION_ATTRIBUTES
141 void
142 simde_vst2_s64(int64_t *ptr, simde_int64x1x2_t val) {
143 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
144 vst2_s64(ptr, val);
145 #else
146 int64_t buf[2];
147 simde_int64x1_private a_[2] = {simde_int64x1_to_private(val.val[0]),
148 simde_int64x1_to_private(val.val[1])};
149 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
150 buf[i] = a_[i % 2].values[i / 2];
151 }
152 simde_memcpy(ptr, buf, sizeof(buf));
153 #endif
154 }
155 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
156 #undef vst2_s64
157 #define vst2_s64(a, b) simde_vst2_s64((a), (b))
158 #endif
159
160 SIMDE_FUNCTION_ATTRIBUTES
161 void
162 simde_vst2_u8(uint8_t *ptr, simde_uint8x8x2_t val) {
163 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
164 vst2_u8(ptr, val);
165 #else
166 uint8_t buf[16];
167 simde_uint8x8_private a_[2] = {simde_uint8x8_to_private(val.val[0]),
168 simde_uint8x8_to_private(val.val[1])};
169 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
170 buf[i] = a_[i % 2].values[i / 2];
171 }
172 simde_memcpy(ptr, buf, sizeof(buf));
173 #endif
174 }
175 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
176 #undef vst2_u8
177 #define vst2_u8(a, b) simde_vst2_u8((a), (b))
178 #endif
179
180 SIMDE_FUNCTION_ATTRIBUTES
181 void
182 simde_vst2_u16(uint16_t *ptr, simde_uint16x4x2_t val) {
183 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
184 vst2_u16(ptr, val);
185 #else
186 uint16_t buf[8];
187 simde_uint16x4_private a_[2] = {simde_uint16x4_to_private(val.val[0]),
188 simde_uint16x4_to_private(val.val[1])};
189 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
190 buf[i] = a_[i % 2].values[i / 2];
191 }
192 simde_memcpy(ptr, buf, sizeof(buf));
193 #endif
194 }
195 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
196 #undef vst2_u16
197 #define vst2_u16(a, b) simde_vst2_u16((a), (b))
198 #endif
199
200 SIMDE_FUNCTION_ATTRIBUTES
201 void
202 simde_vst2_u32(uint32_t *ptr, simde_uint32x2x2_t val) {
203 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
204 vst2_u32(ptr, val);
205 #else
206 uint32_t buf[4];
207 simde_uint32x2_private a_[2] = {simde_uint32x2_to_private(val.val[0]),
208 simde_uint32x2_to_private(val.val[1])};
209 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
210 buf[i] = a_[i % 2].values[i / 2];
211 }
212 simde_memcpy(ptr, buf, sizeof(buf));
213 #endif
214 }
215 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
216 #undef vst2_u32
217 #define vst2_u32(a, b) simde_vst2_u32((a), (b))
218 #endif
219
220 SIMDE_FUNCTION_ATTRIBUTES
221 void
222 simde_vst2_u64(uint64_t *ptr, simde_uint64x1x2_t val) {
223 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
224 vst2_u64(ptr, val);
225 #else
226 uint64_t buf[2];
227 simde_uint64x1_private a_[2] = {simde_uint64x1_to_private(val.val[0]),
228 simde_uint64x1_to_private(val.val[1])};
229 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
230 buf[i] = a_[i % 2].values[i / 2];
231 }
232 simde_memcpy(ptr, buf, sizeof(buf));
233 #endif
234 }
235 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
236 #undef vst2_u64
237 #define vst2_u64(a, b) simde_vst2_u64((a), (b))
238 #endif
239
240 SIMDE_FUNCTION_ATTRIBUTES
241 void
242 simde_vst2q_f32(simde_float32_t *ptr, simde_float32x4x2_t val) {
243 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
244 vst2q_f32(ptr, val);
245 #else
246 simde_float32x4x2_t r = simde_vzipq_f32(val.val[0], val.val[1]);
247 simde_vst1q_f32(ptr, r.val[0]);
248 simde_vst1q_f32(ptr+4, r.val[1]);
249 #endif
250 }
251 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
252 #undef vst2q_f32
253 #define vst2q_f32(a, b) simde_vst2q_f32((a), (b))
254 #endif
255
256 SIMDE_FUNCTION_ATTRIBUTES
257 void
258 simde_vst2q_f64(simde_float64_t *ptr, simde_float64x2x2_t val) {
259 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
260 vst2q_f64(ptr, val);
261 #else
262 simde_float64_t buf[4];
263 simde_float64x2_private a_[2] = {simde_float64x2_to_private(val.val[0]),
264 simde_float64x2_to_private(val.val[1])};
265 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
266 buf[i] = a_[i % 2].values[i / 2];
267 }
268 simde_memcpy(ptr, buf, sizeof(buf));
269 #endif
270 }
271 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
272 #undef vst2q_f64
273 #define vst2q_f64(a, b) simde_vst2q_f64((a), (b))
274 #endif
275
276 SIMDE_FUNCTION_ATTRIBUTES
277 void
278 simde_vst2q_s8(int8_t *ptr, simde_int8x16x2_t val) {
279 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
280 vst2q_s8(ptr, val);
281 #else
282 simde_int8x16x2_t r = simde_vzipq_s8(val.val[0], val.val[1]);
283 simde_vst1q_s8(ptr, r.val[0]);
284 simde_vst1q_s8(ptr+16, r.val[1]);
285 #endif
286 }
287 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
288 #undef vst2q_s8
289 #define vst2q_s8(a, b) simde_vst2q_s8((a), (b))
290 #endif
291
292 SIMDE_FUNCTION_ATTRIBUTES
293 void
294 simde_vst2q_s16(int16_t *ptr, simde_int16x8x2_t val) {
295 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
296 vst2q_s16(ptr, val);
297 #else
298 simde_int16x8x2_t r = simde_vzipq_s16(val.val[0], val.val[1]);
299 simde_vst1q_s16(ptr, r.val[0]);
300 simde_vst1q_s16(ptr+8, r.val[1]);
301 #endif
302 }
303 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
304 #undef vst2q_s16
305 #define vst2q_s16(a, b) simde_vst2q_s16((a), (b))
306 #endif
307
308 SIMDE_FUNCTION_ATTRIBUTES
309 void
310 simde_vst2q_s32(int32_t *ptr, simde_int32x4x2_t val) {
311 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
312 vst2q_s32(ptr, val);
313 #else
314 simde_int32x4x2_t r = simde_vzipq_s32(val.val[0], val.val[1]);
315 simde_vst1q_s32(ptr, r.val[0]);
316 simde_vst1q_s32(ptr+4, r.val[1]);
317 #endif
318 }
319 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
320 #undef vst2q_s32
321 #define vst2q_s32(a, b) simde_vst2q_s32((a), (b))
322 #endif
323
324 SIMDE_FUNCTION_ATTRIBUTES
325 void
326 simde_vst2q_s64(int64_t *ptr, simde_int64x2x2_t val) {
327 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
328 vst2q_s64(ptr, val);
329 #else
330 int64_t buf[4];
331 simde_int64x2_private a_[2] = {simde_int64x2_to_private(val.val[0]),
332 simde_int64x2_to_private(val.val[1])};
333 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
334 buf[i] = a_[i % 2].values[i / 2];
335 }
336 simde_memcpy(ptr, buf, sizeof(buf));
337 #endif
338 }
339 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
340 #undef vst2q_s64
341 #define vst2q_s64(a, b) simde_vst2q_s64((a), (b))
342 #endif
343
344 SIMDE_FUNCTION_ATTRIBUTES
345 void
346 simde_vst2q_u8(uint8_t *ptr, simde_uint8x16x2_t val) {
347 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
348 vst2q_u8(ptr, val);
349 #else
350 simde_uint8x16x2_t r = simde_vzipq_u8(val.val[0], val.val[1]);
351 simde_vst1q_u8(ptr, r.val[0]);
352 simde_vst1q_u8(ptr+16, r.val[1]);
353 #endif
354 }
355 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
356 #undef vst2q_u8
357 #define vst2q_u8(a, b) simde_vst2q_u8((a), (b))
358 #endif
359
360 SIMDE_FUNCTION_ATTRIBUTES
361 void
362 simde_vst2q_u16(uint16_t *ptr, simde_uint16x8x2_t val) {
363 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
364 vst2q_u16(ptr, val);
365 #else
366 simde_uint16x8x2_t r = simde_vzipq_u16(val.val[0], val.val[1]);
367 simde_vst1q_u16(ptr, r.val[0]);
368 simde_vst1q_u16(ptr+8, r.val[1]);
369 #endif
370 }
371 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
372 #undef vst2q_u16
373 #define vst2q_u16(a, b) simde_vst2q_u16((a), (b))
374 #endif
375
376 SIMDE_FUNCTION_ATTRIBUTES
377 void
378 simde_vst2q_u32(uint32_t *ptr, simde_uint32x4x2_t val) {
379 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
380 vst2q_u32(ptr, val);
381 #else
382 simde_uint32x4x2_t r = simde_vzipq_u32(val.val[0], val.val[1]);
383 simde_vst1q_u32(ptr, r.val[0]);
384 simde_vst1q_u32(ptr+4, r.val[1]);
385 #endif
386 }
387 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
388 #undef vst2q_u32
389 #define vst2q_u32(a, b) simde_vst2q_u32((a), (b))
390 #endif
391
392 SIMDE_FUNCTION_ATTRIBUTES
393 void
394 simde_vst2q_u64(uint64_t *ptr, simde_uint64x2x2_t val) {
395 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
396 vst2q_u64(ptr, val);
397 #else
398 uint64_t buf[4];
399 simde_uint64x2_private a_[2] = {simde_uint64x2_to_private(val.val[0]),
400 simde_uint64x2_to_private(val.val[1])};
401 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 2 ; i++) {
402 buf[i] = a_[i % 2].values[i / 2];
403 }
404 simde_memcpy(ptr, buf, sizeof(buf));
405 #endif
406 }
407 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
408 #undef vst2q_u64
409 #define vst2q_u64(a, b) simde_vst2q_u64((a), (b))
410 #endif
411
412 #endif /* !defined(SIMDE_BUG_INTEL_857088) */
413
414 SIMDE_END_DECLS_
415 HEDLEY_DIAGNOSTIC_POP
416
417 #endif /* !defined(SIMDE_ARM_NEON_ST2_H) */