Skip to content

Commit

Permalink
Added support for load_unaligned and sqrt operations
Browse files Browse the repository at this point in the history
  • Loading branch information
anutosh491 committed Oct 4, 2023
1 parent c272589 commit 03350e2
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions include/xsimd/arch/xsimd_wasm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,23 @@ namespace xsimd
return wasm_v128_load(mem);
}

// load_unaligned
template <class A>
inline batch<float, A> load_unaligned(float const* mem, convert<float>, requires_arch<wasm>) noexcept
{
return wasm_v128_load(mem);
}
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
inline batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<wasm>) noexcept
{
return wasm_v128_load((v128_t const*)mem);
}
template <class A>
inline batch<double, A> load_unaligned(double const* mem, convert<double>, requires_arch<wasm>) noexcept
{
return wasm_v128_load(mem);
}

// max
template <class A>
inline batch<float, A> max(batch<float, A> const& self, batch<float, A> const& other, requires_arch<wasm>) noexcept
Expand Down Expand Up @@ -551,6 +568,18 @@ namespace xsimd
{
return wasm_f64x2_sub(self, other);
}

// sqrt
template <class A>
inline batch<float, A> sqrt(batch<float, A> const& val, requires_arch<wasm>) noexcept
{
return wasm_f32x4_sqrt(val);
}
template <class A>
inline batch<double, A> sqrt(batch<double, A> const& val, requires_arch<wasm>) noexcept
{
return wasm_f64x2_sqrt(val);
}
}
}

Expand Down

0 comments on commit 03350e2

Please sign in to comment.