Debian Codegraph @

third-party/simde/mips/msa/and.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 */
26
27 #if !defined(SIMDE_MIPS_MSA_AND_H)
28 #define SIMDE_MIPS_MSA_AND_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 simde_v16u8
38 simde_msa_and_v(simde_v16u8 a, simde_v16u8 b) {
39 #if defined(SIMDE_MIPS_MSA_NATIVE)
40 return __msa_and_v(a, b);
41 #elif defined(SIMDE_ARM_NEON_A32V7_NATIVE)
42 return vandq_u8(a, b);
43 #elif defined(SIMDE_POWER_ALTIVEC_P6_NATIVE)
44 return vec_and(a, b);
45 #else
46 simde_v16u8_private
47 a_ = simde_v16u8_to_private(a),
48 b_ = simde_v16u8_to_private(b),
49 r_;
50
51 #if defined(SIMDE_X86_SSSE3_NATIVE)
52 r_.m128i = _mm_and_si128(a_.m128i, b_.m128i);
53 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
54 r_.v128 = wasm_v128_and(a_.v128, b_.v128);
55 #elif defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
56 r_.values = a_.values & b_.values;
57 #else
58 SIMDE_VECTORIZE
59 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
60 r_.values[i] = a_.values[i] & b_.values[i];
61 }
62 #endif
63
64 return simde_v16u8_from_private(r_);
65 #endif
66 }
67 #if defined(SIMDE_MIPS_MSA_ENABLE_NATIVE_ALIASES)
68 #undef __msa_and_v
69 #define __msa_and_v(a, b) simde_msa_and_v((a), (b))
70 #endif
71
72 SIMDE_END_DECLS_
73 HEDLEY_DIAGNOSTIC_POP
74
75 #endif /* !defined(SIMDE_MIPS_MSA_AND_H) */