|
17 | 17 | #include <type_traits> |
18 | 18 |
|
19 | 19 | #include "../types/xsimd_vsx_register.hpp" |
| 20 | +#include "./common/xsimd_common_cast.hpp" |
20 | 21 |
|
21 | 22 | #include <endian.h> |
22 | 23 |
|
@@ -873,6 +874,20 @@ namespace xsimd |
873 | 874 | return vec_trunc(self.data); |
874 | 875 | } |
875 | 876 |
|
| 877 | + // widen |
| 878 | + template <class A> |
| 879 | + XSIMD_INLINE std::array<batch<double, A>, 2> widen(batch<float, A> const& x, requires_arch<vsx>) noexcept |
| 880 | + { |
| 881 | + return { batch<double, A>(vec_doublel(x.data)), batch<double, A>(vec_doubleh(x.data)) }; |
| 882 | + } |
| 883 | + template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value>::type> |
| 884 | + XSIMD_INLINE std::array<batch<widen_t<T>, A>, 2> widen(batch<T, A> const& x, requires_arch<vsx>) noexcept |
| 885 | + { |
| 886 | + auto even = vec_mule(x.data, vec_splats(T(1))); // x0, x2, x4, x6 |
| 887 | + auto odd = vec_mulo(x.data, vec_splats(T(1))); // x1, x3, x5, x7 |
| 888 | + return { batch<widen_t<T>, A>(vec_mergel(even, odd)), batch<widen_t<T>, A>(vec_mergeh(even, odd)) }; |
| 889 | + } |
| 890 | + |
876 | 891 | // zip_hi |
877 | 892 | template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value>::type> |
878 | 893 | XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept |
|
0 commit comments