Debian Codegraph @

third-party/simde/arm/neon/qrdmulh_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_QRDMULH_N_H)
29 #define SIMDE_ARM_NEON_QRDMULH_N_H
30
31 #include "types.h"
32
33 #include "combine.h"
34 #include "qrdmulh.h"
35
36 HEDLEY_DIAGNOSTIC_PUSH
37 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
38 SIMDE_BEGIN_DECLS_
39
40 SIMDE_FUNCTION_ATTRIBUTES
41 simde_int16x4_t
42 simde_vqrdmulh_n_s16(simde_int16x4_t a, int16_t b) {
43 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
44 return vqrdmulh_n_s16(a, b);
45 #else
46 simde_int16x4_private
47 r_,
48 a_ = simde_int16x4_to_private(a);
49
50
51 SIMDE_VECTORIZE
52 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
53 r_.values[i] = simde_vqrdmulhh_s16(a_.values[i], b);
54 }
55
56 return simde_int16x4_from_private(r_);
57 #endif
58 }
59 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
60 #undef vqrdmulh_n_s16
61 #define vqrdmulh_n_s16(a, b) simde_vqrdmulh_n_s16((a), (b))
62 #endif
63
64 SIMDE_FUNCTION_ATTRIBUTES
65 simde_int32x2_t
66 simde_vqrdmulh_n_s32(simde_int32x2_t a, int32_t b) {
67 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
68 return vqrdmulh_n_s32(a, b);
69 #else
70 simde_int32x2_private
71 r_,
72 a_ = simde_int32x2_to_private(a);
73
74 SIMDE_VECTORIZE
75 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
76 r_.values[i] = simde_vqrdmulhs_s32(a_.values[i], b);
77 }
78
79 return simde_int32x2_from_private(r_);
80 #endif
81 }
82 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
83 #undef vqrdmulh_n_s32
84 #define vqrdmulh_n_s32(a, b) simde_vqrdmulh_n_s32((a), (b))
85 #endif
86
87 SIMDE_FUNCTION_ATTRIBUTES
88 simde_int16x8_t
89 simde_vqrdmulhq_n_s16(simde_int16x8_t a, int16_t b) {
90 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
91 return vqrdmulhq_n_s16(a, b);
92 #else
93 simde_int16x8_private
94 r_,
95 a_ = simde_int16x8_to_private(a);
96
97 SIMDE_VECTORIZE
98 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
99 r_.values[i] = simde_vqrdmulhh_s16(a_.values[i], b);
100 }
101
102 return simde_int16x8_from_private(r_);
103 #endif
104 }
105 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
106 #undef vqrdmulhq_n_s16
107 #define vqrdmulhq_n_s16(a, b) simde_vqrdmulhq_n_s16((a), (b))
108 #endif
109
110 SIMDE_FUNCTION_ATTRIBUTES
111 simde_int32x4_t
112 simde_vqrdmulhq_n_s32(simde_int32x4_t a, int32_t b) {
113 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
114 return vqrdmulhq_n_s32(a, b);
115 #else
116 simde_int32x4_private
117 r_,
118 a_ = simde_int32x4_to_private(a);
119
120 SIMDE_VECTORIZE
121 for (size_t i = 0 ; i < (sizeof(r_.values) / sizeof(r_.values[0])) ; i++) {
122 r_.values[i] = simde_vqrdmulhs_s32(a_.values[i], b);
123 }
124
125 return simde_int32x4_from_private(r_);
126 #endif
127 }
128 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
129 #undef vqrdmulhq_n_s32
130 #define vqrdmulhq_n_s32(a, b) simde_vqrdmulhq_n_s32((a), (b))
131 #endif
132
133 SIMDE_END_DECLS_
134 HEDLEY_DIAGNOSTIC_POP
135
136 #endif /* !defined(SIMDE_ARM_NEON_QRDMULH_H) */