Debian Codegraph @

third-party/simde/arm/neon/st4.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 * 2020 Sean Maher <[email protected]>
26 */
27
28 #if !defined(SIMDE_ARM_NEON_ST4_H)
29 #define SIMDE_ARM_NEON_ST4_H
30
31 #include "types.h"
32
33 HEDLEY_DIAGNOSTIC_PUSH
34 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
35 SIMDE_BEGIN_DECLS_
36
37 #if !defined(SIMDE_BUG_INTEL_857088)
38
39 SIMDE_FUNCTION_ATTRIBUTES
40 void
41 simde_vst4_f32(simde_float32_t *ptr, simde_float32x2x4_t val) {
42 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
43 vst4_f32(ptr, val);
44 #else
45 simde_float32_t buf[8];
46 simde_float32x2_private a_[4] = { simde_float32x2_to_private(val.val[0]), simde_float32x2_to_private(val.val[1]),
47 simde_float32x2_to_private(val.val[2]), simde_float32x2_to_private(val.val[3]) };
48 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
49 buf[i] = a_[i % 4].values[i / 4];
50 }
51 simde_memcpy(ptr, buf, sizeof(buf));
52 #endif
53 }
54 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
55 #undef vst4_f32
56 #define vst4_f32(a, b) simde_vst4_f32((a), (b))
57 #endif
58
59 SIMDE_FUNCTION_ATTRIBUTES
60 void
61 simde_vst4_f64(simde_float64_t *ptr, simde_float64x1x4_t val) {
62 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
63 vst4_f64(ptr, val);
64 #else
65 simde_float64_t buf[4];
66 simde_float64x1_private a_[4] = { simde_float64x1_to_private(val.val[0]), simde_float64x1_to_private(val.val[1]),
67 simde_float64x1_to_private(val.val[2]), simde_float64x1_to_private(val.val[3]) };
68 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
69 buf[i] = a_[i % 4].values[i / 4];
70 }
71 simde_memcpy(ptr, buf, sizeof(buf));
72 #endif
73 }
74 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
75 #undef vst4_f64
76 #define vst4_f64(a, b) simde_vst4_f64((a), (b))
77 #endif
78
79 SIMDE_FUNCTION_ATTRIBUTES
80 void
81 simde_vst4_s8(int8_t *ptr, simde_int8x8x4_t val) {
82 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
83 vst4_s8(ptr, val);
84 #else
85 int8_t buf[32];
86 simde_int8x8_private a_[4] = { simde_int8x8_to_private(val.val[0]), simde_int8x8_to_private(val.val[1]),
87 simde_int8x8_to_private(val.val[2]), simde_int8x8_to_private(val.val[3]) };
88 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
89 buf[i] = a_[i % 4].values[i / 4];
90 }
91 simde_memcpy(ptr, buf, sizeof(buf));
92 #endif
93 }
94 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
95 #undef vst4_s8
96 #define vst4_s8(a, b) simde_vst4_s8((a), (b))
97 #endif
98
99 SIMDE_FUNCTION_ATTRIBUTES
100 void
101 simde_vst4_s16(int16_t *ptr, simde_int16x4x4_t val) {
102 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
103 vst4_s16(ptr, val);
104 #else
105 int16_t buf[16];
106 simde_int16x4_private a_[4] = { simde_int16x4_to_private(val.val[0]), simde_int16x4_to_private(val.val[1]),
107 simde_int16x4_to_private(val.val[2]), simde_int16x4_to_private(val.val[3]) };
108 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
109 buf[i] = a_[i % 4].values[i / 4];
110 }
111 simde_memcpy(ptr, buf, sizeof(buf));
112 #endif
113 }
114 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
115 #undef vst4_s16
116 #define vst4_s16(a, b) simde_vst4_s16((a), (b))
117 #endif
118
119 SIMDE_FUNCTION_ATTRIBUTES
120 void
121 simde_vst4_s32(int32_t *ptr, simde_int32x2x4_t val) {
122 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
123 vst4_s32(ptr, val);
124 #else
125 int32_t buf[8];
126 simde_int32x2_private a_[4] = { simde_int32x2_to_private(val.val[0]), simde_int32x2_to_private(val.val[1]),
127 simde_int32x2_to_private(val.val[2]), simde_int32x2_to_private(val.val[3]) };
128 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
129 buf[i] = a_[i % 4].values[i / 4];
130 }
131 simde_memcpy(ptr, buf, sizeof(buf));
132 #endif
133 }
134 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
135 #undef vst4_s32
136 #define vst4_s32(a, b) simde_vst4_s32((a), (b))
137 #endif
138
139 SIMDE_FUNCTION_ATTRIBUTES
140 void
141 simde_vst4_s64(int64_t *ptr, simde_int64x1x4_t val) {
142 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
143 vst4_s64(ptr, val);
144 #else
145 int64_t buf[4];
146 simde_int64x1_private a_[4] = { simde_int64x1_to_private(val.val[0]), simde_int64x1_to_private(val.val[1]),
147 simde_int64x1_to_private(val.val[2]), simde_int64x1_to_private(val.val[3]) };
148 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
149 buf[i] = a_[i % 4].values[i / 4];
150 }
151 simde_memcpy(ptr, buf, sizeof(buf));
152 #endif
153 }
154 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
155 #undef vst4_s64
156 #define vst4_s64(a, b) simde_vst4_s64((a), (b))
157 #endif
158
159 SIMDE_FUNCTION_ATTRIBUTES
160 void
161 simde_vst4_u8(uint8_t *ptr, simde_uint8x8x4_t val) {
162 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
163 vst4_u8(ptr, val);
164 #else
165 uint8_t buf[32];
166 simde_uint8x8_private a_[4] = { simde_uint8x8_to_private(val.val[0]), simde_uint8x8_to_private(val.val[1]),
167 simde_uint8x8_to_private(val.val[2]), simde_uint8x8_to_private(val.val[3]) };
168 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
169 buf[i] = a_[i % 4].values[i / 4];
170 }
171 simde_memcpy(ptr, buf, sizeof(buf));
172 #endif
173 }
174 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
175 #undef vst4_u8
176 #define vst4_u8(a, b) simde_vst4_u8((a), (b))
177 #endif
178
179 SIMDE_FUNCTION_ATTRIBUTES
180 void
181 simde_vst4_u16(uint16_t *ptr, simde_uint16x4x4_t val) {
182 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
183 vst4_u16(ptr, val);
184 #else
185 uint16_t buf[16];
186 simde_uint16x4_private a_[4] = { simde_uint16x4_to_private(val.val[0]), simde_uint16x4_to_private(val.val[1]),
187 simde_uint16x4_to_private(val.val[2]), simde_uint16x4_to_private(val.val[3]) };
188 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
189 buf[i] = a_[i % 4].values[i / 4];
190 }
191 simde_memcpy(ptr, buf, sizeof(buf));
192 #endif
193 }
194 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
195 #undef vst4_u16
196 #define vst4_u16(a, b) simde_vst4_u16((a), (b))
197 #endif
198
199 SIMDE_FUNCTION_ATTRIBUTES
200 void
201 simde_vst4_u32(uint32_t *ptr, simde_uint32x2x4_t val) {
202 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
203 vst4_u32(ptr, val);
204 #else
205 uint32_t buf[8];
206 simde_uint32x2_private a_[4] = { simde_uint32x2_to_private(val.val[0]), simde_uint32x2_to_private(val.val[1]),
207 simde_uint32x2_to_private(val.val[2]), simde_uint32x2_to_private(val.val[3]) };
208 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
209 buf[i] = a_[i % 4].values[i / 4];
210 }
211 simde_memcpy(ptr, buf, sizeof(buf));
212 #endif
213 }
214 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
215 #undef vst4_u32
216 #define vst4_u32(a, b) simde_vst4_u32((a), (b))
217 #endif
218
219 SIMDE_FUNCTION_ATTRIBUTES
220 void
221 simde_vst4_u64(uint64_t *ptr, simde_uint64x1x4_t val) {
222 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
223 vst4_u64(ptr, val);
224 #else
225 uint64_t buf[4];
226 simde_uint64x1_private a_[4] = { simde_uint64x1_to_private(val.val[0]), simde_uint64x1_to_private(val.val[1]),
227 simde_uint64x1_to_private(val.val[2]), simde_uint64x1_to_private(val.val[3]) };
228 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
229 buf[i] = a_[i % 4].values[i / 4];
230 }
231 simde_memcpy(ptr, buf, sizeof(buf));
232 #endif
233 }
234 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
235 #undef vst4_u64
236 #define vst4_u64(a, b) simde_vst4_u64((a), (b))
237 #endif
238
239 SIMDE_FUNCTION_ATTRIBUTES
240 void
241 simde_vst4q_f32(simde_float32_t *ptr, simde_float32x4x4_t val) {
242 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
243 vst4q_f32(ptr, val);
244 #else
245 simde_float32_t buf[16];
246 simde_float32x4_private a_[4] = { simde_float32x4_to_private(val.val[0]), simde_float32x4_to_private(val.val[1]),
247 simde_float32x4_to_private(val.val[2]), simde_float32x4_to_private(val.val[3]) };
248 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
249 buf[i] = a_[i % 4].values[i / 4];
250 }
251 simde_memcpy(ptr, buf, sizeof(buf));
252 #endif
253 }
254 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
255 #undef vst4q_f32
256 #define vst4q_f32(a, b) simde_vst4q_f32((a), (b))
257 #endif
258
259 SIMDE_FUNCTION_ATTRIBUTES
260 void
261 simde_vst4q_f64(simde_float64_t *ptr, simde_float64x2x4_t val) {
262 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
263 vst4q_f64(ptr, val);
264 #else
265 simde_float64_t buf[8];
266 simde_float64x2_private a_[4] = { simde_float64x2_to_private(val.val[0]), simde_float64x2_to_private(val.val[1]),
267 simde_float64x2_to_private(val.val[2]), simde_float64x2_to_private(val.val[3]) };
268 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
269 buf[i] = a_[i % 4].values[i / 4];
270 }
271 simde_memcpy(ptr, buf, sizeof(buf));
272 #endif
273 }
274 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
275 #undef vst4q_f64
276 #define vst4q_f64(a, b) simde_vst4q_f64((a), (b))
277 #endif
278
279 SIMDE_FUNCTION_ATTRIBUTES
280 void
281 simde_vst4q_s8(int8_t *ptr, simde_int8x16x4_t val) {
282 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
283 vst4q_s8(ptr, val);
284 #else
285 int8_t buf[64];
286 simde_int8x16_private a_[4] = { simde_int8x16_to_private(val.val[0]), simde_int8x16_to_private(val.val[1]),
287 simde_int8x16_to_private(val.val[2]), simde_int8x16_to_private(val.val[3]) };
288 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
289 buf[i] = a_[i % 4].values[i / 4];
290 }
291 simde_memcpy(ptr, buf, sizeof(buf));
292 #endif
293 }
294 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
295 #undef vst4q_s8
296 #define vst4q_s8(a, b) simde_vst4q_s8((a), (b))
297 #endif
298
299 SIMDE_FUNCTION_ATTRIBUTES
300 void
301 simde_vst4q_s16(int16_t *ptr, simde_int16x8x4_t val) {
302 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
303 vst4q_s16(ptr, val);
304 #else
305 int16_t buf[32];
306 simde_int16x8_private a_[4] = { simde_int16x8_to_private(val.val[0]), simde_int16x8_to_private(val.val[1]),
307 simde_int16x8_to_private(val.val[2]), simde_int16x8_to_private(val.val[3]) };
308 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
309 buf[i] = a_[i % 4].values[i / 4];
310 }
311 simde_memcpy(ptr, buf, sizeof(buf));
312 #endif
313 }
314 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
315 #undef vst4q_s16
316 #define vst4q_s16(a, b) simde_vst4q_s16((a), (b))
317 #endif
318
319 SIMDE_FUNCTION_ATTRIBUTES
320 void
321 simde_vst4q_s32(int32_t *ptr, simde_int32x4x4_t val) {
322 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
323 vst4q_s32(ptr, val);
324 #else
325 int32_t buf[16];
326 simde_int32x4_private a_[4] = { simde_int32x4_to_private(val.val[0]), simde_int32x4_to_private(val.val[1]),
327 simde_int32x4_to_private(val.val[2]), simde_int32x4_to_private(val.val[3]) };
328 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
329 buf[i] = a_[i % 4].values[i / 4];
330 }
331 simde_memcpy(ptr, buf, sizeof(buf));
332 #endif
333 }
334 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
335 #undef vst4q_s32
336 #define vst4q_s32(a, b) simde_vst4q_s32((a), (b))
337 #endif
338
339 SIMDE_FUNCTION_ATTRIBUTES
340 void
341 simde_vst4q_s64(int64_t *ptr, simde_int64x2x4_t val) {
342 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
343 vst4q_s64(ptr, val);
344 #else
345 int64_t buf[8];
346 simde_int64x2_private a_[4] = { simde_int64x2_to_private(val.val[0]), simde_int64x2_to_private(val.val[1]),
347 simde_int64x2_to_private(val.val[2]), simde_int64x2_to_private(val.val[3]) };
348 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
349 buf[i] = a_[i % 4].values[i / 4];
350 }
351 simde_memcpy(ptr, buf, sizeof(buf));
352 #endif
353 }
354 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
355 #undef vst4q_s64
356 #define vst4q_s64(a, b) simde_vst4q_s64((a), (b))
357 #endif
358
359
360 SIMDE_FUNCTION_ATTRIBUTES
361 void
362 simde_vst4q_u8(uint8_t *ptr, simde_uint8x16x4_t val) {
363 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
364 vst4q_u8(ptr, val);
365 #else
366 uint8_t buf[64];
367 simde_uint8x16_private a_[4] = { simde_uint8x16_to_private(val.val[0]), simde_uint8x16_to_private(val.val[1]),
368 simde_uint8x16_to_private(val.val[2]), simde_uint8x16_to_private(val.val[3]) };
369 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
370 buf[i] = a_[i % 4].values[i / 4];
371 }
372 simde_memcpy(ptr, buf, sizeof(buf));
373 #endif
374 }
375 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
376 #undef vst4q_u8
377 #define vst4q_u8(a, b) simde_vst4q_u8((a), (b))
378 #endif
379
380 SIMDE_FUNCTION_ATTRIBUTES
381 void
382 simde_vst4q_u16(uint16_t *ptr, simde_uint16x8x4_t val) {
383 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
384 vst4q_u16(ptr, val);
385 #else
386 uint16_t buf[32];
387 simde_uint16x8_private a_[4] = { simde_uint16x8_to_private(val.val[0]), simde_uint16x8_to_private(val.val[1]),
388 simde_uint16x8_to_private(val.val[2]), simde_uint16x8_to_private(val.val[3]) };
389 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
390 buf[i] = a_[i % 4].values[i / 4];
391 }
392 simde_memcpy(ptr, buf, sizeof(buf));
393 #endif
394 }
395 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
396 #undef vst4q_u16
397 #define vst4q_u16(a, b) simde_vst4q_u16((a), (b))
398 #endif
399
400 SIMDE_FUNCTION_ATTRIBUTES
401 void
402 simde_vst4q_u32(uint32_t *ptr, simde_uint32x4x4_t val) {
403 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
404 vst4q_u32(ptr, val);
405 #else
406 uint32_t buf[16];
407 simde_uint32x4_private a_[4] = { simde_uint32x4_to_private(val.val[0]), simde_uint32x4_to_private(val.val[1]),
408 simde_uint32x4_to_private(val.val[2]), simde_uint32x4_to_private(val.val[3]) };
409 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
410 buf[i] = a_[i % 4].values[i / 4];
411 }
412 simde_memcpy(ptr, buf, sizeof(buf));
413 #endif
414 }
415 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
416 #undef vst4q_u32
417 #define vst4q_u32(a, b) simde_vst4q_u32((a), (b))
418 #endif
419
420 SIMDE_FUNCTION_ATTRIBUTES
421 void
422 simde_vst4q_u64(uint64_t *ptr, simde_uint64x2x4_t val) {
423 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
424 vst4q_u64(ptr, val);
425 #else
426 uint64_t buf[8];
427 simde_uint64x2_private a_[4] = { simde_uint64x2_to_private(val.val[0]), simde_uint64x2_to_private(val.val[1]),
428 simde_uint64x2_to_private(val.val[2]), simde_uint64x2_to_private(val.val[3]) };
429 for (size_t i = 0; i < (sizeof(val.val[0]) / sizeof(*ptr)) * 4 ; i++) {
430 buf[i] = a_[i % 4].values[i / 4];
431 }
432 simde_memcpy(ptr, buf, sizeof(buf));
433 #endif
434 }
435 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
436 #undef vst4q_u64
437 #define vst4q_u64(a, b) simde_vst4q_u64((a), (b))
438 #endif
439
440 #endif /* !defined(SIMDE_BUG_INTEL_857088) */
441
442 SIMDE_END_DECLS_
443 HEDLEY_DIAGNOSTIC_POP
444
445 #endif /* !defined(SIMDE_ARM_NEON_ST4_H) */