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 ab80e59dbf29aa5d4a834029d3277e2e8ec8f031
parent a00d2e42928a1162cf43c291af48a9347ef447b8
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Mon, 25 Jul 2016 13:56:15 +0300

function.hpp defines

Diffstat:
Minclude/kfr/base/function.hpp | 80-------------------------------------------------------------------------------
1 file changed, 0 insertions(+), 80 deletions(-)

diff --git a/include/kfr/base/function.hpp b/include/kfr/base/function.hpp @@ -33,19 +33,6 @@ namespace kfr { -#define KFR_HANDLE_ALL(fn) \ - template <typename T, size_t N, typename... Args> \ - KFR_SINTRIN vec<T, N> fn(vec<T, N> x, Args&&... args) \ - { \ - return handle_all<cpu, fn_##fn>(x, std::forward<Args>(args)...); \ - } -#define KFR_HANDLE_ALL_REDUCE(redfn, fn) \ - template <typename T, size_t N, typename... Args> \ - KFR_SINTRIN auto fn(vec<T, N> x, Args&&... args) \ - { \ - return handle_all_reduce<cpu, redfn, fn_##fn>(x, std::forward<Args>(args)...); \ - } - #define KFR_HANDLE_SCALAR(fn) \ template <typename T, typename... Ts, KFR_ENABLE_IF(is_numeric_args<T, Ts...>::value)> \ KFR_SINTRIN auto fn(const T& x, const Ts&... rest) \ @@ -56,73 +43,6 @@ namespace kfr namespace internal { -struct fn_disabled -{ - constexpr static bool disabled = true; -}; - -template <cpu_t c, typename T> -constexpr inline size_t next_fast_width(size_t n) -{ - return n > vector_width<T, cpu_t::sse2> ? vector_width<T, c> : vector_width<T, cpu_t::sse2>; -} - -template <cpu_t c, typename T, size_t N, size_t Nout = next_fast_width<c, T>(N)> -KFR_INLINE vec<T, Nout> extend_reg(vec<T, N> x) -{ - return extend<Nout>(x); -} -template <cpu_t c, typename T, size_t N, size_t Nout = next_fast_width<c, T>(N)> -KFR_INLINE vec<T, Nout> extend_reg(vec<T, N> x, T value) -{ - return widen<Nout>(x, value); -} - -template <cpu_t cur, typename Fn, typename T, size_t N, typename... Args, - KFR_ENABLE_IF(N < vector_width<T, cur>)> -KFR_INLINE auto handle_all_f(Fn&& fn, vec<T, N> x, Args&&... args) -{ - return narrow<N>(fn(extend_reg<cur>(x), extend_reg<cur>(args)...)); -} -template <cpu_t cur, typename Fn, typename T, size_t N, typename... Args, - KFR_ENABLE_IF(N > vector_width<T, cur>)> -KFR_INLINE auto handle_all_f(Fn&& fn, vec<T, N> x, Args&&... args) -{ - return concat(fn(low(x), low(args)...), fn(high(x), high(args)...)); -} - -template <cpu_t cur, typename Fn, typename T, size_t N, typename... Args> -KFR_INLINE auto handle_all(vec<T, N> x, Args&&... args) -{ - Fn fn{}; - return handle_all_f<cur>(fn, x, std::forward<Args>(args)...); -} - -template <cpu_t cur, typename RedFn, typename Fn, typename T, size_t N, typename... Args, - typename = u8[N < vector_width<T, cur>]> -KFR_INLINE auto handle_all_reduce_f(RedFn&& redfn, Fn&& fn, vec<T, N> x, Args&&... args) -{ - return fn(extend_reg<cur>(x, redfn(initialvalue<T>())), - extend_reg<cur>(args, redfn(initialvalue<T>()))...); -} -template <cpu_t cur, typename RedFn, typename Fn, typename T, size_t N, typename... Args, - typename = u8[N > vector_width<T, cur>], typename = void> -KFR_INLINE auto handle_all_reduce_f(RedFn&& redfn, Fn&& fn, vec<T, N> x, Args&&... args) -{ - return redfn(fn(low(x), low(args)...), fn(high(x), high(args)...)); -} -template <cpu_t cur, typename RedFn, typename Fn, typename T, size_t N, typename... Args> -KFR_INLINE auto handle_all_reduce(vec<T, N> x, Args&&... args) -{ - RedFn redfn{}; - Fn fn{}; - return handle_all_reduce_f<cur>(redfn, fn, x, std::forward<Args>(args)...); -} -} - -namespace internal -{ - using f32sse = vec<f32, 4>; using f64sse = vec<f64, 2>; using i8sse = vec<i8, vector_width<i8, cpu_t::sse2>>;