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  *   2020      Sean Maher <seanptmaher@gmail.com> (Copyright owned by Google, LLC)
26  */
27 
28 #if !defined(SIMDE_ARM_NEON_SUBL_H)
29 #define SIMDE_ARM_NEON_SUBL_H
30 
31 #include "sub.h"
32 #include "movl.h"
33 #include "movl_high.h"
34 #include "types.h"
35 
36 HEDLEY_DIAGNOSTIC_PUSH
37 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
38 SIMDE_BEGIN_DECLS_
39 
40 SIMDE_FUNCTION_ATTRIBUTES
41 simde_int16x8_t
simde_vsubl_s8(simde_int8x8_t a,simde_int8x8_t b)42 simde_vsubl_s8(simde_int8x8_t a, simde_int8x8_t b) {
43   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
44     return vsubl_s8(a, b);
45   #else
46     return simde_vsubq_s16(simde_vmovl_s8(a), simde_vmovl_s8(b));
47   #endif
48 }
49 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
50   #undef vsubl_s8
51   #define vsubl_s8(a, b) simde_vsubl_s8((a), (b))
52 #endif
53 
54 SIMDE_FUNCTION_ATTRIBUTES
55 simde_int32x4_t
simde_vsubl_s16(simde_int16x4_t a,simde_int16x4_t b)56 simde_vsubl_s16(simde_int16x4_t a, simde_int16x4_t b) {
57   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
58     return vsubl_s16(a, b);
59   #else
60     return simde_vsubq_s32(simde_vmovl_s16(a), simde_vmovl_s16(b));
61   #endif
62 }
63 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
64   #undef vsubl_s16
65   #define vsubl_s16(a, b) simde_vsubl_s16((a), (b))
66 #endif
67 
68 SIMDE_FUNCTION_ATTRIBUTES
69 simde_int64x2_t
simde_vsubl_s32(simde_int32x2_t a,simde_int32x2_t b)70 simde_vsubl_s32(simde_int32x2_t a, simde_int32x2_t b) {
71   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
72     return vsubl_s32(a, b);
73   #else
74     return simde_vsubq_s64(simde_vmovl_s32(a), simde_vmovl_s32(b));
75   #endif
76 }
77 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
78   #undef vsubl_s32
79   #define vsubl_s32(a, b) simde_vsubl_s32((a), (b))
80 #endif
81 
82 SIMDE_FUNCTION_ATTRIBUTES
83 simde_uint16x8_t
simde_vsubl_u8(simde_uint8x8_t a,simde_uint8x8_t b)84 simde_vsubl_u8(simde_uint8x8_t a, simde_uint8x8_t b) {
85   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
86     return vsubl_u8(a, b);
87   #else
88     return simde_vsubq_u16(simde_vmovl_u8(a), simde_vmovl_u8(b));
89   #endif
90 }
91 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
92   #undef vsubl_u8
93   #define vsubl_u8(a, b) simde_vsubl_u8((a), (b))
94 #endif
95 
96 SIMDE_FUNCTION_ATTRIBUTES
97 simde_uint32x4_t
simde_vsubl_u16(simde_uint16x4_t a,simde_uint16x4_t b)98 simde_vsubl_u16(simde_uint16x4_t a, simde_uint16x4_t b) {
99   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
100     return vsubl_u16(a, b);
101   #else
102     return simde_vsubq_u32(simde_vmovl_u16(a), simde_vmovl_u16(b));
103   #endif
104 }
105 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
106   #undef vsubl_u16
107   #define vsubl_u16(a, b) simde_vsubl_u16((a), (b))
108 #endif
109 
110 SIMDE_FUNCTION_ATTRIBUTES
111 simde_uint64x2_t
simde_vsubl_u32(simde_uint32x2_t a,simde_uint32x2_t b)112 simde_vsubl_u32(simde_uint32x2_t a, simde_uint32x2_t b) {
113   #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
114     return vsubl_u32(a, b);
115   #else
116     return simde_vsubq_u64(simde_vmovl_u32(a), simde_vmovl_u32(b));
117   #endif
118 }
119 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
120   #undef vsubl_u32
121   #define vsubl_u32(a, b) simde_vsubl_u32((a), (b))
122 #endif
123 
124 SIMDE_END_DECLS_
125 HEDLEY_DIAGNOSTIC_POP
126 
127 #endif /* !defined(SIMDE_ARM_NEON_SUBL_H) */
128