Debian Codegraph @

third-party/simde/arm/neon/recps.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 Zhi An Ng <[email protected]> (Copyright owned by Google, LLC)
25 */
26
27 #if !defined(SIMDE_ARM_NEON_RECPS_H)
28 #define SIMDE_ARM_NEON_RECPS_H
29
30 #include "dup_n.h"
31 #include "mls.h"
32 #include "types.h"
33
34 HEDLEY_DIAGNOSTIC_PUSH
35 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
36 SIMDE_BEGIN_DECLS_
37
38 SIMDE_FUNCTION_ATTRIBUTES
39 simde_float32_t
40 simde_vrecpss_f32(simde_float32_t a, simde_float32_t b) {
41 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
42 return vrecpss_f32(a, b);
43 #else
44 return SIMDE_FLOAT32_C(2.0) - (a * b);
45 #endif
46 }
47 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
48 #undef vrecpss_f32
49 #define vrecpss_f32(a, b) simde_vrecpss_f32((a), (b))
50 #endif
51
52 SIMDE_FUNCTION_ATTRIBUTES
53 simde_float64_t
54 simde_vrecpsd_f64(simde_float64_t a, simde_float64_t b) {
55 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
56 return vrecpsd_f64(a, b);
57 #else
58 return SIMDE_FLOAT64_C(2.0) - (a * b);
59 #endif
60 }
61 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
62 #undef vrecpsd_f64
63 #define vrecpsd_f64(a, b) simde_vrecpsd_f64((a), (b))
64 #endif
65
66 SIMDE_FUNCTION_ATTRIBUTES
67 simde_float64x1_t
68 simde_vrecps_f64(simde_float64x1_t a, simde_float64x1_t b) {
69 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
70 return vrecps_f64(a, b);
71 #else
72 return simde_vmls_f64(simde_vdup_n_f64(SIMDE_FLOAT64_C(2.0)), a, b);
73 #endif
74 }
75 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
76 #undef vrecps_f64
77 #define vrecps_f64(a, b) simde_vrecps_f64((a), (b))
78 #endif
79
80 SIMDE_FUNCTION_ATTRIBUTES
81 simde_float32x2_t
82 simde_vrecps_f32(simde_float32x2_t a, simde_float32x2_t b) {
83 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
84 return vrecps_f32(a, b);
85 #else
86 return simde_vmls_f32(simde_vdup_n_f32(SIMDE_FLOAT32_C(2.0)), a, b);
87 #endif
88 }
89 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
90 #undef vrecps_f32
91 #define vrecps_f32(a, b) simde_vrecps_f32((a), (b))
92 #endif
93
94 SIMDE_FUNCTION_ATTRIBUTES
95 simde_float64x2_t
96 simde_vrecpsq_f64(simde_float64x2_t a, simde_float64x2_t b) {
97 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
98 return vrecpsq_f64(a, b);
99 #else
100 return simde_vmlsq_f64(simde_vdupq_n_f64(SIMDE_FLOAT64_C(2.0)), a, b);
101 #endif
102 }
103 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
104 #undef vrecpsq_f64
105 #define vrecpsq_f64(a, b) simde_vrecpsq_f64((a), (b))
106 #endif
107
108 SIMDE_FUNCTION_ATTRIBUTES
109 simde_float32x4_t
110 simde_vrecpsq_f32(simde_float32x4_t a, simde_float32x4_t b) {
111 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
112 return vrecpsq_f32(a, b);
113 #else
114 return simde_vmlsq_f32(simde_vdupq_n_f32(SIMDE_FLOAT32_C(2.0)), a, b);
115 #endif
116 }
117 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
118 #undef vrecpsq_f32
119 #define vrecpsq_f32(a, b) simde_vrecpsq_f32((a), (b))
120 #endif
121
122 SIMDE_END_DECLS_
123 HEDLEY_DIAGNOSTIC_POP
124 #endif /* !defined(SIMDE_ARM_NEON_RECPS_H) */