kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 079cb915a1700705883dfdf8e1b237f27ef2c2b1
parent 570391d199744e37b5501fdf7bd59d90d7205c9f
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Tue,  9 Aug 2016 06:31:15 +0300

ARM NEON: fix select(mf64neon, f64neon, f64neon)

Diffstat:
Minclude/kfr/base/select.hpp | 18++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/kfr/base/select.hpp b/include/kfr/base/select.hpp @@ -169,20 +169,30 @@ KFR_SINTRIN f64neon select(const mf64neon& m, const f64neon& x, const f64neon& y return vbslq_f64(*m, *x, *y); } #else -template <typename T, size_t N> -KFR_SINTRIN vec<T, N> select(const mask<T, N>& m, const vec<T, N>& x, const vec<T, N>& y) +KFR_SINTRIN f64neon select(const mf64neon& m, const f64neon& x, const f64neon& y) { - return y ^ ((x ^ y) & vec<T, N>(*m)); + return y ^ ((x ^ y) & f64neon(*m)); } #endif +template <typename T, size_t N, KFR_ENABLE_IF(N < vector_width<T, cpu_t::native>)> +KFR_SINTRIN vec<T, N> select(const mask<T, N>& a, const vec<T, N>& b, const vec<T, N>& c) +{ + return slice<0, N>(select(expand_simd(a).asmask(), expand_simd(b), expand_simd(c))); +} +template <typename T, size_t N, KFR_ENABLE_IF(N >= vector_width<T, cpu_t::native>), typename = void> +KFR_SINTRIN vec<T, N> select(const mask<T, N>& a, const vec<T, N>& b, const vec<T, N>& c) +{ + return concat(select(low(a).asmask(), low(b), low(c)), select(high(a).asmask(), high(b), high(c))); +} + #else // fallback template <typename T, size_t N> KFR_SINTRIN vec<T, N> select(const mask<T, N>& m, const vec<T, N>& x, const vec<T, N>& y) { - return y ^ ((x ^ y) & m.asvec()); + return y ^ ((x ^ y) & vec<T, N>(*m)); } #endif }