Debian Codegraph @

third-party/simde/arm/neon/mul_n.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 Sean Maher <[email protected]> (Copyright owned by Google, LLC)
26 */
27
28 #if !defined(SIMDE_ARM_NEON_MUL_N_H)
29 #define SIMDE_ARM_NEON_MUL_N_H
30
31 #include "types.h"
32 #include "mul.h"
33 #include "dup_n.h"
34
35 HEDLEY_DIAGNOSTIC_PUSH
36 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
37 SIMDE_BEGIN_DECLS_
38
39 SIMDE_FUNCTION_ATTRIBUTES
40 simde_float32x2_t
41 simde_vmul_n_f32(simde_float32x2_t a, simde_float32 b) {
42 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
43 return vmul_n_f32(a, b);
44 #else
45 return simde_vmul_f32(a, simde_vdup_n_f32(b));
46 #endif
47 }
48 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
49 #undef vmul_n_f32
50 #define vmul_n_f32(a, b) simde_vmul_n_f32((a), (b))
51 #endif
52
53 SIMDE_FUNCTION_ATTRIBUTES
54 simde_float64x1_t
55 simde_vmul_n_f64(simde_float64x1_t a, simde_float64 b) {
56 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
57 return vmul_n_f64(a, b);
58 #else
59 return simde_vmul_f64(a, simde_vdup_n_f64(b));
60 #endif
61 }
62 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
63 #undef vmul_n_f64
64 #define vmul_n_f64(a, b) simde_vmul_n_f64((a), (b))
65 #endif
66
67 SIMDE_FUNCTION_ATTRIBUTES
68 simde_int16x4_t
69 simde_vmul_n_s16(simde_int16x4_t a, int16_t b) {
70 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
71 return vmul_n_s16(a, b);
72 #else
73 return simde_vmul_s16(a, simde_vdup_n_s16(b));
74 #endif
75 }
76 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
77 #undef vmul_n_s16
78 #define vmul_n_s16(a, b) simde_vmul_n_s16((a), (b))
79 #endif
80
81 SIMDE_FUNCTION_ATTRIBUTES
82 simde_int32x2_t
83 simde_vmul_n_s32(simde_int32x2_t a, int32_t b) {
84 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
85 return vmul_n_s32(a, b);
86 #else
87 return simde_vmul_s32(a, simde_vdup_n_s32(b));
88 #endif
89 }
90 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
91 #undef vmul_n_s32
92 #define vmul_n_s32(a, b) simde_vmul_n_s32((a), (b))
93 #endif
94
95 SIMDE_FUNCTION_ATTRIBUTES
96 simde_uint16x4_t
97 simde_vmul_n_u16(simde_uint16x4_t a, uint16_t b) {
98 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
99 return vmul_n_u16(a, b);
100 #else
101 return simde_vmul_u16(a, simde_vdup_n_u16(b));
102 #endif
103 }
104 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
105 #undef vmul_n_u16
106 #define vmul_n_u16(a, b) simde_vmul_n_u16((a), (b))
107 #endif
108
109 SIMDE_FUNCTION_ATTRIBUTES
110 simde_uint32x2_t
111 simde_vmul_n_u32(simde_uint32x2_t a, uint32_t b) {
112 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
113 return vmul_n_u32(a, b);
114 #else
115 return simde_vmul_u32(a, simde_vdup_n_u32(b));
116 #endif
117 }
118 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
119 #undef vmul_n_u32
120 #define vmul_n_u32(a, b) simde_vmul_n_u32((a), (b))
121 #endif
122
123 SIMDE_FUNCTION_ATTRIBUTES
124 simde_float32x4_t
125 simde_vmulq_n_f32(simde_float32x4_t a, simde_float32 b) {
126 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
127 return vmulq_n_f32(a, b);
128 #else
129 return simde_vmulq_f32(a, simde_vdupq_n_f32(b));
130 #endif
131 }
132 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
133 #undef vmulq_n_f32
134 #define vmulq_n_f32(a, b) simde_vmulq_n_f32((a), (b))
135 #endif
136
137 SIMDE_FUNCTION_ATTRIBUTES
138 simde_float64x2_t
139 simde_vmulq_n_f64(simde_float64x2_t a, simde_float64 b) {
140 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
141 return vmulq_n_f64(a, b);
142 #else
143 return simde_vmulq_f64(a, simde_vdupq_n_f64(b));
144 #endif
145 }
146 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
147 #undef vmulq_n_f64
148 #define vmulq_n_f64(a, b) simde_vmulq_n_f64((a), (b))
149 #endif
150
151 SIMDE_FUNCTION_ATTRIBUTES
152 simde_int16x8_t
153 simde_vmulq_n_s16(simde_int16x8_t a, int16_t b) {
154 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
155 return vmulq_n_s16(a, b);
156 #else
157 return simde_vmulq_s16(a, simde_vdupq_n_s16(b));
158 #endif
159 }
160 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
161 #undef vmulq_n_s16
162 #define vmulq_n_s16(a, b) simde_vmulq_n_s16((a), (b))
163 #endif
164
165 SIMDE_FUNCTION_ATTRIBUTES
166 simde_int32x4_t
167 simde_vmulq_n_s32(simde_int32x4_t a, int32_t b) {
168 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
169 return vmulq_n_s32(a, b);
170 #else
171 return simde_vmulq_s32(a, simde_vdupq_n_s32(b));
172 #endif
173 }
174 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
175 #undef vmulq_n_s32
176 #define vmulq_n_s32(a, b) simde_vmulq_n_s32((a), (b))
177 #endif
178
179 SIMDE_FUNCTION_ATTRIBUTES
180 simde_uint16x8_t
181 simde_vmulq_n_u16(simde_uint16x8_t a, uint16_t b) {
182 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
183 return vmulq_n_u16(a, b);
184 #else
185 return simde_vmulq_u16(a, simde_vdupq_n_u16(b));
186 #endif
187 }
188 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
189 #undef vmulq_n_u16
190 #define vmulq_n_u16(a, b) simde_vmulq_n_u16((a), (b))
191 #endif
192
193 SIMDE_FUNCTION_ATTRIBUTES
194 simde_uint32x4_t
195 simde_vmulq_n_u32(simde_uint32x4_t a, uint32_t b) {
196 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
197 return vmulq_n_u32(a, b);
198 #else
199 return simde_vmulq_u32(a, simde_vdupq_n_u32(b));
200 #endif
201 }
202 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
203 #undef vmulq_n_u32
204 #define vmulq_n_u32(a, b) simde_vmulq_n_u32((a), (b))
205 #endif
206
207 SIMDE_END_DECLS_
208 HEDLEY_DIAGNOSTIC_POP
209
210 #endif /* !defined(SIMDE_ARM_NEON_MUL_N_H) */