diff --git a/include/xsimd/arch/xsimd_wasm.hpp b/include/xsimd/arch/xsimd_wasm.hpp index 4e7857f09..1d415f448 100644 --- a/include/xsimd/arch/xsimd_wasm.hpp +++ b/include/xsimd/arch/xsimd_wasm.hpp @@ -16,6 +16,7 @@ #include #include "../types/xsimd_wasm_register.hpp" +#include "./common/xsimd_common_cast.hpp" namespace xsimd { @@ -1701,6 +1702,44 @@ namespace xsimd return wasm_f64x2_trunc(self); } + // widen + template + XSIMD_INLINE std::array, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch(wasm_f64x2_promote_low_f32x4(x)), + batch(wasm_f64x2_promote_low_f32x4(wasm_i32x4_shuffle(x, x, 2, 3, 0, 1))) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_u16x8_extend_low_u8x16(x)), batch, A>(wasm_u16x8_extend_high_u8x16(x)) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_i16x8_extend_low_i8x16(x)), batch, A>(wasm_i16x8_extend_high_i8x16(x)) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_u32x4_extend_low_u16x8(x)), batch, A>(wasm_u32x4_extend_high_u16x8(x)) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_i32x4_extend_low_i16x8(x)), batch, A>(wasm_i32x4_extend_high_i16x8(x)) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_u64x2_extend_low_u32x4(x)), batch, A>(wasm_u64x2_extend_high_u32x4(x)) }; + } + template + XSIMD_INLINE std::array, A>, 2> widen(batch const& x, requires_arch) noexcept + { + return { batch, A>(wasm_i64x2_extend_low_i32x4(x)), batch, A>(wasm_i64x2_extend_high_i32x4(x)) }; + } + // zip_hi template XSIMD_INLINE batch zip_hi(batch const& self, batch const& other, requires_arch) noexcept