Debian Codegraph @

third-party/simde/arm/neon/clez.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_ARM_NEON_CLEZ_H)
29 #define SIMDE_ARM_NEON_CLEZ_H
30
31 #include "cle.h"
32 #include "dup_n.h"
33 #include "types.h"
34
35 HEDLEY_DIAGNOSTIC_PUSH
36 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
37 SIMDE_BEGIN_DECLS_
38
39 SIMDE_FUNCTION_ATTRIBUTES
40 uint64_t
41 simde_vclezd_s64(int64_t a) {
42 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
43 return HEDLEY_STATIC_CAST(uint64_t, vclezd_s64(a));
44 #else
45 return (a <= 0) ? UINT64_MAX : 0;
46 #endif
47 }
48 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
49 #undef vclezd_s64
50 #define vclezd_s64(a) simde_vclezd_s64(a)
51 #endif
52
53 SIMDE_FUNCTION_ATTRIBUTES
54 uint64_t
55 simde_vclezd_f64(simde_float64_t a) {
56 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
57 return HEDLEY_STATIC_CAST(uint64_t, vclezd_f64(a));
58 #else
59 return (a <= SIMDE_FLOAT64_C(0.0)) ? UINT64_MAX : 0;
60 #endif
61 }
62 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
63 #undef vclezd_f64
64 #define vclezd_f64(a) simde_vclezd_f64(a)
65 #endif
66
67 SIMDE_FUNCTION_ATTRIBUTES
68 uint32_t
69 simde_vclezs_f32(simde_float32_t a) {
70 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
71 return HEDLEY_STATIC_CAST(uint32_t, vclezs_f32(a));
72 #else
73 return (a <= SIMDE_FLOAT32_C(0.0)) ? UINT32_MAX : 0;
74 #endif
75 }
76 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
77 #undef vclezs_f32
78 #define vclezs_f32(a) simde_vclezs_f32(a)
79 #endif
80
81 SIMDE_FUNCTION_ATTRIBUTES
82 simde_uint32x4_t
83 simde_vclezq_f32(simde_float32x4_t a) {
84 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
85 return vclezq_f32(a);
86 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
87 return simde_vcleq_f32(a, simde_vdupq_n_f32(SIMDE_FLOAT32_C(0.0)));
88 #else
89 simde_float32x4_private a_ = simde_float32x4_to_private(a);
90 simde_uint32x4_private r_;
91
92 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
93 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= SIMDE_FLOAT32_C(0.0));
94 #else
95 SIMDE_VECTORIZE
96 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
97 r_.values[i] = (a_.values[i] <= SIMDE_FLOAT32_C(0.0)) ? UINT32_MAX : 0;
98 }
99 #endif
100
101 return simde_uint32x4_from_private(r_);
102 #endif
103 }
104 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
105 #undef vclezq_f32
106 #define vclezq_f32(a) simde_vclezq_f32(a)
107 #endif
108
109 SIMDE_FUNCTION_ATTRIBUTES
110 simde_uint64x2_t
111 simde_vclezq_f64(simde_float64x2_t a) {
112 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
113 return vclezq_f64(a);
114 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
115 return simde_vcleq_f64(a, simde_vdupq_n_f64(SIMDE_FLOAT64_C(0.0)));
116 #else
117 simde_float64x2_private a_ = simde_float64x2_to_private(a);
118 simde_uint64x2_private r_;
119
120 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
121 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= SIMDE_FLOAT64_C(0.0));
122 #else
123 SIMDE_VECTORIZE
124 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
125 r_.values[i] = (a_.values[i] <= SIMDE_FLOAT64_C(0.0)) ? UINT64_MAX : 0;
126 }
127 #endif
128
129 return simde_uint64x2_from_private(r_);
130 #endif
131 }
132 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
133 #undef vclezq_f64
134 #define vclezq_f64(a) simde_vclezq_f64(a)
135 #endif
136
137 SIMDE_FUNCTION_ATTRIBUTES
138 simde_uint8x16_t
139 simde_vclezq_s8(simde_int8x16_t a) {
140 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
141 return vclezq_s8(a);
142 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
143 return simde_vcleq_s8(a, simde_vdupq_n_s8(0));
144 #else
145 simde_int8x16_private a_ = simde_int8x16_to_private(a);
146 simde_uint8x16_private r_;
147
148 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
149 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
150 #else
151 SIMDE_VECTORIZE
152 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
153 r_.values[i] = (a_.values[i] <= 0) ? UINT8_MAX : 0;
154 }
155 #endif
156
157 return simde_uint8x16_from_private(r_);
158 #endif
159 }
160 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
161 #undef vclezq_s8
162 #define vclezq_s8(a) simde_vclezq_s8(a)
163 #endif
164
165 SIMDE_FUNCTION_ATTRIBUTES
166 simde_uint16x8_t
167 simde_vclezq_s16(simde_int16x8_t a) {
168 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
169 return vclezq_s16(a);
170 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
171 return simde_vcleq_s16(a, simde_vdupq_n_s16(0));
172 #else
173 simde_int16x8_private a_ = simde_int16x8_to_private(a);
174 simde_uint16x8_private r_;
175
176 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
177 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
178 #else
179 SIMDE_VECTORIZE
180 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
181 r_.values[i] = (a_.values[i] <= 0) ? UINT16_MAX : 0;
182 }
183 #endif
184
185 return simde_uint16x8_from_private(r_);
186 #endif
187 }
188 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
189 #undef vclezq_s16
190 #define vclezq_s16(a) simde_vclezq_s16(a)
191 #endif
192
193 SIMDE_FUNCTION_ATTRIBUTES
194 simde_uint32x4_t
195 simde_vclezq_s32(simde_int32x4_t a) {
196 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
197 return vclezq_s32(a);
198 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
199 return simde_vcleq_s32(a, simde_vdupq_n_s32(0));
200 #else
201 simde_int32x4_private a_ = simde_int32x4_to_private(a);
202 simde_uint32x4_private r_;
203
204 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
205 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
206 #else
207 SIMDE_VECTORIZE
208 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
209 r_.values[i] = (a_.values[i] <= 0) ? UINT32_MAX : 0;
210 }
211 #endif
212
213 return simde_uint32x4_from_private(r_);
214 #endif
215 }
216 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
217 #undef vclezq_s32
218 #define vclezq_s32(a) simde_vclezq_s32(a)
219 #endif
220
221 SIMDE_FUNCTION_ATTRIBUTES
222 simde_uint64x2_t
223 simde_vclezq_s64(simde_int64x2_t a) {
224 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
225 return vclezq_s64(a);
226 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
227 return simde_vcleq_s64(a, simde_vdupq_n_s64(0));
228 #else
229 simde_int64x2_private a_ = simde_int64x2_to_private(a);
230 simde_uint64x2_private r_;
231
232 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
233 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
234 #else
235 SIMDE_VECTORIZE
236 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
237 r_.values[i] = (a_.values[i] <= 0) ? UINT64_MAX : 0;
238 }
239 #endif
240
241 return simde_uint64x2_from_private(r_);
242 #endif
243 }
244 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
245 #undef vclezq_s64
246 #define vclezq_s64(a) simde_vclezq_s64(a)
247 #endif
248
249 SIMDE_FUNCTION_ATTRIBUTES
250 simde_uint32x2_t
251 simde_vclez_f32(simde_float32x2_t a) {
252 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
253 return vclez_f32(a);
254 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
255 return simde_vcle_f32(a, simde_vdup_n_f32(SIMDE_FLOAT32_C(0.0)));
256 #else
257 simde_float32x2_private a_ = simde_float32x2_to_private(a);
258 simde_uint32x2_private r_;
259
260 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR) && !defined(SIMDE_BUG_GCC_100762)
261 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= SIMDE_FLOAT32_C(0.0));
262 #else
263 SIMDE_VECTORIZE
264 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
265 r_.values[i] = (a_.values[i] <= SIMDE_FLOAT32_C(0.0)) ? UINT32_MAX : 0;
266 }
267 #endif
268
269 return simde_uint32x2_from_private(r_);
270 #endif
271 }
272 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
273 #undef vclez_f32
274 #define vclez_f32(a) simde_vclez_f32(a)
275 #endif
276
277 SIMDE_FUNCTION_ATTRIBUTES
278 simde_uint64x1_t
279 simde_vclez_f64(simde_float64x1_t a) {
280 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
281 return vclez_f64(a);
282 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
283 return simde_vcle_f64(a, simde_vdup_n_f64(SIMDE_FLOAT64_C(0.0)));
284 #else
285 simde_float64x1_private a_ = simde_float64x1_to_private(a);
286 simde_uint64x1_private r_;
287
288 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
289 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= SIMDE_FLOAT64_C(0.0));
290 #else
291 SIMDE_VECTORIZE
292 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
293 r_.values[i] = (a_.values[i] <= SIMDE_FLOAT64_C(0.0)) ? UINT64_MAX : 0;
294 }
295 #endif
296
297 return simde_uint64x1_from_private(r_);
298 #endif
299 }
300 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
301 #undef vclez_f64
302 #define vclez_f64(a) simde_vclez_f64(a)
303 #endif
304
305 SIMDE_FUNCTION_ATTRIBUTES
306 simde_uint8x8_t
307 simde_vclez_s8(simde_int8x8_t a) {
308 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
309 return vclez_s8(a);
310 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
311 return simde_vcle_s8(a, simde_vdup_n_s8(0));
312 #else
313 simde_int8x8_private a_ = simde_int8x8_to_private(a);
314 simde_uint8x8_private r_;
315
316 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR) && !defined(SIMDE_BUG_GCC_100762)
317 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
318 #else
319 SIMDE_VECTORIZE
320 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
321 r_.values[i] = (a_.values[i] <= 0) ? UINT8_MAX : 0;
322 }
323 #endif
324
325 return simde_uint8x8_from_private(r_);
326 #endif
327 }
328 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
329 #undef vclez_s8
330 #define vclez_s8(a) simde_vclez_s8(a)
331 #endif
332
333 SIMDE_FUNCTION_ATTRIBUTES
334 simde_uint16x4_t
335 simde_vclez_s16(simde_int16x4_t a) {
336 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
337 return vclez_s16(a);
338 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
339 return simde_vcle_s16(a, simde_vdup_n_s16(0));
340 #else
341 simde_int16x4_private a_ = simde_int16x4_to_private(a);
342 simde_uint16x4_private r_;
343
344 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR) && !defined(SIMDE_BUG_GCC_100762)
345 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
346 #else
347 SIMDE_VECTORIZE
348 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
349 r_.values[i] = (a_.values[i] <= 0) ? UINT16_MAX : 0;
350 }
351 #endif
352
353 return simde_uint16x4_from_private(r_);
354 #endif
355 }
356 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
357 #undef vclez_s16
358 #define vclez_s16(a) simde_vclez_s16(a)
359 #endif
360
361 SIMDE_FUNCTION_ATTRIBUTES
362 simde_uint32x2_t
363 simde_vclez_s32(simde_int32x2_t a) {
364 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
365 return vclez_s32(a);
366 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
367 return simde_vcle_s32(a, simde_vdup_n_s32(0));
368 #else
369 simde_int32x2_private a_ = simde_int32x2_to_private(a);
370 simde_uint32x2_private r_;
371
372 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR) && !defined(SIMDE_BUG_GCC_100762)
373 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
374 #else
375 SIMDE_VECTORIZE
376 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
377 r_.values[i] = (a_.values[i] <= 0) ? UINT32_MAX : 0;
378 }
379 #endif
380
381 return simde_uint32x2_from_private(r_);
382 #endif
383 }
384 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
385 #undef vclez_s32
386 #define vclez_s32(a) simde_vclez_s32(a)
387 #endif
388
389 SIMDE_FUNCTION_ATTRIBUTES
390 simde_uint64x1_t
391 simde_vclez_s64(simde_int64x1_t a) {
392 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
393 return vclez_s64(a);
394 #elif SIMDE_NATURAL_VECTOR_SIZE > 0
395 return simde_vcle_s64(a, simde_vdup_n_s64(0));
396 #else
397 simde_int64x1_private a_ = simde_int64x1_to_private(a);
398 simde_uint64x1_private r_;
399
400 #if defined(SIMDE_VECTOR_SUBSCRIPT_SCALAR)
401 r_.values = HEDLEY_REINTERPRET_CAST(__typeof__(r_.values), a_.values <= 0);
402 #else
403 SIMDE_VECTORIZE
404 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
405 r_.values[i] = (a_.values[i] <= 0) ? UINT64_MAX : 0;
406 }
407 #endif
408
409 return simde_uint64x1_from_private(r_);
410 #endif
411 }
412 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
413 #undef vclez_s64
414 #define vclez_s64(a) simde_vclez_s64(a)
415 #endif
416
417 SIMDE_END_DECLS_
418 HEDLEY_DIAGNOSTIC_POP
419
420 #endif /* !defined(SIMDE_ARM_NEON_CLEZ_H) */