Debian Codegraph @

third-party/simde/arm/neon/mlal_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 * 2020 Sean Maher <[email protected]> (Copyright owned by Google, LLC)
26 */
27
28 #if !defined(SIMDE_ARM_NEON_MLAL_HIGH_H)
29 #define SIMDE_ARM_NEON_MLAL_HIGH_H
30
31 #include "movl_high.h"
32 #include "mla.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 simde_int16x8_t
41 simde_vmlal_high_s8(simde_int16x8_t a, simde_int8x16_t b, simde_int8x16_t c) {
42 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
43 return vmlal_high_s8(a, b, c);
44 #else
45 return simde_vmlaq_s16(a, simde_vmovl_high_s8(b), simde_vmovl_high_s8(c));
46 #endif
47 }
48 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
49 #undef vmlal_high_s8
50 #define vmlal_high_s8(a, b, c) simde_vmlal_high_s8((a), (b), (c))
51 #endif
52
53 SIMDE_FUNCTION_ATTRIBUTES
54 simde_int32x4_t
55 simde_vmlal_high_s16(simde_int32x4_t a, simde_int16x8_t b, simde_int16x8_t c) {
56 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
57 return vmlal_high_s16(a, b, c);
58 #else
59 return simde_vmlaq_s32(a, simde_vmovl_high_s16(b), simde_vmovl_high_s16(c));
60 #endif
61 }
62 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
63 #undef vmlal_high_s16
64 #define vmlal_high_s16(a, b, c) simde_vmlal_high_s16((a), (b), (c))
65 #endif
66
67 SIMDE_FUNCTION_ATTRIBUTES
68 simde_int64x2_t
69 simde_vmlal_high_s32(simde_int64x2_t a, simde_int32x4_t b, simde_int32x4_t c) {
70 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
71 return vmlal_high_s32(a, b, c);
72 #else
73 simde_int64x2_private
74 r_,
75 a_ = simde_int64x2_to_private(a),
76 b_ = simde_int64x2_to_private(simde_vmovl_high_s32(b)),
77 c_ = simde_int64x2_to_private(simde_vmovl_high_s32(c));
78
79 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
80 r_.values = (b_.values * c_.values) + a_.values;
81 #else
82 SIMDE_VECTORIZE
83 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
84 r_.values[i] = (b_.values[i] * c_.values[i]) + a_.values[i];
85 }
86 #endif
87
88 return simde_int64x2_from_private(r_);
89 #endif
90 }
91 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
92 #undef vmlal_high_s32
93 #define vmlal_high_s32(a, b, c) simde_vmlal_high_s32((a), (b), (c))
94 #endif
95
96 SIMDE_FUNCTION_ATTRIBUTES
97 simde_uint16x8_t
98 simde_vmlal_high_u8(simde_uint16x8_t a, simde_uint8x16_t b, simde_uint8x16_t c) {
99 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
100 return vmlal_high_u8(a, b, c);
101 #else
102 return simde_vmlaq_u16(a, simde_vmovl_high_u8(b), simde_vmovl_high_u8(c));
103 #endif
104 }
105 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
106 #undef vmlal_high_u8
107 #define vmlal_high_u8(a, b, c) simde_vmlal_high_u8((a), (b), (c))
108 #endif
109
110 SIMDE_FUNCTION_ATTRIBUTES
111 simde_uint32x4_t
112 simde_vmlal_high_u16(simde_uint32x4_t a, simde_uint16x8_t b, simde_uint16x8_t c) {
113 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
114 return vmlal_high_u16(a, b, c);
115 #else
116 return simde_vmlaq_u32(a, simde_vmovl_high_u16(b), simde_vmovl_high_u16(c));
117 #endif
118 }
119 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
120 #undef vmlal_high_u16
121 #define vmlal_high_u16(a, b, c) simde_vmlal_high_u16((a), (b), (c))
122 #endif
123
124 SIMDE_FUNCTION_ATTRIBUTES
125 simde_uint64x2_t
126 simde_vmlal_high_u32(simde_uint64x2_t a, simde_uint32x4_t b, simde_uint32x4_t c) {
127 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE)
128 return vmlal_high_u32(a, b, c);
129 #else
130 simde_uint64x2_private
131 r_,
132 a_ = simde_uint64x2_to_private(a),
133 b_ = simde_uint64x2_to_private(simde_vmovl_high_u32(b)),
134 c_ = simde_uint64x2_to_private(simde_vmovl_high_u32(c));
135
136 #if defined(SIMDE_VECTOR_SUBSCRIPT_OPS)
137 r_.values = (b_.values * c_.values) + a_.values;
138 #else
139 SIMDE_VECTORIZE
140 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
141 r_.values[i] = (b_.values[i] * c_.values[i]) + a_.values[i];
142 }
143 #endif
144
145 return simde_uint64x2_from_private(r_);
146 #endif
147 }
148 #if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES)
149 #undef vmlal_high_u32
150 #define vmlal_high_u32(a, b, c) simde_vmlal_high_u32((a), (b), (c))
151 #endif
152
153 SIMDE_END_DECLS_
154 HEDLEY_DIAGNOSTIC_POP
155
156 #endif /* !defined(SIMDE_ARM_NEON_MLAL_HIGH_H) */