Debian Codegraph @

third-party/simde/x86/avx512/kshift.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 * 2020 Christopher Moore <[email protected]>
26 */
27
28 #if !defined(SIMDE_X86_AVX512_KSHIFT_H)
29 #define SIMDE_X86_AVX512_KSHIFT_H
30
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__mmask16
39 simde_kshiftli_mask16 (simde__mmask16 a, unsigned int count)
40 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
41 return HEDLEY_STATIC_CAST(simde__mmask16, (count <= 15) ? (a << count) : 0);
42 }
43 #if defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
44 #define simde_kshiftli_mask16(a, count) _kshiftli_mask16(a, count)
45 #endif
46 #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
47 #undef _kshiftli_mask16
48 #define _kshiftli_mask16(a, count) simde_kshiftli_mask16(a, count)
49 #endif
50
51 SIMDE_FUNCTION_ATTRIBUTES
52 simde__mmask32
53 simde_kshiftli_mask32 (simde__mmask32 a, unsigned int count)
54 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
55 return (count <= 31) ? (a << count) : 0;
56 }
57 #if defined(SIMDE_X86_AVX512BW_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
58 #define simde_kshiftli_mask32(a, count) _kshiftli_mask32(a, count)
59 #endif
60 #if defined(SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES)
61 #undef _kshiftli_mask32
62 #define _kshiftli_mask32(a, count) simde_kshiftli_mask32(a, count)
63 #endif
64
65 SIMDE_FUNCTION_ATTRIBUTES
66 simde__mmask64
67 simde_kshiftli_mask64 (simde__mmask64 a, unsigned int count)
68 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
69 return (count <= 63) ? (a << count) : 0;
70 }
71 #if defined(SIMDE_X86_AVX512BW_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
72 #define simde_kshiftli_mask64(a, count) _kshiftli_mask64(a, count)
73 #endif
74 #if defined(SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES)
75 #undef _kshiftli_mask64
76 #define _kshiftli_mask64(a, count) simde_kshiftli_mask64(a, count)
77 #endif
78
79 SIMDE_FUNCTION_ATTRIBUTES
80 simde__mmask8
81 simde_kshiftli_mask8 (simde__mmask8 a, unsigned int count)
82 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
83 return HEDLEY_STATIC_CAST(simde__mmask8, (count <= 7) ? (a << count) : 0);
84 }
85 #if defined(SIMDE_X86_AVX512DQ_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
86 #define simde_kshiftli_mask8(a, count) _kshiftli_mask8(a, count)
87 #endif
88 #if defined(SIMDE_X86_AVX512DQ_ENABLE_NATIVE_ALIASES)
89 #undef _kshiftli_mask8
90 #define _kshiftli_mask8(a, count) simde_kshiftli_mask8(a, count)
91 #endif
92
93 SIMDE_FUNCTION_ATTRIBUTES
94 simde__mmask16
95 simde_kshiftri_mask16 (simde__mmask16 a, unsigned int count)
96 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
97 return HEDLEY_STATIC_CAST(simde__mmask16, (count <= 15) ? (a >> count) : 0);
98 }
99 #if defined(SIMDE_X86_AVX512F_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
100 #define simde_kshiftri_mask16(a, count) _kshiftri_mask16(a, count)
101 #endif
102 #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
103 #undef _kshiftri_mask16
104 #define _kshiftri_mask16(a, count) simde_kshiftri_mask16(a, count)
105 #endif
106
107 SIMDE_FUNCTION_ATTRIBUTES
108 simde__mmask32
109 simde_kshiftri_mask32 (simde__mmask32 a, unsigned int count)
110 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
111 return (count <= 31) ? (a >> count) : 0;
112 }
113 #if defined(SIMDE_X86_AVX512BW_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
114 #define simde_kshiftri_mask32(a, count) _kshiftri_mask32(a, count)
115 #endif
116 #if defined(SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES)
117 #undef _kshiftri_mask32
118 #define _kshiftri_mask32(a, count) simde_kshiftri_mask32(a, count)
119 #endif
120
121 SIMDE_FUNCTION_ATTRIBUTES
122 simde__mmask64
123 simde_kshiftri_mask64 (simde__mmask64 a, unsigned int count)
124 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
125 return (count <= 63) ? (a >> count) : 0;
126 }
127 #if defined(SIMDE_X86_AVX512BW_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
128 #define simde_kshiftri_mask64(a, count) _kshiftri_mask64(a, count)
129 #endif
130 #if defined(SIMDE_X86_AVX512BW_ENABLE_NATIVE_ALIASES)
131 #undef _kshiftri_mask64
132 #define _kshiftri_mask64(a, count) simde_kshiftri_mask64(a, count)
133 #endif
134
135 SIMDE_FUNCTION_ATTRIBUTES
136 simde__mmask8
137 simde_kshiftri_mask8 (simde__mmask8 a, unsigned int count)
138 SIMDE_REQUIRE_CONSTANT_RANGE(count, 0, 255) {
139 return HEDLEY_STATIC_CAST(simde__mmask8, (count <= 7) ? (a >> count) : 0);
140 }
141 #if defined(SIMDE_X86_AVX512DQ_NATIVE) && (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(7,0,0)) && (!defined(SIMDE_DETECT_CLANG_VERSION) && SIMDE_DETECT_CLANG_VERSION_CHECK(8,0,0))
142 #define simde_kshiftri_mask8(a, count) _kshiftri_mask8(a, count)
143 #endif
144 #if defined(SIMDE_X86_AVX512DQ_ENABLE_NATIVE_ALIASES)
145 #undef _kshiftri_mask8
146 #define _kshiftri_mask8(a, count) simde_kshiftri_mask8(a, count)
147 #endif
148
149 SIMDE_END_DECLS_
150 HEDLEY_DIAGNOSTIC_POP
151
152 #endif /* !defined(SIMDE_X86_AVX512_KSHIFT_H) */