Debian Codegraph @

third-party/simde/arm/neon/st1.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 */
26
27 #if !defined(SIMDE_ARM_NEON_ST1_H)
28 #define SIMDE_ARM_NEON_ST1_H
29
30 #include "types.h"
31
32 HEDLEY_DIAGNOSTIC_PUSH
33 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
34 SIMDE_BEGIN_DECLS_
35
36 SIMDE_FUNCTION_ATTRIBUTES
37 void
38 simde_vst1_f16(simde_float16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float16x4_t val) {
39 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
40 vst1_f16(ptr, val);
41 #else
42 simde_float16x4_private val_ = simde_float16x4_to_private(val);
43 simde_memcpy(ptr, &val_, sizeof(val_));
44 #endif
45 }
46 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
47 #undef vst1_f16
48 #define vst1_f16(a, b) simde_vst1_f16((a), (b))
49 #endif
50
51 SIMDE_FUNCTION_ATTRIBUTES
52 void
53 simde_vst1_f32(simde_float32_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_float32x2_t val) {
54 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
55 vst1_f32(ptr, val);
56 #else
57 simde_float32x2_private val_ = simde_float32x2_to_private(val);
58 simde_memcpy(ptr, &val_, sizeof(val_));
59 #endif
60 }
61 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
62 #undef vst1_f32
63 #define vst1_f32(a, b) simde_vst1_f32((a), (b))
64 #endif
65
66 SIMDE_FUNCTION_ATTRIBUTES
67 void
68 simde_vst1_f64(simde_float64_t ptr[HEDLEY_ARRAY_PARAM(1)], simde_float64x1_t val) {
69 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
70 vst1_f64(ptr, val);
71 #else
72 simde_float64x1_private val_ = simde_float64x1_to_private(val);
73 simde_memcpy(ptr, &val_, sizeof(val_));
74 #endif
75 }
76 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
77 #undef vst1_f64
78 #define vst1_f64(a, b) simde_vst1_f64((a), (b))
79 #endif
80
81 SIMDE_FUNCTION_ATTRIBUTES
82 void
83 simde_vst1_s8(int8_t ptr[HEDLEY_ARRAY_PARAM(8)], simde_int8x8_t val) {
84 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
85 vst1_s8(ptr, val);
86 #else
87 simde_int8x8_private val_ = simde_int8x8_to_private(val);
88 simde_memcpy(ptr, &val_, sizeof(val_));
89 #endif
90 }
91 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
92 #undef vst1_s8
93 #define vst1_s8(a, b) simde_vst1_s8((a), (b))
94 #endif
95
96 SIMDE_FUNCTION_ATTRIBUTES
97 void
98 simde_vst1_s16(int16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int16x4_t val) {
99 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
100 vst1_s16(ptr, val);
101 #else
102 simde_int16x4_private val_ = simde_int16x4_to_private(val);
103 simde_memcpy(ptr, &val_, sizeof(val_));
104 #endif
105 }
106 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
107 #undef vst1_s16
108 #define vst1_s16(a, b) simde_vst1_s16((a), (b))
109 #endif
110
111 SIMDE_FUNCTION_ATTRIBUTES
112 void
113 simde_vst1_s32(int32_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_int32x2_t val) {
114 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
115 vst1_s32(ptr, val);
116 #else
117 simde_int32x2_private val_ = simde_int32x2_to_private(val);
118 simde_memcpy(ptr, &val_, sizeof(val_));
119 #endif
120 }
121 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
122 #undef vst1_s32
123 #define vst1_s32(a, b) simde_vst1_s32((a), (b))
124 #endif
125
126 SIMDE_FUNCTION_ATTRIBUTES
127 void
128 simde_vst1_s64(int64_t ptr[HEDLEY_ARRAY_PARAM(1)], simde_int64x1_t val) {
129 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
130 vst1_s64(ptr, val);
131 #else
132 simde_int64x1_private val_ = simde_int64x1_to_private(val);
133 simde_memcpy(ptr, &val_, sizeof(val_));
134 #endif
135 }
136 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
137 #undef vst1_s64
138 #define vst1_s64(a, b) simde_vst1_s64((a), (b))
139 #endif
140
141 SIMDE_FUNCTION_ATTRIBUTES
142 void
143 simde_vst1_u8(uint8_t ptr[HEDLEY_ARRAY_PARAM(8)], simde_uint8x8_t val) {
144 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
145 vst1_u8(ptr, val);
146 #else
147 simde_uint8x8_private val_ = simde_uint8x8_to_private(val);
148 simde_memcpy(ptr, &val_, sizeof(val_));
149 #endif
150 }
151 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
152 #undef vst1_u8
153 #define vst1_u8(a, b) simde_vst1_u8((a), (b))
154 #endif
155
156 SIMDE_FUNCTION_ATTRIBUTES
157 void
158 simde_vst1_u16(uint16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint16x4_t val) {
159 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
160 vst1_u16(ptr, val);
161 #else
162 simde_uint16x4_private val_ = simde_uint16x4_to_private(val);
163 simde_memcpy(ptr, &val_, sizeof(val_));
164 #endif
165 }
166 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
167 #undef vst1_u16
168 #define vst1_u16(a, b) simde_vst1_u16((a), (b))
169 #endif
170
171 SIMDE_FUNCTION_ATTRIBUTES
172 void
173 simde_vst1_u32(uint32_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_uint32x2_t val) {
174 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
175 vst1_u32(ptr, val);
176 #else
177 simde_uint32x2_private val_ = simde_uint32x2_to_private(val);
178 simde_memcpy(ptr, &val_, sizeof(val_));
179 #endif
180 }
181 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
182 #undef vst1_u32
183 #define vst1_u32(a, b) simde_vst1_u32((a), (b))
184 #endif
185
186 SIMDE_FUNCTION_ATTRIBUTES
187 void
188 simde_vst1_u64(uint64_t ptr[HEDLEY_ARRAY_PARAM(1)], simde_uint64x1_t val) {
189 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
190 vst1_u64(ptr, val);
191 #else
192 simde_uint64x1_private val_ = simde_uint64x1_to_private(val);
193 simde_memcpy(ptr, &val_, sizeof(val_));
194 #endif
195 }
196 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
197 #undef vst1_u64
198 #define vst1_u64(a, b) simde_vst1_u64((a), (b))
199 #endif
200
201 SIMDE_FUNCTION_ATTRIBUTES
202 void
203 simde_vst1q_f16(simde_float16_t ptr[HEDLEY_ARRAY_PARAM(8)], simde_float16x8_t val) {
204 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && defined(SIMDE_ARM_NEON_FP16)
205 vst1q_f16(ptr, val);
206 #else
207 simde_float16x8_private val_ = simde_float16x8_to_private(val);
208
209 #if defined(SIMDE_WASM_SIMD128_NATIVE)
210 wasm_v128_store(ptr, val_.v128);
211 #else
212 simde_memcpy(ptr, &val_, sizeof(val_));
213 #endif
214 #endif
215 }
216 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
217 #undef vst1q_f16
218 #define vst1q_f16(a, b) simde_vst1q_f16((a), (b))
219 #endif
220
221 SIMDE_FUNCTION_ATTRIBUTES
222 void
223 simde_vst1q_f32(simde_float32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float32x4_t val) {
224 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
225 vst1q_f32(ptr, val);
226 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
227 vec_st(val, 0, ptr);
228 #else
229 simde_float32x4_private val_ = simde_float32x4_to_private(val);
230
231 #if defined(SIMDE_WASM_SIMD128_NATIVE)
232 wasm_v128_store(ptr, val_.v128);
233 #else
234 simde_memcpy(ptr, &val_, sizeof(val_));
235 #endif
236 #endif
237 }
238 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
239 #undef vst1q_f32
240 #define vst1q_f32(a, b) simde_vst1q_f32((a), (b))
241 #endif
242
243 SIMDE_FUNCTION_ATTRIBUTES
244 void
245 simde_vst1q_f64(simde_float64_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_float64x2_t val) {
246 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
247 vst1q_f64(ptr, val);
248 #else
249 simde_float64x2_private val_ = simde_float64x2_to_private(val);
250
251 #if defined(SIMDE_WASM_SIMD128_NATIVE)
252 wasm_v128_store(ptr, val_.v128);
253 #else
254 simde_memcpy(ptr, &val_, sizeof(val_));
255 #endif
256 #endif
257 }
258 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
259 #undef vst1q_f64
260 #define vst1q_f64(a, b) simde_vst1q_f64((a), (b))
261 #endif
262
263 SIMDE_FUNCTION_ATTRIBUTES
264 void
265 simde_vst1q_s8(int8_t ptr[HEDLEY_ARRAY_PARAM(16)], simde_int8x16_t val) {
266 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
267 vst1q_s8(ptr, val);
268 #else
269 simde_int8x16_private val_ = simde_int8x16_to_private(val);
270
271 #if defined(SIMDE_WASM_SIMD128_NATIVE)
272 wasm_v128_store(ptr, val_.v128);
273 #else
274 simde_memcpy(ptr, &val_, sizeof(val_));
275 #endif
276 #endif
277 }
278 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
279 #undef vst1q_s8
280 #define vst1q_s8(a, b) simde_vst1q_s8((a), (b))
281 #endif
282
283 SIMDE_FUNCTION_ATTRIBUTES
284 void
285 simde_vst1q_s16(int16_t ptr[HEDLEY_ARRAY_PARAM(8)], simde_int16x8_t val) {
286 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
287 vst1q_s16(ptr, val);
288 #else
289 simde_int16x8_private val_ = simde_int16x8_to_private(val);
290
291 #if defined(SIMDE_WASM_SIMD128_NATIVE)
292 wasm_v128_store(ptr, val_.v128);
293 #else
294 simde_memcpy(ptr, &val_, sizeof(val_));
295 #endif
296 #endif
297 }
298 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
299 #undef vst1q_s16
300 #define vst1q_s16(a, b) simde_vst1q_s16((a), (b))
301 #endif
302
303 SIMDE_FUNCTION_ATTRIBUTES
304 void
305 simde_vst1q_s32(int32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int32x4_t val) {
306 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
307 vst1q_s32(ptr, val);
308 #else
309 simde_int32x4_private val_ = simde_int32x4_to_private(val);
310
311 #if defined(SIMDE_WASM_SIMD128_NATIVE)
312 wasm_v128_store(ptr, val_.v128);
313 #else
314 simde_memcpy(ptr, &val_, sizeof(val_));
315 #endif
316 #endif
317 }
318 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
319 #undef vst1q_s32
320 #define vst1q_s32(a, b) simde_vst1q_s32((a), (b))
321 #endif
322
323 SIMDE_FUNCTION_ATTRIBUTES
324 void
325 simde_vst1q_s64(int64_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_int64x2_t val) {
326 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
327 vst1q_s64(ptr, val);
328 #else
329 simde_int64x2_private val_ = simde_int64x2_to_private(val);
330
331 #if defined(SIMDE_WASM_SIMD128_NATIVE)
332 wasm_v128_store(ptr, val_.v128);
333 #else
334 simde_memcpy(ptr, &val_, sizeof(val_));
335 #endif
336 #endif
337 }
338 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
339 #undef vst1q_s64
340 #define vst1q_s64(a, b) simde_vst1q_s64((a), (b))
341 #endif
342
343 SIMDE_FUNCTION_ATTRIBUTES
344 void
345 simde_vst1q_u8(uint8_t ptr[HEDLEY_ARRAY_PARAM(16)], simde_uint8x16_t val) {
346 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
347 vst1q_u8(ptr, val);
348 #else
349 simde_uint8x16_private val_ = simde_uint8x16_to_private(val);
350
351 #if defined(SIMDE_WASM_SIMD128_NATIVE)
352 wasm_v128_store(ptr, val_.v128);
353 #else
354 simde_memcpy(ptr, &val_, sizeof(val_));
355 #endif
356 #endif
357 }
358 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
359 #undef vst1q_u8
360 #define vst1q_u8(a, b) simde_vst1q_u8((a), (b))
361 #endif
362
363 SIMDE_FUNCTION_ATTRIBUTES
364 void
365 simde_vst1q_u16(uint16_t ptr[HEDLEY_ARRAY_PARAM(8)], simde_uint16x8_t val) {
366 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
367 vst1q_u16(ptr, val);
368 #else
369 simde_uint16x8_private val_ = simde_uint16x8_to_private(val);
370
371 #if defined(SIMDE_WASM_SIMD128_NATIVE)
372 wasm_v128_store(ptr, val_.v128);
373 #else
374 simde_memcpy(ptr, &val_, sizeof(val_));
375 #endif
376 #endif
377 }
378 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
379 #undef vst1q_u16
380 #define vst1q_u16(a, b) simde_vst1q_u16((a), (b))
381 #endif
382
383 SIMDE_FUNCTION_ATTRIBUTES
384 void
385 simde_vst1q_u32(uint32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint32x4_t val) {
386 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
387 vst1q_u32(ptr, val);
388 #else
389 simde_uint32x4_private val_ = simde_uint32x4_to_private(val);
390
391 #if defined(SIMDE_WASM_SIMD128_NATIVE)
392 wasm_v128_store(ptr, val_.v128);
393 #else
394 simde_memcpy(ptr, &val_, sizeof(val_));
395 #endif
396 #endif
397 }
398 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
399 #undef vst1q_u32
400 #define vst1q_u32(a, b) simde_vst1q_u32((a), (b))
401 #endif
402
403 SIMDE_FUNCTION_ATTRIBUTES
404 void
405 simde_vst1q_u64(uint64_t ptr[HEDLEY_ARRAY_PARAM(2)], simde_uint64x2_t val) {
406 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
407 vst1q_u64(ptr, val);
408 #else
409 simde_uint64x2_private val_ = simde_uint64x2_to_private(val);
410
411 #if defined(SIMDE_WASM_SIMD128_NATIVE)
412 wasm_v128_store(ptr, val_.v128);
413 #else
414 simde_memcpy(ptr, &val_, sizeof(val_));
415 #endif
416 #endif
417 }
418 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
419 #undef vst1q_u64
420 #define vst1q_u64(a, b) simde_vst1q_u64((a), (b))
421 #endif
422
423 SIMDE_END_DECLS_
424 HEDLEY_DIAGNOSTIC_POP
425
426 #endif /* !defined(SIMDE_ARM_NEON_ST1_H) */