Debian Codegraph @

third-party/simde/x86/avx512/testn.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 Andrew Rodriguez <[email protected]>
25 */
26
27 #if !defined(SIMDE_X86_AVX512_TESTN_H)
28 #define SIMDE_X86_AVX512_TESTN_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__mmask8
38 simde_mm512_testn_epi64_mask (simde__m512i a, simde__m512i b) {
39 #if defined(SIMDE_X86_AVX512F_NATIVE)
40 return _mm512_testn_epi64_mask(a, b);
41 #else
42 simde__m512i_private
43 a_ = simde__m512i_to_private(a),
44 b_ = simde__m512i_to_private(b);
45 simde__mmask8 r = 0;
46
47 SIMDE_VECTORIZE_REDUCTION(|:r)
48 for (size_t i = 0 ; i < (sizeof(a_.i64) / sizeof(a_.i64[0])) ; i++) {
49 r |= (!(a_.i64[i] & b_.i64[i])) << i;
50 }
51
52 return r;
53 #endif
54 }
55 #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
56 #undef _mm512_testn_epi64_mask
57 #define _mm512_testn_epi64_mask(a, b) simde_mm512_testn_epi64_mask(a, b)
58 #endif
59
60 SIMDE_END_DECLS_
61 HEDLEY_DIAGNOSTIC_POP
62
63 #endif /* !defined(SIMDE_X86_AVX512_TESTN_H) */