Debian Codegraph @

third-party/simde/arm/neon/addw_high.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_ADDW_HIGH_H)
28 #define SIMDE_ARM_NEON_ADDW_HIGH_H
29
30 #include "types.h"
31 #include "movl_high.h"
32 #include "add.h"
33
34 HEDLEY_DIAGNOSTIC_PUSH
35 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
36 SIMDE_BEGIN_DECLS_
37
38 SIMDE_FUNCTION_ATTRIBUTES
39 simde_int16x8_t
40 simde_vaddw_high_s8(simde_int16x8_t a, simde_int8x16_t b) {
41 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
42 return vaddw_high_s8(a, b);
43 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
44 return simde_vaddq_s16(a, simde_vmovl_high_s8(b));
45 #else
46 simde_int16x8_private r_;
47 simde_int16x8_private a_ = simde_int16x8_to_private(a);
48 simde_int8x16_private b_ = simde_int8x16_to_private(b);
49
50 SIMDE_VECTORIZE
51 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
52 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
53 }
54
55 return simde_int16x8_from_private(r_);
56 #endif
57 }
58 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
59 #undef vaddw_high_s8
60 #define vaddw_high_s8(a, b) simde_vaddw_high_s8((a), (b))
61 #endif
62
63 SIMDE_FUNCTION_ATTRIBUTES
64 simde_int32x4_t
65 simde_vaddw_high_s16(simde_int32x4_t a, simde_int16x8_t b) {
66 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
67 return vaddw_high_s16(a, b);
68 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
69 return simde_vaddq_s32(a, simde_vmovl_high_s16(b));
70 #else
71 simde_int32x4_private r_;
72 simde_int32x4_private a_ = simde_int32x4_to_private(a);
73 simde_int16x8_private b_ = simde_int16x8_to_private(b);
74
75 SIMDE_VECTORIZE
76 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
77 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
78 }
79
80 return simde_int32x4_from_private(r_);
81 #endif
82 }
83 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
84 #undef vaddw_high_s16
85 #define vaddw_high_s16(a, b) simde_vaddw_high_s16((a), (b))
86 #endif
87
88 SIMDE_FUNCTION_ATTRIBUTES
89 simde_int64x2_t
90 simde_vaddw_high_s32(simde_int64x2_t a, simde_int32x4_t b) {
91 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
92 return vaddw_high_s32(a, b);
93 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
94 return simde_vaddq_s64(a, simde_vmovl_high_s32(b));
95 #else
96 simde_int64x2_private r_;
97 simde_int64x2_private a_ = simde_int64x2_to_private(a);
98 simde_int32x4_private b_ = simde_int32x4_to_private(b);
99
100 SIMDE_VECTORIZE
101 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
102 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
103 }
104
105 return simde_int64x2_from_private(r_);
106 #endif
107 }
108 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
109 #undef vaddw_high_s32
110 #define vaddw_high_s32(a, b) simde_vaddw_high_s32((a), (b))
111 #endif
112
113 SIMDE_FUNCTION_ATTRIBUTES
114 simde_uint16x8_t
115 simde_vaddw_high_u8(simde_uint16x8_t a, simde_uint8x16_t b) {
116 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
117 return vaddw_high_u8(a, b);
118 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
119 return simde_vaddq_u16(a, simde_vmovl_high_u8(b));
120 #else
121 simde_uint16x8_private r_;
122 simde_uint16x8_private a_ = simde_uint16x8_to_private(a);
123 simde_uint8x16_private b_ = simde_uint8x16_to_private(b);
124
125 SIMDE_VECTORIZE
126 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
127 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
128 }
129
130 return simde_uint16x8_from_private(r_);
131 #endif
132 }
133 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
134 #undef vaddw_high_u8
135 #define vaddw_high_u8(a, b) simde_vaddw_high_u8((a), (b))
136 #endif
137
138 SIMDE_FUNCTION_ATTRIBUTES
139 simde_uint32x4_t
140 simde_vaddw_high_u16(simde_uint32x4_t a, simde_uint16x8_t b) {
141 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
142 return vaddw_high_u16(a, b);
143 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
144 return simde_vaddq_u32(a, simde_vmovl_high_u16(b));
145 #else
146 simde_uint32x4_private r_;
147 simde_uint32x4_private a_ = simde_uint32x4_to_private(a);
148 simde_uint16x8_private b_ = simde_uint16x8_to_private(b);
149
150 SIMDE_VECTORIZE
151 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
152 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
153 }
154
155 return simde_uint32x4_from_private(r_);
156 #endif
157 }
158 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
159 #undef vaddw_high_u16
160 #define vaddw_high_u16(a, b) simde_vaddw_high_u16((a), (b))
161 #endif
162
163 SIMDE_FUNCTION_ATTRIBUTES
164 simde_uint64x2_t
165 simde_vaddw_high_u32(simde_uint64x2_t a, simde_uint32x4_t b) {
166 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
167 return vaddw_high_u32(a, b);
168 #elif SIMDE_NATURAL_VECTOR_SIZE_GE(128)
169 return simde_vaddq_u64(a, simde_vmovl_high_u32(b));
170 #else
171 simde_uint64x2_private r_;
172 simde_uint64x2_private a_ = simde_uint64x2_to_private(a);
173 simde_uint32x4_private b_ = simde_uint32x4_to_private(b);
174
175 SIMDE_VECTORIZE
176 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
177 r_.values[i] = a_.values[i] + b_.values[i + ((sizeof(b_.values) / sizeof(b_.values[0])) / 2)];
178 }
179
180 return simde_uint64x2_from_private(r_);
181 #endif
182 }
183 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
184 #undef vaddw_high_u32
185 #define vaddw_high_u32(a, b) simde_vaddw_high_u32((a), (b))
186 #endif
187
188 SIMDE_END_DECLS_
189 HEDLEY_DIAGNOSTIC_POP
190
191 #endif /* !defined(SIMDE_ARM_NEON_ADDW_HIGH_H) */