Debian Codegraph @

third-party/simde/arm/neon/movl.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_MOVL_H)
29 #define SIMDE_ARM_NEON_MOVL_H
30
31 #include "combine.h"
32
33 HEDLEY_DIAGNOSTIC_PUSH
34 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
35 SIMDE_BEGIN_DECLS_
36
37 SIMDE_FUNCTION_ATTRIBUTES
38 simde_int16x8_t
39 simde_vmovl_s8(simde_int8x8_t a) {
40 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
41 return vmovl_s8(a);
42 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
43 simde_int16x8_private r_;
44 simde_int8x16_private a_ = simde_int8x16_to_private(simde_vcombine_s8(a, a));
45
46 r_.v128 = wasm_i16x8_extend_low_i8x16(a_.v128);
47
48 return simde_int16x8_from_private(r_);
49 #else
50 simde_int16x8_private r_;
51 simde_int8x8_private a_ = simde_int8x8_to_private(a);
52
53 #if defined(SIMDE_CONVERT_VECTOR_) && !defined(SIMDE_BUG_GCC_100761)
54 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
55 #else
56 SIMDE_VECTORIZE
57 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
58 r_.values[i] = HEDLEY_STATIC_CAST(int16_t, a_.values[i]);
59 }
60 #endif
61
62 return simde_int16x8_from_private(r_);
63 #endif
64 }
65 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
66 #undef vmovl_s8
67 #define vmovl_s8(a) simde_vmovl_s8((a))
68 #endif
69
70 SIMDE_FUNCTION_ATTRIBUTES
71 simde_int32x4_t
72 simde_vmovl_s16(simde_int16x4_t a) {
73 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
74 return vmovl_s16(a);
75 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
76 simde_int32x4_private r_;
77 simde_int16x8_private a_ = simde_int16x8_to_private(simde_vcombine_s16(a, a));
78
79 r_.v128 = wasm_i32x4_extend_low_i16x8(a_.v128);
80
81 return simde_int32x4_from_private(r_);
82 #else
83 simde_int32x4_private r_;
84 simde_int16x4_private a_ = simde_int16x4_to_private(a);
85
86 #if defined(SIMDE_CONVERT_VECTOR_) && !defined(SIMDE_BUG_GCC_100761)
87 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
88 #else
89 SIMDE_VECTORIZE
90 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
91 r_.values[i] = HEDLEY_STATIC_CAST(int32_t, a_.values[i]);
92 }
93 #endif
94
95 return simde_int32x4_from_private(r_);
96 #endif
97 }
98 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
99 #undef vmovl_s16
100 #define vmovl_s16(a) simde_vmovl_s16((a))
101 #endif
102
103 SIMDE_FUNCTION_ATTRIBUTES
104 simde_int64x2_t
105 simde_vmovl_s32(simde_int32x2_t a) {
106 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
107 return vmovl_s32(a);
108 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
109 simde_int64x2_private r_;
110 simde_int32x4_private a_ = simde_int32x4_to_private(simde_vcombine_s32(a, a));
111
112 r_.v128 = wasm_i64x2_extend_low_i32x4(a_.v128);
113
114 return simde_int64x2_from_private(r_);
115 #else
116 simde_int64x2_private r_;
117 simde_int32x2_private a_ = simde_int32x2_to_private(a);
118
119 #if defined(SIMDE_CONVERT_VECTOR_)
120 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
121 #else
122 SIMDE_VECTORIZE
123 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
124 r_.values[i] = HEDLEY_STATIC_CAST(int64_t, a_.values[i]);
125 }
126 #endif
127
128 return simde_int64x2_from_private(r_);
129 #endif
130 }
131 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
132 #undef vmovl_s32
133 #define vmovl_s32(a) simde_vmovl_s32((a))
134 #endif
135
136 SIMDE_FUNCTION_ATTRIBUTES
137 simde_uint16x8_t
138 simde_vmovl_u8(simde_uint8x8_t a) {
139 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
140 return vmovl_u8(a);
141 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
142 simde_uint16x8_private r_;
143 simde_uint8x16_private a_ = simde_uint8x16_to_private(simde_vcombine_u8(a, a));
144
145 r_.v128 = wasm_u16x8_extend_low_u8x16(a_.v128);
146
147 return simde_uint16x8_from_private(r_);
148 #else
149 simde_uint16x8_private r_;
150 simde_uint8x8_private a_ = simde_uint8x8_to_private(a);
151
152 #if defined(SIMDE_CONVERT_VECTOR_) && !defined(SIMDE_BUG_GCC_100761)
153 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
154 #else
155 SIMDE_VECTORIZE
156 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
157 r_.values[i] = HEDLEY_STATIC_CAST(uint16_t, a_.values[i]);
158 }
159 #endif
160
161 return simde_uint16x8_from_private(r_);
162 #endif
163 }
164 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
165 #undef vmovl_u8
166 #define vmovl_u8(a) simde_vmovl_u8((a))
167 #endif
168
169 SIMDE_FUNCTION_ATTRIBUTES
170 simde_uint32x4_t
171 simde_vmovl_u16(simde_uint16x4_t a) {
172 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
173 return vmovl_u16(a);
174 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
175 simde_uint32x4_private r_;
176 simde_uint16x8_private a_ = simde_uint16x8_to_private(simde_vcombine_u16(a, a));
177
178 r_.v128 = wasm_u32x4_extend_low_u16x8(a_.v128);
179
180 return simde_uint32x4_from_private(r_);
181 #else
182 simde_uint32x4_private r_;
183 simde_uint16x4_private a_ = simde_uint16x4_to_private(a);
184
185 #if defined(SIMDE_CONVERT_VECTOR_) && !defined(SIMDE_BUG_GCC_100761)
186 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
187 #else
188 SIMDE_VECTORIZE
189 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
190 r_.values[i] = HEDLEY_STATIC_CAST(uint32_t, a_.values[i]);
191 }
192 #endif
193
194 return simde_uint32x4_from_private(r_);
195 #endif
196 }
197 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
198 #undef vmovl_u16
199 #define vmovl_u16(a) simde_vmovl_u16((a))
200 #endif
201
202 SIMDE_FUNCTION_ATTRIBUTES
203 simde_uint64x2_t
204 simde_vmovl_u32(simde_uint32x2_t a) {
205 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
206 return vmovl_u32(a);
207 #elif defined(SIMDE_WASM_SIMD128_NATIVE)
208 simde_uint64x2_private r_;
209 simde_uint32x4_private a_ = simde_uint32x4_to_private(simde_vcombine_u32(a, a));
210
211 r_.v128 = wasm_u64x2_extend_low_u32x4(a_.v128);
212
213 return simde_uint64x2_from_private(r_);
214 #else
215 simde_uint64x2_private r_;
216 simde_uint32x2_private a_ = simde_uint32x2_to_private(a);
217
218 #if defined(SIMDE_CONVERT_VECTOR_)
219 SIMDE_CONVERT_VECTOR_(r_.values, a_.values);
220 #else
221 SIMDE_VECTORIZE
222 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
223 r_.values[i] = HEDLEY_STATIC_CAST(uint64_t, a_.values[i]);
224 }
225 #endif
226
227 return simde_uint64x2_from_private(r_);
228 #endif
229 }
230 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
231 #undef vmovl_u32
232 #define vmovl_u32(a) simde_vmovl_u32((a))
233 #endif
234
235 SIMDE_END_DECLS_
236 HEDLEY_DIAGNOSTIC_POP
237
238 #endif /* !defined(SIMDE_ARM_NEON_MOVL_H) */