Debian Codegraph @

third-party/simde/arm/neon/cls.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_CLS_H)
28 #define SIMDE_ARM_NEON_CLS_H
29
30 #include "types.h"
31 #include "bsl.h"
32 #include "clz.h"
33 #include "cltz.h"
34 #include "dup_n.h"
35 #include "mvn.h"
36 #include "sub.h"
37 #include "reinterpret.h"
38
39 HEDLEY_DIAGNOSTIC_PUSH
40 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
41 SIMDE_BEGIN_DECLS_
42
43 SIMDE_FUNCTION_ATTRIBUTES
44 simde_int8x8_t
45 simde_vcls_s8(simde_int8x8_t a) {
46 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
47 return vcls_s8(a);
48 #else
49 return simde_vsub_s8(simde_vclz_s8(simde_vbsl_s8(simde_vcltz_s8(a), simde_vmvn_s8(a), a)), simde_vdup_n_s8(INT8_C(1)));
50 #endif
51 }
52 #define simde_vcls_u8(a) simde_vcls_s8(simde_vreinterpret_s8_u8(a))
53 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
54 #undef vcls_s8
55 #define vcls_s8(a) simde_vcls_s8(a)
56 #undef vcls_u8
57 #define vcls_u8(a) simde_vcls_u8(a)
58 #endif
59
60 SIMDE_FUNCTION_ATTRIBUTES
61 simde_int16x4_t
62 simde_vcls_s16(simde_int16x4_t a) {
63 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
64 return vcls_s16(a);
65 #else
66 return simde_vsub_s16(simde_vclz_s16(simde_vbsl_s16(simde_vcltz_s16(a), simde_vmvn_s16(a), a)), simde_vdup_n_s16(INT16_C(1)));
67 #endif
68 }
69 #define simde_vcls_u16(a) simde_vcls_s16(simde_vreinterpret_s16_u16(a))
70 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
71 #undef vcls_s16
72 #define vcls_s16(a) simde_vcls_s16(a)
73 #undef vcls_u16
74 #define vcls_u16(a) simde_vcls_u16(a)
75 #endif
76
77 SIMDE_FUNCTION_ATTRIBUTES
78 simde_int32x2_t
79 simde_vcls_s32(simde_int32x2_t a) {
80 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
81 return vcls_s32(a);
82 #else
83 return simde_vsub_s32(simde_vclz_s32(simde_vbsl_s32(simde_vcltz_s32(a), simde_vmvn_s32(a), a)), simde_vdup_n_s32(INT32_C(1)));
84 #endif
85 }
86 #define simde_vcls_u32(a) simde_vcls_s32(simde_vreinterpret_s32_u32(a))
87 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
88 #undef vcls_s32
89 #define vcls_s32(a) simde_vcls_s32(a)
90 #undef vcls_u32
91 #define vcls_u32(a) simde_vcls_u32(a)
92 #endif
93
94 SIMDE_FUNCTION_ATTRIBUTES
95 simde_int8x16_t
96 simde_vclsq_s8(simde_int8x16_t a) {
97 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
98 return vclsq_s8(a);
99 #else
100 return simde_vsubq_s8(simde_vclzq_s8(simde_vbslq_s8(simde_vcltzq_s8(a), simde_vmvnq_s8(a), a)), simde_vdupq_n_s8(INT8_C(1)));
101 #endif
102 }
103 #define simde_vclsq_u8(a) simde_vclsq_s8(simde_vreinterpretq_s8_u8(a))
104 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
105 #undef vclsq_s8
106 #define vclsq_s8(a) simde_vclsq_s8(a)
107 #undef vclsq_u8
108 #define vclsq_u8(a) simde_vclsq_u8(a)
109 #endif
110
111 SIMDE_FUNCTION_ATTRIBUTES
112 simde_int16x8_t
113 simde_vclsq_s16(simde_int16x8_t a) {
114 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
115 return vclsq_s16(a);
116 #else
117 return simde_vsubq_s16(simde_vclzq_s16(simde_vbslq_s16(simde_vcltzq_s16(a), simde_vmvnq_s16(a), a)), simde_vdupq_n_s16(INT16_C(1)));
118 #endif
119 }
120 #define simde_vclsq_u16(a) simde_vclsq_s16(simde_vreinterpretq_s16_u16(a))
121 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
122 #undef vclsq_s16
123 #define vclsq_s16(a) simde_vclsq_s16(a)
124 #undef vclsq_u16
125 #define vclsq_u16(a) simde_vclsq_u16(a)
126 #endif
127
128 SIMDE_FUNCTION_ATTRIBUTES
129 simde_int32x4_t
130 simde_vclsq_s32(simde_int32x4_t a) {
131 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
132 return vclsq_s32(a);
133 #else
134 return simde_vsubq_s32(simde_vclzq_s32(simde_vbslq_s32(simde_vcltzq_s32(a), simde_vmvnq_s32(a), a)), simde_vdupq_n_s32(INT32_C(1)));
135 #endif
136 }
137 #define simde_vclsq_u32(a) simde_vclsq_s32(simde_vreinterpretq_s32_u32(a))
138 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
139 #undef vclsq_s32
140 #define vclsq_s32(a) simde_vclsq_s32(a)
141 #undef vclsq_u32
142 #define vclsq_u32(a) simde_vclsq_u32(a)
143 #endif
144
145 SIMDE_END_DECLS_
146 HEDLEY_DIAGNOSTIC_POP
147
148 #endif /* !defined(SIMDE_ARM_NEON_CLS_H) */