diff --git a/include/tulip/simd/avx.hpp b/include/tulip/simd/avx.hpp index bcfa117..fa3e37e 100644 --- a/include/tulip/simd/avx.hpp +++ b/include/tulip/simd/avx.hpp @@ -14,10 +14,10 @@ struct traits { static constexpr std::size_t width = 4; - static pack_type load(const float* ptr) noexcept { return _mm128_loadu_ps(ptr); } - static void store(float* ptr, pack_type value) noexcept { _mm128_storeu_ps(ptr, value); } + static pack_type load(const float* ptr) noexcept { return _mm_loadu_ps(ptr); } + static void store(float* ptr, pack_type value) noexcept { _mm_storeu_ps(ptr, value); } - static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm128_add_ps(lhs, rhs); } + static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm_add_ps(lhs, rhs); } }; #endif // TULIP_AVX_SUPPORTED diff --git a/include/tulip/simd/avx2.hpp b/include/tulip/simd/avx2.hpp index 34d6f2d..fae5bc1 100644 --- a/include/tulip/simd/avx2.hpp +++ b/include/tulip/simd/avx2.hpp @@ -26,10 +26,10 @@ struct traits { static constexpr std::size_t width = 4; - static pack_type load(const double* ptr) noexcept { return _mm256d_loadu_ps(ptr); } - static void store(double* ptr, pack_type value) noexcept { _mm256d_storeu_ps(ptr, value); } + static pack_type load(const double* ptr) noexcept { return _mm256_loadu_pd(ptr); } + static void store(double* ptr, pack_type value) noexcept { _mm256_storeu_pd(ptr, value); } - static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm256d_add_ps(lhs, rhs); } + static pack_type add(pack_type lhs, pack_type rhs) noexcept { return _mm256_add_pd(lhs, rhs); } }; #endif // TULIP_AVX2_SUPPORTED diff --git a/include/tulip/simd/config.hpp b/include/tulip/simd/config.hpp index f0010a0..72e76d4 100644 --- a/include/tulip/simd/config.hpp +++ b/include/tulip/simd/config.hpp @@ -1,6 +1,10 @@ #ifndef TULIP_SIMD_CONFIG_HPP #define TULIP_SIMD_CONFIG_HPP +#if defined(__AVX__) || defined(__AVX2__) +#include +#endif + namespace tulip { namespace simd { @@ -10,12 +14,10 @@ struct avx2_isa {}; #ifdef __AVX__ #define TULIP_AVX_SUPPORTED -#include #endif // __AVX__ #ifdef __AVX2__ #define TULIP_AVX2_SUPPORTED -#include #endif // __AVX2__ } // namespace simd diff --git a/include/tulip/simd/traits.hpp b/include/tulip/simd/traits.hpp index ee60216..af11d70 100644 --- a/include/tulip/simd/traits.hpp +++ b/include/tulip/simd/traits.hpp @@ -36,7 +36,7 @@ static auto load(const T* ptr) noexcept { } template -static void store(const T* ptr, pack_t value) noexcept { +static void store(T* ptr, pack_t value) noexcept { traits::store(ptr, value); }