| 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 |
* 2020 Sean Maher <[email protected]> (Copyright owned by Google, LLC) |
| 26 |
*/ |
| 27 |
|
| 28 |
#if !defined(SIMDE_ARM_NEON_PMAX_H) |
| 29 |
#define SIMDE_ARM_NEON_PMAX_H |
| 30 |
|
| 31 |
#include "types.h" |
| 32 |
#include "max.h" |
| 33 |
#include "uzp1.h" |
| 34 |
#include "uzp2.h" |
| 35 |
|
| 36 |
HEDLEY_DIAGNOSTIC_PUSH |
| 37 |
SIMDE_DISABLE_UNWANTED_DIAGNOSTICS |
| 38 |
SIMDE_BEGIN_DECLS_ |
| 39 |
|
| 40 |
SIMDE_FUNCTION_ATTRIBUTES |
| 41 |
simde_float32_t |
| 42 |
simde_vpmaxs_f32(simde_float32x2_t a) { |
| 43 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 44 |
return vpmaxs_f32(a); |
| 45 |
#else |
| 46 |
simde_float32x2_private a_ = simde_float32x2_to_private(a); |
| 47 |
return (a_.values[0] > a_.values[1]) ? a_.values[0] : a_.values[1]; |
| 48 |
#endif |
| 49 |
} |
| 50 |
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES) |
| 51 |
#undef vpmaxs_f32 |
| 52 |
#define vpmaxs_f32(a) simde_vpmaxs_f32((a)) |
| 53 |
#endif |
| 54 |
|
| 55 |
SIMDE_FUNCTION_ATTRIBUTES |
| 56 |
simde_float64_t |
| 57 |
simde_vpmaxqd_f64(simde_float64x2_t a) { |
| 58 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 59 |
return vpmaxqd_f64(a); |
| 60 |
#else |
| 61 |
simde_float64x2_private a_ = simde_float64x2_to_private(a); |
| 62 |
return (a_.values[0] > a_.values[1]) ? a_.values[0] : a_.values[1]; |
| 63 |
#endif |
| 64 |
} |
| 65 |
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES) |
| 66 |
#undef vpmaxqd_f64 |
| 67 |
#define vpmaxqd_f64(a) simde_vpmaxqd_f64((a)) |
| 68 |
#endif |
| 69 |
|
| 70 |
SIMDE_FUNCTION_ATTRIBUTES |
| 71 |
simde_float32x2_t |
| 72 |
simde_vpmax_f32(simde_float32x2_t a, simde_float32x2_t b) { |
| 73 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 74 |
return vpmax_f32(a, b); |
| 75 |
#else |
| 76 |
return simde_vmax_f32(simde_vuzp1_f32(a, b), simde_vuzp2_f32(a, b)); |
| 77 |
#endif |
| 78 |
} |
| 79 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 80 |
#undef vpmax_f32 |
| 81 |
#define vpmax_f32(a, b) simde_vpmax_f32((a), (b)) |
| 82 |
#endif |
| 83 |
|
| 84 |
SIMDE_FUNCTION_ATTRIBUTES |
| 85 |
simde_int8x8_t |
| 86 |
simde_vpmax_s8(simde_int8x8_t a, simde_int8x8_t b) { |
| 87 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 88 |
return vpmax_s8(a, b); |
| 89 |
#else |
| 90 |
return simde_vmax_s8(simde_vuzp1_s8(a, b), simde_vuzp2_s8(a, b)); |
| 91 |
#endif |
| 92 |
} |
| 93 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 94 |
#undef vpmax_s8 |
| 95 |
#define vpmax_s8(a, b) simde_vpmax_s8((a), (b)) |
| 96 |
#endif |
| 97 |
|
| 98 |
SIMDE_FUNCTION_ATTRIBUTES |
| 99 |
simde_int16x4_t |
| 100 |
simde_vpmax_s16(simde_int16x4_t a, simde_int16x4_t b) { |
| 101 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 102 |
return vpmax_s16(a, b); |
| 103 |
#else |
| 104 |
return simde_vmax_s16(simde_vuzp1_s16(a, b), simde_vuzp2_s16(a, b)); |
| 105 |
#endif |
| 106 |
} |
| 107 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 108 |
#undef vpmax_s16 |
| 109 |
#define vpmax_s16(a, b) simde_vpmax_s16((a), (b)) |
| 110 |
#endif |
| 111 |
|
| 112 |
SIMDE_FUNCTION_ATTRIBUTES |
| 113 |
simde_int32x2_t |
| 114 |
simde_vpmax_s32(simde_int32x2_t a, simde_int32x2_t b) { |
| 115 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 116 |
return vpmax_s32(a, b); |
| 117 |
#else |
| 118 |
return simde_vmax_s32(simde_vuzp1_s32(a, b), simde_vuzp2_s32(a, b)); |
| 119 |
#endif |
| 120 |
} |
| 121 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 122 |
#undef vpmax_s32 |
| 123 |
#define vpmax_s32(a, b) simde_vpmax_s32((a), (b)) |
| 124 |
#endif |
| 125 |
|
| 126 |
SIMDE_FUNCTION_ATTRIBUTES |
| 127 |
simde_uint8x8_t |
| 128 |
simde_vpmax_u8(simde_uint8x8_t a, simde_uint8x8_t b) { |
| 129 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 130 |
return vpmax_u8(a, b); |
| 131 |
#else |
| 132 |
return simde_vmax_u8(simde_vuzp1_u8(a, b), simde_vuzp2_u8(a, b)); |
| 133 |
#endif |
| 134 |
} |
| 135 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 136 |
#undef vpmax_u8 |
| 137 |
#define vpmax_u8(a, b) simde_vpmax_u8((a), (b)) |
| 138 |
#endif |
| 139 |
|
| 140 |
SIMDE_FUNCTION_ATTRIBUTES |
| 141 |
simde_uint16x4_t |
| 142 |
simde_vpmax_u16(simde_uint16x4_t a, simde_uint16x4_t b) { |
| 143 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 144 |
return vpmax_u16(a, b); |
| 145 |
#else |
| 146 |
return simde_vmax_u16(simde_vuzp1_u16(a, b), simde_vuzp2_u16(a, b)); |
| 147 |
#endif |
| 148 |
} |
| 149 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 150 |
#undef vpmax_u16 |
| 151 |
#define vpmax_u16(a, b) simde_vpmax_u16((a), (b)) |
| 152 |
#endif |
| 153 |
|
| 154 |
SIMDE_FUNCTION_ATTRIBUTES |
| 155 |
simde_uint32x2_t |
| 156 |
simde_vpmax_u32(simde_uint32x2_t a, simde_uint32x2_t b) { |
| 157 |
#if defined(SIMDE_ARM_NEON_A32V7_NATIVE) |
| 158 |
return vpmax_u32(a, b); |
| 159 |
#else |
| 160 |
return simde_vmax_u32(simde_vuzp1_u32(a, b), simde_vuzp2_u32(a, b)); |
| 161 |
#endif |
| 162 |
} |
| 163 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 164 |
#undef vpmax_u32 |
| 165 |
#define vpmax_u32(a, b) simde_vpmax_u32((a), (b)) |
| 166 |
#endif |
| 167 |
|
| 168 |
SIMDE_FUNCTION_ATTRIBUTES |
| 169 |
simde_float32x4_t |
| 170 |
simde_vpmaxq_f32(simde_float32x4_t a, simde_float32x4_t b) { |
| 171 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 172 |
return vpmaxq_f32(a, b); |
| 173 |
#else |
| 174 |
return simde_vmaxq_f32(simde_vuzp1q_f32(a, b), simde_vuzp2q_f32(a, b)); |
| 175 |
#endif |
| 176 |
} |
| 177 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 178 |
#undef vpmaxq_f32 |
| 179 |
#define vpmaxq_f32(a, b) simde_vpmaxq_f32((a), (b)) |
| 180 |
#endif |
| 181 |
|
| 182 |
SIMDE_FUNCTION_ATTRIBUTES |
| 183 |
simde_float64x2_t |
| 184 |
simde_vpmaxq_f64(simde_float64x2_t a, simde_float64x2_t b) { |
| 185 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 186 |
return vpmaxq_f64(a, b); |
| 187 |
#else |
| 188 |
return simde_vmaxq_f64(simde_vuzp1q_f64(a, b), simde_vuzp2q_f64(a, b)); |
| 189 |
#endif |
| 190 |
} |
| 191 |
#if defined(SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES) |
| 192 |
#undef vpmaxq_f64 |
| 193 |
#define vpmaxq_f64(a, b) simde_vpmaxq_f64((a), (b)) |
| 194 |
#endif |
| 195 |
|
| 196 |
SIMDE_FUNCTION_ATTRIBUTES |
| 197 |
simde_int8x16_t |
| 198 |
simde_vpmaxq_s8(simde_int8x16_t a, simde_int8x16_t b) { |
| 199 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 200 |
return vpmaxq_s8(a, b); |
| 201 |
#else |
| 202 |
return simde_vmaxq_s8(simde_vuzp1q_s8(a, b), simde_vuzp2q_s8(a, b)); |
| 203 |
#endif |
| 204 |
} |
| 205 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 206 |
#undef vpmaxq_s8 |
| 207 |
#define vpmaxq_s8(a, b) simde_vpmaxq_s8((a), (b)) |
| 208 |
#endif |
| 209 |
|
| 210 |
SIMDE_FUNCTION_ATTRIBUTES |
| 211 |
simde_int16x8_t |
| 212 |
simde_vpmaxq_s16(simde_int16x8_t a, simde_int16x8_t b) { |
| 213 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 214 |
return vpmaxq_s16(a, b); |
| 215 |
#else |
| 216 |
return simde_vmaxq_s16(simde_vuzp1q_s16(a, b), simde_vuzp2q_s16(a, b)); |
| 217 |
#endif |
| 218 |
} |
| 219 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 220 |
#undef vpmaxq_s16 |
| 221 |
#define vpmaxq_s16(a, b) simde_vpmaxq_s16((a), (b)) |
| 222 |
#endif |
| 223 |
|
| 224 |
SIMDE_FUNCTION_ATTRIBUTES |
| 225 |
simde_int32x4_t |
| 226 |
simde_vpmaxq_s32(simde_int32x4_t a, simde_int32x4_t b) { |
| 227 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 228 |
return vpmaxq_s32(a, b); |
| 229 |
#else |
| 230 |
return simde_vmaxq_s32(simde_vuzp1q_s32(a, b), simde_vuzp2q_s32(a, b)); |
| 231 |
#endif |
| 232 |
} |
| 233 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 234 |
#undef vpmaxq_s32 |
| 235 |
#define vpmaxq_s32(a, b) simde_vpmaxq_s32((a), (b)) |
| 236 |
#endif |
| 237 |
|
| 238 |
SIMDE_FUNCTION_ATTRIBUTES |
| 239 |
simde_uint8x16_t |
| 240 |
simde_vpmaxq_u8(simde_uint8x16_t a, simde_uint8x16_t b) { |
| 241 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 242 |
return vpmaxq_u8(a, b); |
| 243 |
#else |
| 244 |
return simde_vmaxq_u8(simde_vuzp1q_u8(a, b), simde_vuzp2q_u8(a, b)); |
| 245 |
#endif |
| 246 |
} |
| 247 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 248 |
#undef vpmaxq_u8 |
| 249 |
#define vpmaxq_u8(a, b) simde_vpmaxq_u8((a), (b)) |
| 250 |
#endif |
| 251 |
|
| 252 |
SIMDE_FUNCTION_ATTRIBUTES |
| 253 |
simde_uint16x8_t |
| 254 |
simde_vpmaxq_u16(simde_uint16x8_t a, simde_uint16x8_t b) { |
| 255 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 256 |
return vpmaxq_u16(a, b); |
| 257 |
#else |
| 258 |
return simde_vmaxq_u16(simde_vuzp1q_u16(a, b), simde_vuzp2q_u16(a, b)); |
| 259 |
#endif |
| 260 |
} |
| 261 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 262 |
#undef vpmaxq_u16 |
| 263 |
#define vpmaxq_u16(a, b) simde_vpmaxq_u16((a), (b)) |
| 264 |
#endif |
| 265 |
|
| 266 |
SIMDE_FUNCTION_ATTRIBUTES |
| 267 |
simde_uint32x4_t |
| 268 |
simde_vpmaxq_u32(simde_uint32x4_t a, simde_uint32x4_t b) { |
| 269 |
#if defined(SIMDE_ARM_NEON_A64V8_NATIVE) |
| 270 |
return vpmaxq_u32(a, b); |
| 271 |
#else |
| 272 |
return simde_vmaxq_u32(simde_vuzp1q_u32(a, b), simde_vuzp2q_u32(a, b)); |
| 273 |
#endif |
| 274 |
} |
| 275 |
#if defined(SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES) |
| 276 |
#undef vpmaxq_u32 |
| 277 |
#define vpmaxq_u32(a, b) simde_vpmaxq_u32((a), (b)) |
| 278 |
#endif |
| 279 |
|
| 280 |
SIMDE_END_DECLS_ |
| 281 |
HEDLEY_DIAGNOSTIC_POP |
| 282 |
|
| 283 |
#endif /* !defined(SIMDE_ARM_NEON_PMAX_H) */ |