Debian Codegraph @

third-party/simde/arm/neon/cmla_rot90.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 * 2021 Atharva Nimbalkar <[email protected]>
25 */
26
27 #if !defined(SIMDE_ARM_NEON_CMLA_ROT90_H)
28 #define SIMDE_ARM_NEON_CMLA_ROT90_H
29
30 #include "types.h"
31
32 HEDLEY_DIAGNOSTIC_PUSH
33 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
34 SIMDE_BEGIN_DECLS_
35
36 SIMDE_FUNCTION_ATTRIBUTES
37 simde_float32x2_t
38 simde_vcmla_rot90_f32(simde_float32x2_t r, simde_float32x2_t a, simde_float32x2_t b) {
39 #if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && SIMDE_ARCH_ARM_CHECK(8,3) && \
40 (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(9,0,0)) && \
41 (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(12,0,0))
42 return vcmla_rot90_f32(r, a, b);
43 #else
44 simde_float32x2_private
45 r_ = simde_float32x2_to_private(r),
46 a_ = simde_float32x2_to_private(a),
47 b_ = simde_float32x2_to_private(b);
48
49 #if defined(SIMDE_SHUFFLE_VECTOR_) && !defined(SIMDE_BUG_GCC_100760)
50 a_.values = SIMDE_SHUFFLE_VECTOR_(32, 8, a_.values, a_.values, 1, 1);
51 b_.values = SIMDE_SHUFFLE_VECTOR_(32, 8, -b_.values, b_.values, 1, 2);
52 r_.values += b_.values * a_.values;
53 #else
54 SIMDE_VECTORIZE
55 for (size_t i = 0 ; i < (sizeof(r_.values) / (2 * sizeof(r_.values[0]))) ; i++) {
56 r_.values[2 * i] += -(b_.values[2 * i + 1]) * a_.values[2 * i + 1];
57 r_.values[2 * i + 1] += b_.values[2 * i] * a_.values[2 * i + 1];
58 }
59 #endif
60
61 return simde_float32x2_from_private(r_);
62 #endif
63 }
64 #if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
65 #undef vcmla_rot90_f32
66 #define vcmla_rot90_f32(r, a, b) simde_vcmla_rot90_f32(r, a, b)
67 #endif
68
69 SIMDE_FUNCTION_ATTRIBUTES
70 simde_float32x4_t
71 simde_vcmlaq_rot90_f32(simde_float32x4_t r, simde_float32x4_t a, simde_float32x4_t b) {
72 #if defined(SIMDE_ARM_NEON_A32V8_NATIVE) && SIMDE_ARCH_ARM_CHECK(8,3) && \
73 (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(9,0,0)) && \
74 (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(12,0,0))
75 return vcmlaq_rot90_f32(r, a, b);
76 #else
77 simde_float32x4_private
78 r_ = simde_float32x4_to_private(r),
79 a_ = simde_float32x4_to_private(a),
80 b_ = simde_float32x4_to_private(b);
81
82 #if defined(SIMDE_SHUFFLE_VECTOR_)
83 a_.values = SIMDE_SHUFFLE_VECTOR_(32, 16, a_.values, a_.values, 1, 1, 3, 3);
84 b_.values = SIMDE_SHUFFLE_VECTOR_(32, 16, -b_.values, b_.values, 1, 4, 3, 6);
85 r_.values += b_.values * a_.values;
86 #else
87 SIMDE_VECTORIZE
88 for (size_t i = 0 ; i < (sizeof(r_.values) / (2 * sizeof(r_.values[0]))) ; i++) {
89 r_.values[2 * i] += -(b_.values[2 * i + 1]) * a_.values[2 * i + 1];
90 r_.values[2 * i + 1] += b_.values[2 * i] * a_.values[2 * i + 1];
91 }
92 #endif
93
94 return simde_float32x4_from_private(r_);
95 #endif
96 }
97 #if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
98 #undef vcmlaq_rot90_f32
99 #define vcmlaq_rot90_f32(r, a, b) simde_vcmlaq_rot90_f32(r, a, b)
100 #endif
101
102 SIMDE_FUNCTION_ATTRIBUTES
103 simde_float64x2_t
104 simde_vcmlaq_rot90_f64(simde_float64x2_t r, simde_float64x2_t a, simde_float64x2_t b) {
105 #if defined(SIMDE_ARM_NEON_A64V8_NATIVE) && SIMDE_ARCH_ARM_CHECK(8,3) && \
106 (!defined(HEDLEY_GCC_VERSION) || HEDLEY_GCC_VERSION_CHECK(9,0,0)) && \
107 (!defined(__clang__) || SIMDE_DETECT_CLANG_VERSION_CHECK(12,0,0))
108 return vcmlaq_rot90_f64(r, a, b);
109 #else
110 simde_float64x2_private
111 r_ = simde_float64x2_to_private(r),
112 a_ = simde_float64x2_to_private(a),
113 b_ = simde_float64x2_to_private(b);
114
115 #if defined(SIMDE_SHUFFLE_VECTOR_)
116 a_.values = SIMDE_SHUFFLE_VECTOR_(64, 16, a_.values, a_.values, 1, 1);
117 b_.values = SIMDE_SHUFFLE_VECTOR_(64, 16, -b_.values, b_.values, 1, 2);
118 r_.values += b_.values * a_.values;
119 #else
120 SIMDE_VECTORIZE
121 for (size_t i = 0 ; i < (sizeof(r_.values) / (2 * sizeof(r_.values[0]))) ; i++) {
122 r_.values[2 * i] += -(b_.values[2 * i + 1]) * a_.values[2 * i + 1];
123 r_.values[2 * i + 1] += b_.values[2 * i] * a_.values[2 * i + 1];
124 }
125 #endif
126
127 return simde_float64x2_from_private(r_);
128 #endif
129 }
130 #if defined(SIMDE_ARM_NEON_A32V8_ENABLE_NATIVE_ALIASES)
131 #undef vcmlaq_rot90_f64
132 #define vcmlaq_rot90_f64(r, a, b) simde_vcmlaq_rot90_f64(r, a, b)
133 #endif
134
135 SIMDE_END_DECLS_
136 HEDLEY_DIAGNOSTIC_POP
137
138 #endif /* !defined(SIMDE_ARM_NEON_CMLA_ROT90_H) */