diff options
Diffstat (limited to 'math/v_math.h')
-rw-r--r-- | math/v_math.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/math/v_math.h b/math/v_math.h index f2cc467..3289916 100644 --- a/math/v_math.h +++ b/math/v_math.h @@ -1,8 +1,8 @@ /* * Vector math abstractions. * - * Copyright (c) 2019-2020, Arm Limited. - * SPDX-License-Identifier: MIT + * Copyright (c) 2019-2022, Arm Limited. + * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception */ #ifndef _V_MATH_H @@ -191,6 +191,11 @@ v_round_s32 (v_f32_t x) { return __builtin_lroundf (x); /* relies on -fno-math-errno. */ } +static inline v_f32_t +v_sel_f32 (v_u32_t p, v_f32_t x, v_f32_t y) +{ + return p ? x : y; +} /* convert to type1 from type2. */ static inline v_f32_t v_to_f32_s32 (v_s32_t x) @@ -311,6 +316,11 @@ v_round_s64 (v_f64_t x) { return __builtin_lround (x); /* relies on -fno-math-errno. */ } +static inline v_f64_t +v_sel_f64 (v_u64_t p, v_f64_t x, v_f64_t y) +{ + return p ? x : y; +} /* convert to type1 from type2. */ static inline v_f64_t v_to_f64_s64 (v_s64_t x) @@ -460,6 +470,11 @@ v_round_s32 (v_f32_t x) { return vcvtaq_s32_f32 (x); } +static inline v_f32_t +v_sel_f32 (v_u32_t p, v_f32_t x, v_f32_t y) +{ + return vbslq_f32 (p, x, y); +} /* convert to type1 from type2. */ static inline v_f32_t v_to_f32_s32 (v_s32_t x) @@ -584,6 +599,11 @@ v_round_s64 (v_f64_t x) { return vcvtaq_s64_f64 (x); } +static inline v_f64_t +v_sel_f64 (v_u64_t p, v_f64_t x, v_f64_t y) +{ + return vbslq_f64 (p, x, y); +} /* convert to type1 from type2. */ static inline v_f64_t v_to_f64_s64 (v_s64_t x) |