feat(tulip): introduce basic SIMD abstraction

This commit is contained in:
2026-11-22 14:19:26 +01:00
parent dea973ddd6
commit 3a27df500e
4 changed files with 144 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef TULIP_SIMD_AVX_HPP
#define TULIP_SIMD_AVX_HPP
#include "./traits.hpp"
namespace tulip {
namespace simd {
namespace detail {
#ifdef TULIP_AVX_SUPPORTED
template <>
struct traits<float, avx_isa> {
using pack_type = __m128;
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 add(pack_type lhs, pack_type rhs) noexcept { return _mm128_add_ps(lhs, rhs); }
};
#endif // TULIP_AVX_SUPPORTED
} // namespace detail
} // namespace simd
} // namespace tulip
#endif // TULIP_SIMD_AVX_HPP