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 <evan@nemerson.com>
25  */
26 
27 #if !defined(SIMDE_ARM_NEON_MLSL_N_H)
28 #define SIMDE_ARM_NEON_MLSL_N_H
29 
30 #include "mull_n.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_int32x4_t
simde_vmlsl_n_s16(simde_int32x4_t a,simde_int16x4_t b,int16_t c)39 simde_vmlsl_n_s16(simde_int32x4_t a, simde_int16x4_t b, int16_t c) {
40   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
41     return vmlsl_n_s16(a, b, c);
42   #else
43     return simde_vsubq_s32(a, simde_vmull_n_s16(b, c));
44   #endif
45 }
46 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
47   #undef vmlsl_n_s16
48   #define vmlsl_n_s16(a, b, c) simde_vmlsl_n_s16((a), (b), (c))
49 #endif
50 
51 SIMDE_FUNCTION_ATTRIBUTES
52 simde_int64x2_t
simde_vmlsl_n_s32(simde_int64x2_t a,simde_int32x2_t b,int32_t c)53 simde_vmlsl_n_s32(simde_int64x2_t a, simde_int32x2_t b, int32_t c) {
54   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
55     return vmlsl_n_s32(a, b, c);
56   #else
57     return simde_vsubq_s64(a, simde_vmull_n_s32(b, c));
58   #endif
59 }
60 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
61   #undef vmlsl_n_s32
62   #define vmlsl_n_s32(a, b, c) simde_vmlsl_n_s32((a), (b), (c))
63 #endif
64 
65 SIMDE_FUNCTION_ATTRIBUTES
66 simde_uint32x4_t
simde_vmlsl_n_u16(simde_uint32x4_t a,simde_uint16x4_t b,uint16_t c)67 simde_vmlsl_n_u16(simde_uint32x4_t a, simde_uint16x4_t b, uint16_t c) {
68   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
69     return vmlsl_n_u16(a, b, c);
70   #else
71     return simde_vsubq_u32(a, simde_vmull_n_u16(b, c));
72   #endif
73 }
74 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
75   #undef vmlsl_n_u16
76   #define vmlsl_n_u16(a, b, c) simde_vmlsl_n_u16((a), (b), (c))
77 #endif
78 
79 SIMDE_FUNCTION_ATTRIBUTES
80 simde_uint64x2_t
simde_vmlsl_n_u32(simde_uint64x2_t a,simde_uint32x2_t b,uint32_t c)81 simde_vmlsl_n_u32(simde_uint64x2_t a, simde_uint32x2_t b, uint32_t c) {
82   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
83     return vmlsl_n_u32(a, b, c);
84   #else
85     return simde_vsubq_u64(a, simde_vmull_n_u32(b, c));
86   #endif
87 }
88 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
89   #undef vmlsl_n_u32
90   #define vmlsl_n_u32(a, b, c) simde_vmlsl_n_u32((a), (b), (c))
91 #endif
92 
93 SIMDE_END_DECLS_
94 HEDLEY_DIAGNOSTIC_POP
95 
96 #endif /* !defined(SIMDE_ARM_NEON_MLSL_N_H) */
97