diff --git a/dune/perftool/common/vectorclass.hh b/dune/perftool/common/vectorclass.hh index 16955159bed0799bc3c43976e00c734f1dc79958..e686e9f750e93c4d1ebfa6f3c529b0b7d14b62ab 100644 --- a/dune/perftool/common/vectorclass.hh +++ b/dune/perftool/common/vectorclass.hh @@ -30,6 +30,29 @@ #include <numeric> + +template<typename T> +struct base_floatingpoint +{}; + +template<> +struct base_floatingpoint<_vcl::Vec4d> +{ + using value = double; +} + +template<> +struct base_floatingpoint<_vcl::Vec8d> +{ + using value = double; +} + +template<> +struct base_floatingpoint<_vcl::Vec8f> +{ + using value = float; +} + struct Vec4d { oc::OpCounter<double> _d[4]; @@ -111,6 +134,11 @@ struct Vec4d }; +template<> +struct base_floatingpoint<Vec4d> +{ + using value = typename Vec4d::F; +} /***************************************************************************** * @@ -776,6 +804,11 @@ struct Vec8d }; +template<> +struct base_floatingpoint<Vec8d> +{ + using value = typename Vec8d::F; +} /***************************************************************************** * @@ -1196,6 +1229,11 @@ struct Vec8f }; +template<> +struct base_floatingpoint<Vec8f> +{ + using value = typename Vec8f::F; +} /***************************************************************************** * diff --git a/dune/perftool/sumfact/horizontaladd.hh b/dune/perftool/sumfact/horizontaladd.hh index f7303168866428feca8a6a25dae66678e9f2c9d3..db7634f0e5507214318dabb719240ff3674808ed 100644 --- a/dune/perftool/sumfact/horizontaladd.hh +++ b/dune/perftool/sumfact/horizontaladd.hh @@ -1,14 +1,17 @@ #ifndef DUNE_PERFTOOL_SUMFACT_HORIZONTALADD_HH #define DUNE_PERFTOOL_SUMFACT_HORIZONTALADD_HH +#include<dune/perftool/common/vectorclass.hh> + + template<class V> -double horizontal_add_lower(const V& x) +typename base_floatingpoint<V>::value horizontal_add_lower(const V& x) { return horizontal_add(x.get_low()); } template<class V> -double horizontal_add_upper(const V& x) +typename base_floatingpoint<V>::value horizontal_add_upper(const V& x) { return horizontal_add(x.get_high()); }