|
16 | 16 | #include <type_traits> |
17 | 17 |
|
18 | 18 | #include "../types/xsimd_wasm_register.hpp" |
| 19 | +#include "./common/xsimd_common_cast.hpp" |
19 | 20 |
|
20 | 21 | namespace xsimd |
21 | 22 | { |
@@ -1701,6 +1702,44 @@ namespace xsimd |
1701 | 1702 | return wasm_f64x2_trunc(self); |
1702 | 1703 | } |
1703 | 1704 |
|
| 1705 | + // widen |
| 1706 | + template <class A> |
| 1707 | + XSIMD_INLINE std::array<batch<double, A>, 2> widen(batch<float, A> const& x, requires_arch<wasm>) noexcept |
| 1708 | + { |
| 1709 | + return { batch<double, A>(wasm_f64x2_promote_low_f32x4(x)), |
| 1710 | + batch<double, A>(wasm_f64x2_promote_low_f32x4(wasm_i32x4_shuffle(x, x, 2, 3, 0, 1))) }; |
| 1711 | + } |
| 1712 | + template <class A> |
| 1713 | + XSIMD_INLINE std::array<batch<widen_t<uint8_t>, A>, 2> widen(batch<uint8_t, A> const& x, requires_arch<wasm>) noexcept |
| 1714 | + { |
| 1715 | + return { batch<widen_t<uint8_t>, A>(wasm_u16x8_extend_low_u8x16(x)), batch<widen_t<uint8_t>, A>(wasm_u16x8_extend_high_u8x16(x)) }; |
| 1716 | + } |
| 1717 | + template <class A> |
| 1718 | + XSIMD_INLINE std::array<batch<widen_t<int8_t>, A>, 2> widen(batch<int8_t, A> const& x, requires_arch<wasm>) noexcept |
| 1719 | + { |
| 1720 | + return { batch<widen_t<int8_t>, A>(wasm_i16x8_extend_low_i8x16(x)), batch<widen_t<int8_t>, A>(wasm_i16x8_extend_high_i8x16(x)) }; |
| 1721 | + } |
| 1722 | + template <class A> |
| 1723 | + XSIMD_INLINE std::array<batch<widen_t<uint16_t>, A>, 2> widen(batch<uint16_t, A> const& x, requires_arch<wasm>) noexcept |
| 1724 | + { |
| 1725 | + return { batch<widen_t<uint16_t>, A>(wasm_u32x4_extend_low_u16x8(x)), batch<widen_t<uint16_t>, A>(wasm_u32x4_extend_high_u16x8(x)) }; |
| 1726 | + } |
| 1727 | + template <class A> |
| 1728 | + XSIMD_INLINE std::array<batch<widen_t<int16_t>, A>, 2> widen(batch<int16_t, A> const& x, requires_arch<wasm>) noexcept |
| 1729 | + { |
| 1730 | + return { batch<widen_t<int16_t>, A>(wasm_i32x4_extend_low_i16x8(x)), batch<widen_t<int16_t>, A>(wasm_i32x4_extend_high_i16x8(x)) }; |
| 1731 | + } |
| 1732 | + template <class A> |
| 1733 | + XSIMD_INLINE std::array<batch<widen_t<uint32_t>, A>, 2> widen(batch<uint32_t, A> const& x, requires_arch<wasm>) noexcept |
| 1734 | + { |
| 1735 | + return { batch<widen_t<uint32_t>, A>(wasm_u64x2_extend_low_u32x4(x)), batch<widen_t<uint32_t>, A>(wasm_u64x2_extend_high_u32x4(x)) }; |
| 1736 | + } |
| 1737 | + template <class A> |
| 1738 | + XSIMD_INLINE std::array<batch<widen_t<int32_t>, A>, 2> widen(batch<int32_t, A> const& x, requires_arch<wasm>) noexcept |
| 1739 | + { |
| 1740 | + return { batch<widen_t<int32_t>, A>(wasm_i64x2_extend_low_i32x4(x)), batch<widen_t<int32_t>, A>(wasm_i64x2_extend_high_i32x4(x)) }; |
| 1741 | + } |
| 1742 | + |
1704 | 1743 | // zip_hi |
1705 | 1744 | template <class A> |
1706 | 1745 | XSIMD_INLINE batch<float, A> zip_hi(batch<float, A> const& self, batch<float, A> const& other, requires_arch<wasm>) noexcept |
|
0 commit comments