diff options
-rw-r--r-- | bench.cc | 15 | ||||
-rw-r--r-- | test.cc | 5 | ||||
-rw-r--r-- | vec_double.h | 2 | ||||
-rw-r--r-- | vec_double_avx.h | 2 | ||||
-rw-r--r-- | vec_double_sse2.h | 2 | ||||
-rw-r--r-- | vec_float.h | 2 | ||||
-rw-r--r-- | vec_float_avx.h | 2 | ||||
-rw-r--r-- | vec_float_sse2.h | 2 |
8 files changed, 15 insertions, 17 deletions
@@ -7,6 +7,7 @@ #include <cmath> #include <cstdlib> #include <iostream> +#include <typeinfo> #include <sys/time.h> @@ -106,37 +107,37 @@ double bench_func() template<typename realvec_t> void bench() { - cout << "identity(" << realvec_t::name << "):" << flush; + cout << "identity(" << realvec_t::name() << "):" << flush; double const cycles_identity = bench_func<realvec_t, functor_identity<realvec_t>>(); cout << " " << cycles_identity << " cycles\n"; - cout << "sqrt(" << realvec_t::name << "):" << flush; + cout << "sqrt(" << realvec_t::name() << "):" << flush; double const cycles_sqrt = bench_func<realvec_t, functor_sqrt<realvec_t>>(); cout << " " << cycles_sqrt - cycles_identity << " cycles\n"; - cout << "exp(" << realvec_t::name << "):" << flush; + cout << "exp(" << realvec_t::name() << "):" << flush; double const cycles_exp = bench_func<realvec_t, functor_exp<realvec_t>>(); cout << " " << cycles_exp - cycles_identity << " cycles\n"; - cout << "log(" << realvec_t::name << "):" << flush; + cout << "log(" << realvec_t::name() << "):" << flush; double const cycles_log = bench_func<realvec_t, functor_log<realvec_t>>(); cout << " " << cycles_log - cycles_identity << " cycles\n"; - cout << "sin(" << realvec_t::name << "):" << flush; + cout << "sin(" << realvec_t::name() << "):" << flush; double const cycles_sin = bench_func<realvec_t, functor_sin<realvec_t>>(); cout << " " << cycles_sin - cycles_identity << " cycles\n"; - cout << "cos(" << realvec_t::name << "):" << flush; + cout << "cos(" << realvec_t::name() << "):" << flush; double const cycles_cos = bench_func<realvec_t, functor_cos<realvec_t>>(); cout << " " << cycles_cos - cycles_identity << " cycles\n"; - cout << "atan(" << realvec_t::name << "):" << flush; + cout << "atan(" << realvec_t::name() << "):" << flush; double const cycles_atan = bench_func<realvec_t, functor_atan<realvec_t>>(); cout << " " << cycles_atan - cycles_identity << " cycles\n"; @@ -401,10 +401,7 @@ struct vecmathlib_test { static void test() { cout << "\n" - << "Testing math functions for type " - // << typeid(realvec_t).name() - << realvec_t::name - << ":\n" << flush; + << "Testing math functions for type " << realvec_t::name() << ":\n"; test_fabs(); test_convert(); diff --git a/vec_double.h b/vec_double.h index 8d2b090..c3374b3 100644 --- a/vec_double.h +++ b/vec_double.h @@ -183,7 +183,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef real_t vector_t; - static constexpr char const* const name = "<1*double>"; + static char const* name() { return "<1*double>"; } inline void barrier() { asm("": "+x" (v)); } typedef boolvec<real_t, size> boolvec_t; diff --git a/vec_double_avx.h b/vec_double_avx.h index 8d4181a..1cc9b9a 100644 --- a/vec_double_avx.h +++ b/vec_double_avx.h @@ -372,7 +372,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef __m256d vector_t; - static constexpr char const* const name = "<AVX:4*double>"; + static char const* name() { return "<AVX:4*double>"; } inline void barrier() { asm("": "+x" (v)); } static_assert(size * sizeof(real_t) == sizeof(vector_t), diff --git a/vec_double_sse2.h b/vec_double_sse2.h index c17227d..9a09806 100644 --- a/vec_double_sse2.h +++ b/vec_double_sse2.h @@ -274,7 +274,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef __m128d vector_t; - static constexpr char const* const name = "<SSE2:2*double>"; + static char const* name() { return "<SSE2:2*double>"; } inline void barrier() { asm("": "+x" (v)); } static_assert(size * sizeof(real_t) == sizeof(vector_t), diff --git a/vec_float.h b/vec_float.h index 883409b..a63258f 100644 --- a/vec_float.h +++ b/vec_float.h @@ -183,7 +183,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef real_t vector_t; - static constexpr char const* const name = "<1*float>"; + static char const* name() { return "<1*float>"; } inline void barrier() { asm("": "+x" (v)); } typedef boolvec<real_t, size> boolvec_t; diff --git a/vec_float_avx.h b/vec_float_avx.h index 3feac0e..a17c473 100644 --- a/vec_float_avx.h +++ b/vec_float_avx.h @@ -351,7 +351,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef __m256 vector_t; - static constexpr char const* const name = "<AVX:8*float>"; + static char const* name() { return "<AVX:8*float>"; } inline void barrier() { asm("": "+x" (v)); } static_assert(size * sizeof(real_t) == sizeof(vector_t), diff --git a/vec_float_sse2.h b/vec_float_sse2.h index 6212282..3ca7c57 100644 --- a/vec_float_sse2.h +++ b/vec_float_sse2.h @@ -257,7 +257,7 @@ namespace vecmathlib { typedef real_t scalar_t; typedef __m128 vector_t; - static constexpr char const* const name = "<SSE2:4*float>"; + static char const* name() { return "<SSE2:4*float>"; } inline void barrier() { asm("": "+x" (v)); } static_assert(size * sizeof(real_t) == sizeof(vector_t), |