Debian Codegraph @

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