Debian Codegraph @

third-party/simde/arm/neon/st4_lane.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 * 2021 Evan Nemerson <[email protected]>
25 * 2021 Zhi An Ng <[email protected]> (Copyright owned by Google, LLC)
26 */
27
28 #if !defined(SIMDE_ARM_NEON_ST4_LANE_H)
29 #define SIMDE_ARM_NEON_ST4_LANE_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_lane_s8(int8_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int8x8x4_t val, const int lane)
42 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 7) {
43 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
44 SIMDE_CONSTIFY_8_NO_RESULT_(vst4_lane_s8, HEDLEY_UNREACHABLE(), lane, ptr, val);
45 #else
46 simde_int8x8_private r;
47 for (size_t i = 0 ; i < 4 ; i++) {
48 r = simde_int8x8_to_private(val.val[i]);
49 ptr[i] = r.values[lane];
50 }
51 #endif
52 }
53 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
54 #undef vst4_lane_s8
55 #define vst4_lane_s8(a, b, c) simde_vst4_lane_s8((a), (b), (c))
56 #endif
57
58 SIMDE_FUNCTION_ATTRIBUTES
59 void
60 simde_vst4_lane_s16(int16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int16x4x4_t val, const int lane)
61 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
62 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
63 SIMDE_CONSTIFY_4_NO_RESULT_(vst4_lane_s16, HEDLEY_UNREACHABLE(), lane, ptr, val);
64 #else
65 simde_int16x4_private r;
66 for (size_t i = 0 ; i < 4 ; i++) {
67 r = simde_int16x4_to_private(val.val[i]);
68 ptr[i] = r.values[lane];
69 }
70 #endif
71 }
72 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
73 #undef vst4_lane_s16
74 #define vst4_lane_s16(a, b, c) simde_vst4_lane_s16((a), (b), (c))
75 #endif
76
77 SIMDE_FUNCTION_ATTRIBUTES
78 void
79 simde_vst4_lane_s32(int32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int32x2x4_t val, const int lane)
80 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
81 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
82 SIMDE_CONSTIFY_2_NO_RESULT_(vst4_lane_s32, HEDLEY_UNREACHABLE(), lane, ptr, val);
83 #else
84 simde_int32x2_private r;
85 for (size_t i = 0 ; i < 4 ; i++) {
86 r = simde_int32x2_to_private(val.val[i]);
87 ptr[i] = r.values[lane];
88 }
89 #endif
90 }
91 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
92 #undef vst4_lane_s32
93 #define vst4_lane_s32(a, b, c) simde_vst4_lane_s32((a), (b), (c))
94 #endif
95
96 SIMDE_FUNCTION_ATTRIBUTES
97 void
98 simde_vst4_lane_s64(int64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int64x1x4_t val, const int lane)
99 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 0) {
100 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
101 (void) lane;
102 vst4_lane_s64(ptr, val, 0);
103 #else
104 simde_int64x1_private r;
105 for (size_t i = 0 ; i < 4 ; i++) {
106 r = simde_int64x1_to_private(val.val[i]);
107 ptr[i] = r.values[lane];
108 }
109 #endif
110 }
111 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
112 #undef vst4_lane_s64
113 #define vst4_lane_s64(a, b, c) simde_vst4_lane_s64((a), (b), (c))
114 #endif
115
116 SIMDE_FUNCTION_ATTRIBUTES
117 void
118 simde_vst4_lane_u8(uint8_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint8x8x4_t val, const int lane)
119 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 7) {
120 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
121 SIMDE_CONSTIFY_8_NO_RESULT_(vst4_lane_u8, HEDLEY_UNREACHABLE(), lane, ptr, val);
122 #else
123 simde_uint8x8_private r;
124 for (size_t i = 0 ; i < 4 ; i++) {
125 r = simde_uint8x8_to_private(val.val[i]);
126 ptr[i] = r.values[lane];
127 }
128 #endif
129 }
130 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
131 #undef vst4_lane_u8
132 #define vst4_lane_u8(a, b, c) simde_vst4_lane_u8((a), (b), (c))
133 #endif
134
135 SIMDE_FUNCTION_ATTRIBUTES
136 void
137 simde_vst4_lane_u16(uint16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint16x4x4_t val, const int lane)
138 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
139 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
140 SIMDE_CONSTIFY_4_NO_RESULT_(vst4_lane_u16, HEDLEY_UNREACHABLE(), lane, ptr, val);
141 #else
142 simde_uint16x4_private r;
143 for (size_t i = 0 ; i < 4 ; i++) {
144 r = simde_uint16x4_to_private(val.val[i]);
145 ptr[i] = r.values[lane];
146 }
147 #endif
148 }
149 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
150 #undef vst4_lane_u16
151 #define vst4_lane_u16(a, b, c) simde_vst4_lane_u16((a), (b), (c))
152 #endif
153
154 SIMDE_FUNCTION_ATTRIBUTES
155 void
156 simde_vst4_lane_u32(uint32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint32x2x4_t val, const int lane)
157 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
158 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
159 SIMDE_CONSTIFY_2_NO_RESULT_(vst4_lane_u32, HEDLEY_UNREACHABLE(), lane, ptr, val);
160 #else
161 simde_uint32x2_private r;
162 for (size_t i = 0 ; i < 4 ; i++) {
163 r = simde_uint32x2_to_private(val.val[i]);
164 ptr[i] = r.values[lane];
165 }
166 #endif
167 }
168 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
169 #undef vst4_lane_u32
170 #define vst4_lane_u32(a, b, c) simde_vst4_lane_u32((a), (b), (c))
171 #endif
172
173 SIMDE_FUNCTION_ATTRIBUTES
174 void
175 simde_vst4_lane_u64(uint64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint64x1x4_t val, const int lane)
176 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 0) {
177 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
178 (void) lane;
179 vst4_lane_u64(ptr, val, 0);
180 #else
181 simde_uint64x1_private r;
182 for (size_t i = 0 ; i < 4 ; i++) {
183 r = simde_uint64x1_to_private(val.val[i]);
184 ptr[i] = r.values[lane];
185 }
186 #endif
187 }
188 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
189 #undef vst4_lane_u64
190 #define vst4_lane_u64(a, b, c) simde_vst4_lane_u64((a), (b), (c))
191 #endif
192
193 SIMDE_FUNCTION_ATTRIBUTES
194 void
195 simde_vst4_lane_f32(simde_float32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float32x2x4_t val, const int lane)
196 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
197 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
198 SIMDE_CONSTIFY_2_NO_RESULT_(vst4_lane_f32, HEDLEY_UNREACHABLE(), lane, ptr, val);
199 #else
200 simde_float32x2_private r;
201 for (size_t i = 0 ; i < 4 ; i++) {
202 r = simde_float32x2_to_private(val.val[i]);
203 ptr[i] = r.values[lane];
204 }
205 #endif
206 }
207 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
208 #undef vst4_lane_f32
209 #define vst4_lane_f32(a, b, c) simde_vst4_lane_f32((a), (b), (c))
210 #endif
211
212 SIMDE_FUNCTION_ATTRIBUTES
213 void
214 simde_vst4_lane_f64(simde_float64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float64x1x4_t val, const int lane)
215 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 0) {
216 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
217 (void) lane;
218 vst4_lane_f64(ptr, val, 0);
219 #else
220 simde_float64x1_private r;
221 for (size_t i = 0 ; i < 4 ; i++) {
222 r = simde_float64x1_to_private(val.val[i]);
223 ptr[i] = r.values[lane];
224 }
225 #endif
226 }
227 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
228 #undef vst4_lane_f64
229 #define vst4_lane_f64(a, b, c) simde_vst4_lane_f64((a), (b), (c))
230 #endif
231
232 SIMDE_FUNCTION_ATTRIBUTES
233 void
234 simde_vst4q_lane_s8(int8_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int8x16x4_t val, const int lane)
235 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 15) {
236 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
237 SIMDE_CONSTIFY_16_NO_RESULT_(vst4q_lane_s8, HEDLEY_UNREACHABLE(), lane, ptr, val);
238 #else
239 simde_int8x16_private r;
240 for (size_t i = 0 ; i < 4 ; i++) {
241 r = simde_int8x16_to_private(val.val[i]);
242 ptr[i] = r.values[lane];
243 }
244 #endif
245 }
246 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
247 #undef vst4q_lane_s8
248 #define vst4q_lane_s8(a, b, c) simde_vst4q_lane_s8((a), (b), (c))
249 #endif
250
251 SIMDE_FUNCTION_ATTRIBUTES
252 void
253 simde_vst4q_lane_s16(int16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int16x8x4_t val, const int lane)
254 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 7) {
255 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
256 SIMDE_CONSTIFY_8_NO_RESULT_(vst4q_lane_s16, HEDLEY_UNREACHABLE(), lane, ptr, val);
257 #else
258 simde_int16x8_private r;
259 for (size_t i = 0 ; i < 4 ; i++) {
260 r = simde_int16x8_to_private(val.val[i]);
261 ptr[i] = r.values[lane];
262 }
263 #endif
264 }
265 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
266 #undef vst4q_lane_s16
267 #define vst4q_lane_s16(a, b, c) simde_vst4q_lane_s16((a), (b), (c))
268 #endif
269
270 SIMDE_FUNCTION_ATTRIBUTES
271 void
272 simde_vst4q_lane_s32(int32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int32x4x4_t val, const int lane)
273 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
274 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
275 SIMDE_CONSTIFY_4_NO_RESULT_(vst4q_lane_s32, HEDLEY_UNREACHABLE(), lane, ptr, val);
276 #else
277 simde_int32x4_private r;
278 for (size_t i = 0 ; i < 4 ; i++) {
279 r = simde_int32x4_to_private(val.val[i]);
280 ptr[i] = r.values[lane];
281 }
282 #endif
283 }
284 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
285 #undef vst4q_lane_s32
286 #define vst4q_lane_s32(a, b, c) simde_vst4q_lane_s32((a), (b), (c))
287 #endif
288
289 SIMDE_FUNCTION_ATTRIBUTES
290 void
291 simde_vst4q_lane_s64(int64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_int64x2x4_t val, const int lane)
292 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
293 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
294 SIMDE_CONSTIFY_2_NO_RESULT_(vst4q_lane_s64, HEDLEY_UNREACHABLE(), lane, ptr, val);
295 #else
296 simde_int64x2_private r;
297 for (size_t i = 0 ; i < 4 ; i++) {
298 r = simde_int64x2_to_private(val.val[i]);
299 ptr[i] = r.values[lane];
300 }
301 #endif
302 }
303 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
304 #undef vst4q_lane_s64
305 #define vst4q_lane_s64(a, b, c) simde_vst4q_lane_s64((a), (b), (c))
306 #endif
307
308 SIMDE_FUNCTION_ATTRIBUTES
309 void
310 simde_vst4q_lane_u8(uint8_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint8x16x4_t val, const int lane)
311 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 15) {
312 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
313 SIMDE_CONSTIFY_16_NO_RESULT_(vst4q_lane_u8, HEDLEY_UNREACHABLE(), lane, ptr, val);
314 #else
315 simde_uint8x16_private r;
316 for (size_t i = 0 ; i < 4 ; i++) {
317 r = simde_uint8x16_to_private(val.val[i]);
318 ptr[i] = r.values[lane];
319 }
320 #endif
321 }
322 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
323 #undef vst4q_lane_u8
324 #define vst4q_lane_u8(a, b, c) simde_vst4q_lane_u8((a), (b), (c))
325 #endif
326
327 SIMDE_FUNCTION_ATTRIBUTES
328 void
329 simde_vst4q_lane_u16(uint16_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint16x8x4_t val, const int lane)
330 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 7) {
331 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
332 SIMDE_CONSTIFY_8_NO_RESULT_(vst4q_lane_u16, HEDLEY_UNREACHABLE(), lane, ptr, val);
333 #else
334 simde_uint16x8_private r;
335 for (size_t i = 0 ; i < 4 ; i++) {
336 r = simde_uint16x8_to_private(val.val[i]);
337 ptr[i] = r.values[lane];
338 }
339 #endif
340 }
341 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
342 #undef vst4q_lane_u16
343 #define vst4q_lane_u16(a, b, c) simde_vst4q_lane_u16((a), (b), (c))
344 #endif
345
346 SIMDE_FUNCTION_ATTRIBUTES
347 void
348 simde_vst4q_lane_u32(uint32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint32x4x4_t val, const int lane)
349 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
350 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
351 SIMDE_CONSTIFY_4_NO_RESULT_(vst4q_lane_u32, HEDLEY_UNREACHABLE(), lane, ptr, val);
352 #else
353 simde_uint32x4_private r;
354 for (size_t i = 0 ; i < 4 ; i++) {
355 r = simde_uint32x4_to_private(val.val[i]);
356 ptr[i] = r.values[lane];
357 }
358 #endif
359 }
360 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
361 #undef vst4q_lane_u32
362 #define vst4q_lane_u32(a, b, c) simde_vst4q_lane_u32((a), (b), (c))
363 #endif
364
365 SIMDE_FUNCTION_ATTRIBUTES
366 void
367 simde_vst4q_lane_u64(uint64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_uint64x2x4_t val, const int lane)
368 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
369 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
370 SIMDE_CONSTIFY_2_NO_RESULT_(vst4q_lane_u64, HEDLEY_UNREACHABLE(), lane, ptr, val);
371 #else
372 simde_uint64x2_private r;
373 for (size_t i = 0 ; i < 4 ; i++) {
374 r = simde_uint64x2_to_private(val.val[i]);
375 ptr[i] = r.values[lane];
376 }
377 #endif
378 }
379 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
380 #undef vst4q_lane_u64
381 #define vst4q_lane_u64(a, b, c) simde_vst4q_lane_u64((a), (b), (c))
382 #endif
383
384 SIMDE_FUNCTION_ATTRIBUTES
385 void
386 simde_vst4q_lane_f32(simde_float32_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float32x4x4_t val, const int lane)
387 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 3) {
388 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
389 SIMDE_CONSTIFY_4_NO_RESULT_(vst4q_lane_f32, HEDLEY_UNREACHABLE(), lane, ptr, val);
390 #else
391 simde_float32x4_private r;
392 for (size_t i = 0 ; i < 4 ; i++) {
393 r = simde_float32x4_to_private(val.val[i]);
394 ptr[i] = r.values[lane];
395 }
396 #endif
397 }
398 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
399 #undef vst4q_lane_f32
400 #define vst4q_lane_f32(a, b, c) simde_vst4q_lane_f32((a), (b), (c))
401 #endif
402
403 SIMDE_FUNCTION_ATTRIBUTES
404 void
405 simde_vst4q_lane_f64(simde_float64_t ptr[HEDLEY_ARRAY_PARAM(4)], simde_float64x2x4_t val, const int lane)
406 SIMDE_REQUIRE_CONSTANT_RANGE(lane, 0, 1) {
407 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
408 (void) lane;
409 vst4q_lane_f64(ptr, val, 0);
410 #else
411 simde_float64x2_private r;
412 for (size_t i = 0 ; i < 4 ; i++) {
413 r = simde_float64x2_to_private(val.val[i]);
414 ptr[i] = r.values[lane];
415 }
416 #endif
417 }
418 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
419 #undef vst4q_lane_f64
420 #define vst4q_lane_f64(a, b, c) simde_vst4q_lane_f64((a), (b), (c))
421 #endif
422
423 #endif /* !defined(SIMDE_BUG_INTEL_857088) */
424
425 SIMDE_END_DECLS_
426 HEDLEY_DIAGNOSTIC_POP
427
428 #endif /* !defined(SIMDE_ARM_NEON_ST4_LANE_H) */