Debian Codegraph @

third-party/simde/arm/neon/orn.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_ORN_H)
28 #define SIMDE_ARM_NEON_ORN_H
29
30 #include "orr.h"
31 #include "mvn.h"
32 #include "types.h"
33
34 HEDLEY_DIAGNOSTIC_PUSH
35 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
36 SIMDE_BEGIN_DECLS_
37
38 SIMDE_FUNCTION_ATTRIBUTES
39 simde_int8x8_t
40 simde_vorn_s8(simde_int8x8_t a, simde_int8x8_t b) {
41 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
42 return vorn_s8(a, b);
43 #else
44 simde_int8x8_private
45 a_ = simde_int8x8_to_private(a),
46 b_ = simde_int8x8_to_private(b),
47 r_;
48
49 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
50 r_.values = a_.values | ~(b_.values);
51 #else
52 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
53 r_.values[i] = a_.values[i] | ~b_.values[i];
54 }
55 #endif
56
57 return simde_int8x8_from_private(r_);
58 #endif
59 }
60 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
61 #undef vorn_s8
62 #define vorn_s8(a, b) simde_vorn_s8((a), (b))
63 #endif
64
65 SIMDE_FUNCTION_ATTRIBUTES
66 simde_int16x4_t
67 simde_vorn_s16(simde_int16x4_t a, simde_int16x4_t b) {
68 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
69 return vorn_s16(a, b);
70 #else
71 simde_int16x4_private
72 a_ = simde_int16x4_to_private(a),
73 b_ = simde_int16x4_to_private(b),
74 r_;
75
76 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
77 r_.values = a_.values | ~(b_.values);
78 #else
79 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
80 r_.values[i] = a_.values[i] | ~b_.values[i];
81 }
82 #endif
83
84 return simde_int16x4_from_private(r_);
85 #endif
86 }
87 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
88 #undef vorn_s16
89 #define vorn_s16(a, b) simde_vorn_s16((a), (b))
90 #endif
91
92 SIMDE_FUNCTION_ATTRIBUTES
93 simde_int32x2_t
94 simde_vorn_s32(simde_int32x2_t a, simde_int32x2_t b) {
95 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
96 return vorn_s32(a, b);
97 #else
98 simde_int32x2_private
99 a_ = simde_int32x2_to_private(a),
100 b_ = simde_int32x2_to_private(b),
101 r_;
102
103 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
104 r_.values = a_.values | ~(b_.values);
105 #else
106 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
107 r_.values[i] = a_.values[i] | ~b_.values[i];
108 }
109 #endif
110
111 return simde_int32x2_from_private(r_);
112 #endif
113 }
114 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
115 #undef vorn_s32
116 #define vorn_s32(a, b) simde_vorn_s32((a), (b))
117 #endif
118
119 SIMDE_FUNCTION_ATTRIBUTES
120 simde_int64x1_t
121 simde_vorn_s64(simde_int64x1_t a, simde_int64x1_t b) {
122 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
123 return vorn_s64(a, b);
124 #else
125 simde_int64x1_private
126 a_ = simde_int64x1_to_private(a),
127 b_ = simde_int64x1_to_private(b),
128 r_;
129
130 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
131 r_.values = a_.values | ~(b_.values);
132 #else
133 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
134 r_.values[i] = a_.values[i] | ~b_.values[i];
135 }
136 #endif
137
138 return simde_int64x1_from_private(r_);
139 #endif
140 }
141 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
142 #undef vorn_s64
143 #define vorn_s64(a, b) simde_vorn_s64((a), (b))
144 #endif
145
146 SIMDE_FUNCTION_ATTRIBUTES
147 simde_uint8x8_t
148 simde_vorn_u8(simde_uint8x8_t a, simde_uint8x8_t b) {
149 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
150 return vorn_u8(a, b);
151 #else
152 simde_uint8x8_private
153 a_ = simde_uint8x8_to_private(a),
154 b_ = simde_uint8x8_to_private(b),
155 r_;
156
157 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
158 r_.values = a_.values | ~(b_.values);
159 #else
160 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
161 r_.values[i] = a_.values[i] | ~b_.values[i];
162 }
163 #endif
164
165 return simde_uint8x8_from_private(r_);
166 #endif
167 }
168 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
169 #undef vorn_u8
170 #define vorn_u8(a, b) simde_vorn_u8((a), (b))
171 #endif
172
173 SIMDE_FUNCTION_ATTRIBUTES
174 simde_uint16x4_t
175 simde_vorn_u16(simde_uint16x4_t a, simde_uint16x4_t b) {
176 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
177 return vorn_u16(a, b);
178 #else
179 simde_uint16x4_private
180 a_ = simde_uint16x4_to_private(a),
181 b_ = simde_uint16x4_to_private(b),
182 r_;
183
184 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
185 r_.values = a_.values | ~(b_.values);
186 #else
187 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
188 r_.values[i] = a_.values[i] | ~b_.values[i];
189 }
190 #endif
191
192 return simde_uint16x4_from_private(r_);
193 #endif
194 }
195 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
196 #undef vorn_u16
197 #define vorn_u16(a, b) simde_vorn_u16((a), (b))
198 #endif
199
200 SIMDE_FUNCTION_ATTRIBUTES
201 simde_uint32x2_t
202 simde_vorn_u32(simde_uint32x2_t a, simde_uint32x2_t b) {
203 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
204 return vorn_u32(a, b);
205 #else
206 simde_uint32x2_private
207 a_ = simde_uint32x2_to_private(a),
208 b_ = simde_uint32x2_to_private(b),
209 r_;
210
211 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
212 r_.values = a_.values | ~(b_.values);
213 #else
214 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
215 r_.values[i] = a_.values[i] | ~b_.values[i];
216 }
217 #endif
218
219 return simde_uint32x2_from_private(r_);
220 #endif
221 }
222 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
223 #undef vorn_u32
224 #define vorn_u32(a, b) simde_vorn_u32((a), (b))
225 #endif
226
227 SIMDE_FUNCTION_ATTRIBUTES
228 simde_uint64x1_t
229 simde_vorn_u64(simde_uint64x1_t a, simde_uint64x1_t b) {
230 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
231 return vorn_u64(a, b);
232 #else
233 simde_uint64x1_private
234 a_ = simde_uint64x1_to_private(a),
235 b_ = simde_uint64x1_to_private(b),
236 r_;
237
238 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
239 r_.values = a_.values | ~(b_.values);
240 #else
241 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
242 r_.values[i] = a_.values[i] | ~b_.values[i];
243 }
244 #endif
245
246 return simde_uint64x1_from_private(r_);
247 #endif
248 }
249 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
250 #undef vorn_u64
251 #define vorn_u64(a, b) simde_vorn_u64((a), (b))
252 #endif
253
254 SIMDE_FUNCTION_ATTRIBUTES
255 simde_int8x16_t
256 simde_vornq_s8(simde_int8x16_t a, simde_int8x16_t b) {
257 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
258 return vornq_s8(a, b);
259 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
260 return vec_orc(a, b);
261 #else
262 simde_int8x16_private
263 a_ = simde_int8x16_to_private(a),
264 b_ = simde_int8x16_to_private(b),
265 r_;
266
267 #if defined(SIMDE_X86_AVX512VL_NATIVE)
268 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
269 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
270 r_.values = a_.values | ~(b_.values);
271 #else
272 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
273 r_.values[i] = a_.values[i] | ~b_.values[i];
274 }
275 #endif
276
277 return simde_int8x16_from_private(r_);
278 #endif
279 }
280 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
281 #undef vornq_s8
282 #define vornq_s8(a, b) simde_vornq_s8((a), (b))
283 #endif
284
285 SIMDE_FUNCTION_ATTRIBUTES
286 simde_int16x8_t
287 simde_vornq_s16(simde_int16x8_t a, simde_int16x8_t b) {
288 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
289 return vornq_s16(a, b);
290 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
291 return vec_orc(a, b);
292 #else
293 simde_int16x8_private
294 a_ = simde_int16x8_to_private(a),
295 b_ = simde_int16x8_to_private(b),
296 r_;
297
298 #if defined(SIMDE_X86_AVX512VL_NATIVE)
299 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
300 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
301 r_.values = a_.values | ~(b_.values);
302 #else
303 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
304 r_.values[i] = a_.values[i] | ~b_.values[i];
305 }
306 #endif
307
308 return simde_int16x8_from_private(r_);
309 #endif
310 }
311 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
312 #undef vornq_s16
313 #define vornq_s16(a, b) simde_vornq_s16((a), (b))
314 #endif
315
316 SIMDE_FUNCTION_ATTRIBUTES
317 simde_int32x4_t
318 simde_vornq_s32(simde_int32x4_t a, simde_int32x4_t b) {
319 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
320 return vornq_s32(a, b);
321 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
322 return vec_orc(a, b);
323 #else
324 simde_int32x4_private
325 a_ = simde_int32x4_to_private(a),
326 b_ = simde_int32x4_to_private(b),
327 r_;
328
329 #if defined(SIMDE_X86_AVX512VL_NATIVE)
330 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
331 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
332 r_.values = a_.values | ~(b_.values);
333 #else
334 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
335 r_.values[i] = a_.values[i] | ~b_.values[i];
336 }
337 #endif
338
339 return simde_int32x4_from_private(r_);
340 #endif
341 }
342 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
343 #undef vornq_s32
344 #define vornq_s32(a, b) simde_vornq_s32((a), (b))
345 #endif
346
347 SIMDE_FUNCTION_ATTRIBUTES
348 simde_int64x2_t
349 simde_vornq_s64(simde_int64x2_t a, simde_int64x2_t b) {
350 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
351 return vornq_s64(a, b);
352 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
353 return vec_orc(a, b);
354 #else
355 simde_int64x2_private
356 a_ = simde_int64x2_to_private(a),
357 b_ = simde_int64x2_to_private(b),
358 r_;
359
360 #if defined(SIMDE_X86_AVX512VL_NATIVE)
361 r_.m128i = _mm_ternarylogic_epi64(a_.m128i, b_.m128i, a_.m128i, 0xf3);
362 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
363 r_.values = a_.values | ~(b_.values);
364 #else
365 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
366 r_.values[i] = a_.values[i] | ~b_.values[i];
367 }
368 #endif
369
370 return simde_int64x2_from_private(r_);
371 #endif
372 }
373 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
374 #undef vornq_s64
375 #define vornq_s64(a, b) simde_vornq_s64((a), (b))
376 #endif
377
378 SIMDE_FUNCTION_ATTRIBUTES
379 simde_uint8x16_t
380 simde_vornq_u8(simde_uint8x16_t a, simde_uint8x16_t b) {
381 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
382 return vornq_u8(a, b);
383 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
384 return vec_orc(a, b);
385 #else
386 simde_uint8x16_private
387 a_ = simde_uint8x16_to_private(a),
388 b_ = simde_uint8x16_to_private(b),
389 r_;
390
391 #if defined(SIMDE_X86_AVX512VL_NATIVE)
392 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
393 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
394 r_.values = a_.values | ~(b_.values);
395 #else
396 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
397 r_.values[i] = a_.values[i] | ~b_.values[i];
398 }
399 #endif
400
401 return simde_uint8x16_from_private(r_);
402 #endif
403 }
404 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
405 #undef vornq_u8
406 #define vornq_u8(a, b) simde_vornq_u8((a), (b))
407 #endif
408
409 SIMDE_FUNCTION_ATTRIBUTES
410 simde_uint16x8_t
411 simde_vornq_u16(simde_uint16x8_t a, simde_uint16x8_t b) {
412 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
413 return vornq_u16(a, b);
414 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
415 return vec_orc(a, b);
416 #else
417 simde_uint16x8_private
418 a_ = simde_uint16x8_to_private(a),
419 b_ = simde_uint16x8_to_private(b),
420 r_;
421
422 #if defined(SIMDE_X86_AVX512VL_NATIVE)
423 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
424 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
425 r_.values = a_.values | ~(b_.values);
426 #else
427 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
428 r_.values[i] = a_.values[i] | ~b_.values[i];
429 }
430 #endif
431
432 return simde_uint16x8_from_private(r_);
433 #endif
434 }
435 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
436 #undef vornq_u16
437 #define vornq_u16(a, b) simde_vornq_u16((a), (b))
438 #endif
439
440 SIMDE_FUNCTION_ATTRIBUTES
441 simde_uint32x4_t
442 simde_vornq_u32(simde_uint32x4_t a, simde_uint32x4_t b) {
443 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
444 return vornq_u32(a, b);
445 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
446 return vec_orc(a, b);
447 #else
448 simde_uint32x4_private
449 a_ = simde_uint32x4_to_private(a),
450 b_ = simde_uint32x4_to_private(b),
451 r_;
452
453 #if defined(SIMDE_X86_AVX512VL_NATIVE)
454 r_.m128i = _mm_ternarylogic_epi32(a_.m128i, b_.m128i, a_.m128i, 0xf3);
455 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
456 r_.values = a_.values | ~(b_.values);
457 #else
458 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
459 r_.values[i] = a_.values[i] | ~b_.values[i];
460 }
461 #endif
462
463 return simde_uint32x4_from_private(r_);
464 #endif
465 }
466 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
467 #undef vornq_u32
468 #define vornq_u32(a, b) simde_vornq_u32((a), (b))
469 #endif
470
471 SIMDE_FUNCTION_ATTRIBUTES
472 simde_uint64x2_t
473 simde_vornq_u64(simde_uint64x2_t a, simde_uint64x2_t b) {
474 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
475 return vornq_u64(a, b);
476 #elif defined(SIMDE_POWER_ALTIVEC_P8_NATIVE)
477 return vec_orc(a, b);
478 #else
479 simde_uint64x2_private
480 a_ = simde_uint64x2_to_private(a),
481 b_ = simde_uint64x2_to_private(b),
482 r_;
483
484 #if defined(SIMDE_X86_AVX512VL_NATIVE)
485 r_.m128i = _mm_ternarylogic_epi64(a_.m128i, b_.m128i, a_.m128i, 0xf3);
486 #elif defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
487 r_.values = a_.values | ~(b_.values);
488 #else
489 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
490 r_.values[i] = a_.values[i] | ~b_.values[i];
491 }
492 #endif
493
494 return simde_uint64x2_from_private(r_);
495 #endif
496 }
497 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
498 #undef vornq_u64
499 #define vornq_u64(a, b) simde_vornq_u64((a), (b))
500 #endif
501
502 SIMDE_END_DECLS_
503 HEDLEY_DIAGNOSTIC_POP
504
505 #endif /* !defined(SIMDE_ARM_NEON_ORN_H) */