| 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_MLS_H) |
| 28 |
#define SIMDE_ARM_NEON_MLS_H |
| 29 |
|
| 30 |
#include "mul.h" |
| 31 |
#include "sub.h" |
| 32 |
|
| 33 |
HEDLEY_DIAGNOSTIC_PUSH |
| 34 |
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS |
| 35 |
SIMDE_BEGIN_DECLS_ |
| 36 |
|
| 37 |
SIMDE_FUNCTION_ATTRIBUTES |
| 38 |
simde_float32x2_t |
| 39 |
simde_vmls_f32(simde_float32x2_t a, simde_float32x2_t b, simde_float32x2_t c) { |
| 40 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 41 |
return vmls_f32(a, b, c); |
| 42 |
#else |
| 43 |
return simde_vsub_f32(a, simde_vmul_f32(b, c)); |
| 44 |
#endif |
| 45 |
} |
| 46 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 47 |
#undef vmls_f32 |
| 48 |
#define vmls_f32(a, b, c) simde_vmls_f32((a), (b), (c)) |
| 49 |
#endif |
| 50 |
|
| 51 |
SIMDE_FUNCTION_ATTRIBUTES |
| 52 |
simde_float64x1_t |
| 53 |
simde_vmls_f64(simde_float64x1_t a, simde_float64x1_t b, simde_float64x1_t c) { |
| 54 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 55 |
return vmls_f64(a, b, c); |
| 56 |
#else |
| 57 |
return simde_vsub_f64(a, simde_vmul_f64(b, c)); |
| 58 |
#endif |
| 59 |
} |
| 60 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 61 |
#undef vmls_f64 |
| 62 |
#define vmls_f64(a, b, c) simde_vmls_f64((a), (b), (c)) |
| 63 |
#endif |
| 64 |
|
| 65 |
SIMDE_FUNCTION_ATTRIBUTES |
| 66 |
simde_int8x8_t |
| 67 |
simde_vmls_s8(simde_int8x8_t a, simde_int8x8_t b, simde_int8x8_t c) { |
| 68 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 69 |
return vmls_s8(a, b, c); |
| 70 |
#else |
| 71 |
return simde_vsub_s8(a, simde_vmul_s8(b, c)); |
| 72 |
#endif |
| 73 |
} |
| 74 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 75 |
#undef vmls_s8 |
| 76 |
#define vmls_s8(a, b, c) simde_vmls_s8((a), (b), (c)) |
| 77 |
#endif |
| 78 |
|
| 79 |
SIMDE_FUNCTION_ATTRIBUTES |
| 80 |
simde_int16x4_t |
| 81 |
simde_vmls_s16(simde_int16x4_t a, simde_int16x4_t b, simde_int16x4_t c) { |
| 82 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 83 |
return vmls_s16(a, b, c); |
| 84 |
#else |
| 85 |
return simde_vsub_s16(a, simde_vmul_s16(b, c)); |
| 86 |
#endif |
| 87 |
} |
| 88 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 89 |
#undef vmls_s16 |
| 90 |
#define vmls_s16(a, b, c) simde_vmls_s16((a), (b), (c)) |
| 91 |
#endif |
| 92 |
|
| 93 |
SIMDE_FUNCTION_ATTRIBUTES |
| 94 |
simde_int32x2_t |
| 95 |
simde_vmls_s32(simde_int32x2_t a, simde_int32x2_t b, simde_int32x2_t c) { |
| 96 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 97 |
return vmls_s32(a, b, c); |
| 98 |
#else |
| 99 |
return simde_vsub_s32(a, simde_vmul_s32(b, c)); |
| 100 |
#endif |
| 101 |
} |
| 102 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 103 |
#undef vmls_s32 |
| 104 |
#define vmls_s32(a, b, c) simde_vmls_s32((a), (b), (c)) |
| 105 |
#endif |
| 106 |
|
| 107 |
SIMDE_FUNCTION_ATTRIBUTES |
| 108 |
simde_uint8x8_t |
| 109 |
simde_vmls_u8(simde_uint8x8_t a, simde_uint8x8_t b, simde_uint8x8_t c) { |
| 110 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 111 |
return vmls_u8(a, b, c); |
| 112 |
#else |
| 113 |
return simde_vsub_u8(a, simde_vmul_u8(b, c)); |
| 114 |
#endif |
| 115 |
} |
| 116 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 117 |
#undef vmls_u8 |
| 118 |
#define vmls_u8(a, b, c) simde_vmls_u8((a), (b), (c)) |
| 119 |
#endif |
| 120 |
|
| 121 |
SIMDE_FUNCTION_ATTRIBUTES |
| 122 |
simde_uint16x4_t |
| 123 |
simde_vmls_u16(simde_uint16x4_t a, simde_uint16x4_t b, simde_uint16x4_t c) { |
| 124 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 125 |
return vmls_u16(a, b, c); |
| 126 |
#else |
| 127 |
return simde_vsub_u16(a, simde_vmul_u16(b, c)); |
| 128 |
#endif |
| 129 |
} |
| 130 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 131 |
#undef vmls_u16 |
| 132 |
#define vmls_u16(a, b, c) simde_vmls_u16((a), (b), (c)) |
| 133 |
#endif |
| 134 |
|
| 135 |
SIMDE_FUNCTION_ATTRIBUTES |
| 136 |
simde_uint32x2_t |
| 137 |
simde_vmls_u32(simde_uint32x2_t a, simde_uint32x2_t b, simde_uint32x2_t c) { |
| 138 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 139 |
return vmls_u32(a, b, c); |
| 140 |
#else |
| 141 |
return simde_vsub_u32(a, simde_vmul_u32(b, c)); |
| 142 |
#endif |
| 143 |
} |
| 144 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 145 |
#undef vmls_u32 |
| 146 |
#define vmls_u32(a, b, c) simde_vmls_u32((a), (b), (c)) |
| 147 |
#endif |
| 148 |
|
| 149 |
SIMDE_FUNCTION_ATTRIBUTES |
| 150 |
simde_float32x4_t |
| 151 |
simde_vmlsq_f32(simde_float32x4_t a, simde_float32x4_t b, simde_float32x4_t c) { |
| 152 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 153 |
return vmlsq_f32(a, b, c); |
| 154 |
#elif \ |
| 155 |
defined(SIMDE_X86_FMA_NATIVE) |
| 156 |
simde_float32x4_private |
| 157 |
r_, |
| 158 |
a_ = simde_float32x4_to_private(a), |
| 159 |
b_ = simde_float32x4_to_private(b), |
| 160 |
c_ = simde_float32x4_to_private(c); |
| 161 |
|
| 162 |
#if defined(SIMDE_X86_FMA_NATIVE) |
| 163 |
r_.m128 = _mm_fnmadd_ps(b_.m128, c_.m128, a_.m128); |
| 164 |
#endif |
| 165 |
|
| 166 |
return simde_float32x4_from_private(r_); |
| 167 |
#else |
| 168 |
return simde_vsubq_f32(a, simde_vmulq_f32(b, c)); |
| 169 |
#endif |
| 170 |
} |
| 171 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 172 |
#undef vmlsq_f32 |
| 173 |
#define vmlsq_f32(a, b, c) simde_vmlsq_f32((a), (b), (c)) |
| 174 |
#endif |
| 175 |
|
| 176 |
SIMDE_FUNCTION_ATTRIBUTES |
| 177 |
simde_float64x2_t |
| 178 |
simde_vmlsq_f64(simde_float64x2_t a, simde_float64x2_t b, simde_float64x2_t c) { |
| 179 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 180 |
return vmlsq_f64(a, b, c); |
| 181 |
#elif \ |
| 182 |
defined(SIMDE_X86_FMA_NATIVE) |
| 183 |
simde_float64x2_private |
| 184 |
r_, |
| 185 |
a_ = simde_float64x2_to_private(a), |
| 186 |
b_ = simde_float64x2_to_private(b), |
| 187 |
c_ = simde_float64x2_to_private(c); |
| 188 |
|
| 189 |
#if defined(SIMDE_X86_FMA_NATIVE) |
| 190 |
r_.m128d = _mm_fnmadd_pd(b_.m128d, c_.m128d, a_.m128d); |
| 191 |
#endif |
| 192 |
|
| 193 |
return simde_float64x2_from_private(r_); |
| 194 |
#else |
| 195 |
return simde_vsubq_f64(a, simde_vmulq_f64(b, c)); |
| 196 |
#endif |
| 197 |
} |
| 198 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 199 |
#undef vmlsq_f64 |
| 200 |
#define vmlsq_f64(a, b, c) simde_vmlsq_f64((a), (b), (c)) |
| 201 |
#endif |
| 202 |
|
| 203 |
SIMDE_FUNCTION_ATTRIBUTES |
| 204 |
simde_int8x16_t |
| 205 |
simde_vmlsq_s8(simde_int8x16_t a, simde_int8x16_t b, simde_int8x16_t c) { |
| 206 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 207 |
return vmlsq_s8(a, b, c); |
| 208 |
#else |
| 209 |
return simde_vsubq_s8(a, simde_vmulq_s8(b, c)); |
| 210 |
#endif |
| 211 |
} |
| 212 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 213 |
#undef vmlsq_s8 |
| 214 |
#define vmlsq_s8(a, b, c) simde_vmlsq_s8((a), (b), (c)) |
| 215 |
#endif |
| 216 |
|
| 217 |
SIMDE_FUNCTION_ATTRIBUTES |
| 218 |
simde_int16x8_t |
| 219 |
simde_vmlsq_s16(simde_int16x8_t a, simde_int16x8_t b, simde_int16x8_t c) { |
| 220 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 221 |
return vmlsq_s16(a, b, c); |
| 222 |
#else |
| 223 |
return simde_vsubq_s16(a, simde_vmulq_s16(b, c)); |
| 224 |
#endif |
| 225 |
} |
| 226 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 227 |
#undef vmlsq_s16 |
| 228 |
#define vmlsq_s16(a, b, c) simde_vmlsq_s16((a), (b), (c)) |
| 229 |
#endif |
| 230 |
|
| 231 |
SIMDE_FUNCTION_ATTRIBUTES |
| 232 |
simde_int32x4_t |
| 233 |
simde_vmlsq_s32(simde_int32x4_t a, simde_int32x4_t b, simde_int32x4_t c) { |
| 234 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 235 |
return vmlsq_s32(a, b, c); |
| 236 |
#else |
| 237 |
return simde_vsubq_s32(a, simde_vmulq_s32(b, c)); |
| 238 |
#endif |
| 239 |
} |
| 240 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 241 |
#undef vmlsq_s32 |
| 242 |
#define vmlsq_s32(a, b, c) simde_vmlsq_s32((a), (b), (c)) |
| 243 |
#endif |
| 244 |
|
| 245 |
SIMDE_FUNCTION_ATTRIBUTES |
| 246 |
simde_uint8x16_t |
| 247 |
simde_vmlsq_u8(simde_uint8x16_t a, simde_uint8x16_t b, simde_uint8x16_t c) { |
| 248 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 249 |
return vmlsq_u8(a, b, c); |
| 250 |
#else |
| 251 |
return simde_vsubq_u8(a, simde_vmulq_u8(b, c)); |
| 252 |
#endif |
| 253 |
} |
| 254 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 255 |
#undef vmlsq_u8 |
| 256 |
#define vmlsq_u8(a, b, c) simde_vmlsq_u8((a), (b), (c)) |
| 257 |
#endif |
| 258 |
|
| 259 |
SIMDE_FUNCTION_ATTRIBUTES |
| 260 |
simde_uint16x8_t |
| 261 |
simde_vmlsq_u16(simde_uint16x8_t a, simde_uint16x8_t b, simde_uint16x8_t c) { |
| 262 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 263 |
return vmlsq_u16(a, b, c); |
| 264 |
#else |
| 265 |
return simde_vsubq_u16(a, simde_vmulq_u16(b, c)); |
| 266 |
#endif |
| 267 |
} |
| 268 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 269 |
#undef vmlsq_u16 |
| 270 |
#define vmlsq_u16(a, b, c) simde_vmlsq_u16((a), (b), (c)) |
| 271 |
#endif |
| 272 |
|
| 273 |
SIMDE_FUNCTION_ATTRIBUTES |
| 274 |
simde_uint32x4_t |
| 275 |
simde_vmlsq_u32(simde_uint32x4_t a, simde_uint32x4_t b, simde_uint32x4_t c) { |
| 276 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 277 |
return vmlsq_u32(a, b, c); |
| 278 |
#else |
| 279 |
return simde_vsubq_u32(a, simde_vmulq_u32(b, c)); |
| 280 |
#endif |
| 281 |
} |
| 282 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 283 |
#undef vmlsq_u32 |
| 284 |
#define vmlsq_u32(a, b, c) simde_vmlsq_u32((a), (b), (c)) |
| 285 |
#endif |
| 286 |
|
| 287 |
SIMDE_END_DECLS_ |
| 288 |
HEDLEY_DIAGNOSTIC_POP |
| 289 |
|
| 290 |
#endif /* !defined(SIMDE_ARM_NEON_MLS_H) */ |