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_ABDL_H)
28 #define SIMDE_ARM_NEON_ABDL_H
29
30 #include "abs.h"
31 #include "subl.h"
32 #include "movl.h"
33 #include "reinterpret.h"
34
35 HEDLEY_DIAGNOSTIC_PUSH
36 SIMDE_DISABLE_UNWANTED_DIAGNOSTICS
37 SIMDE_BEGIN_DECLS_
38
39 SIMDE_FUNCTION_ATTRIBUTES
40 simde_int16x8_t
simde_vabdl_s8(simde_int8x8_t a,simde_int8x8_t b)41 simde_vabdl_s8(simde_int8x8_t a, simde_int8x8_t b) {
42 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
43 return vabdl_s8(a, b);
44 #else
45 return simde_vabsq_s16(simde_vsubl_s8(a, b));
46 #endif
47 }
48 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
49 #undef vabdl_s8
50 #define vabdl_s8(a, b) simde_vabdl_s8((a), (b))
51 #endif
52
53 SIMDE_FUNCTION_ATTRIBUTES
54 simde_int32x4_t
simde_vabdl_s16(simde_int16x4_t a,simde_int16x4_t b)55 simde_vabdl_s16(simde_int16x4_t a, simde_int16x4_t b) {
56 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
57 return vabdl_s16(a, b);
58 #else
59 return simde_vabsq_s32(simde_vsubl_s16(a, b));
60 #endif
61 }
62 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
63 #undef vabdl_s16
64 #define vabdl_s16(a, b) simde_vabdl_s16((a), (b))
65 #endif
66
67 SIMDE_FUNCTION_ATTRIBUTES
68 simde_int64x2_t
simde_vabdl_s32(simde_int32x2_t a,simde_int32x2_t b)69 simde_vabdl_s32(simde_int32x2_t a, simde_int32x2_t b) {
70 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
71 return vabdl_s32(a, b);
72 #else
73 return simde_vabsq_s64(simde_vsubl_s32(a, b));
74 #endif
75 }
76 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
77 #undef vabdl_s32
78 #define vabdl_s32(a, b) simde_vabdl_s32((a), (b))
79 #endif
80
81 SIMDE_FUNCTION_ATTRIBUTES
82 simde_uint16x8_t
simde_vabdl_u8(simde_uint8x8_t a,simde_uint8x8_t b)83 simde_vabdl_u8(simde_uint8x8_t a, simde_uint8x8_t b) {
84 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
85 return vabdl_u8(a, b);
86 #else
87 return simde_vreinterpretq_u16_s16(
88 simde_vabsq_s16(
89 simde_vsubq_s16(
90 simde_vreinterpretq_s16_u16(simde_vmovl_u8(a)),
91 simde_vreinterpretq_s16_u16(simde_vmovl_u8(b))
92 )
93 )
94 );
95 #endif
96 }
97 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
98 #undef vabdl_u8
99 #define vabdl_u8(a, b) simde_vabdl_u8((a), (b))
100 #endif
101
102 SIMDE_FUNCTION_ATTRIBUTES
103 simde_uint32x4_t
simde_vabdl_u16(simde_uint16x4_t a,simde_uint16x4_t b)104 simde_vabdl_u16(simde_uint16x4_t a, simde_uint16x4_t b) {
105 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
106 return vabdl_u16(a, b);
107 #else
108 return simde_vreinterpretq_u32_s32(
109 simde_vabsq_s32(
110 simde_vsubq_s32(
111 simde_vreinterpretq_s32_u32(simde_vmovl_u16(a)),
112 simde_vreinterpretq_s32_u32(simde_vmovl_u16(b))
113 )
114 )
115 );
116 #endif
117 }
118 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
119 #undef vabdl_u16
120 #define vabdl_u16(a, b) simde_vabdl_u16((a), (b))
121 #endif
122
123 SIMDE_FUNCTION_ATTRIBUTES
124 simde_uint64x2_t
simde_vabdl_u32(simde_uint32x2_t a,simde_uint32x2_t b)125 simde_vabdl_u32(simde_uint32x2_t a, simde_uint32x2_t b) {
126 #if defined(SIMDE_ARM_NEON_A32V7_NATIVE)
127 return vabdl_u32(a, b);
128 #else
129 return simde_vreinterpretq_u64_s64(
130 simde_vabsq_s64(
131 simde_vsubq_s64(
132 simde_vreinterpretq_s64_u64(simde_vmovl_u32(a)),
133 simde_vreinterpretq_s64_u64(simde_vmovl_u32(b))
134 )
135 )
136 );
137 #endif
138 }
139 #if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES)
140 #undef vabdl_u32
141 #define vabdl_u32(a, b) simde_vabdl_u32((a), (b))
142 #endif
143
144 SIMDE_END_DECLS_
145 HEDLEY_DIAGNOSTIC_POP
146
147 #endif /* !defined(SIMDE_ARM_NEON_ABDL_H) */
148