@@ -61,11 +61,11 @@ namespace xsimd
6161 XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<common>) noexcept;
6262 template <class A, typename T, typename ITy, ITy... Indices>
6363 XSIMD_INLINE batch<T, A> shuffle(batch<T, A> const& x, batch<T, A> const& y, batch_constant<ITy, A, Indices...>, requires_arch<common>) noexcept;
64+ #endif
6465 template <class A , class T >
6566 XSIMD_INLINE batch<T, A> avg (batch<T, A> const &, batch<T, A> const &, requires_arch<common>) noexcept ;
6667 template <class A , class T >
6768 XSIMD_INLINE batch<T, A> avgr (batch<T, A> const &, batch<T, A> const &, requires_arch<common>) noexcept ;
68- #endif
6969
7070 // abs
7171 template <class A >
@@ -107,6 +107,11 @@ namespace xsimd
107107 {
108108 return vec_avg (self.data , other.data );
109109 }
110+ template <class A , class T , class = typename std::enable_if<std::is_floating_point<T>::value, void >::type>
111+ XSIMD_INLINE batch<T, A> avgr (batch<T, A> const & self, batch<T, A> const & other, requires_arch<altivec>) noexcept
112+ {
113+ return avgr (self, other, common {});
114+ }
110115
111116 // avg
112117 template <class A , class T , class = typename std::enable_if<std::is_integral<T>::value, void >::type>
@@ -116,6 +121,11 @@ namespace xsimd
116121 auto adj = ((self ^ other) << nbit) >> nbit;
117122 return avgr (self, other, A {}) - adj;
118123 }
124+ template <class A , class T , class = typename std::enable_if<std::is_floating_point<T>::value, void >::type>
125+ XSIMD_INLINE batch<T, A> avg (batch<T, A> const & self, batch<T, A> const & other, requires_arch<altivec>) noexcept
126+ {
127+ return avg (self, other, common {});
128+ }
119129
120130 // batch_bool_cast
121131 template <class A , class T_out , class T_in >
@@ -439,6 +449,14 @@ namespace xsimd
439449 return vec_add (tmp6, tmp7);
440450 }
441451
452+ template <class A >
453+ XSIMD_INLINE batch<double , A> haddp (batch<double , A> const * row, requires_arch<altivec>) noexcept
454+ {
455+ auto tmp0 = vec_mergee (row[0 ].data , row[1 ].data ); // v00 v10 v02 v12
456+ auto tmp1 = vec_mergeo (row[0 ].data , row[1 ].data ); // v01 v11 v03 v13
457+ return vec_add (tmp0, tmp1);
458+ }
459+
442460 // incr_if
443461 template <class A , class T , class = typename std::enable_if<std::is_integral<T>::value, void >::type>
444462 XSIMD_INLINE batch<T, A> incr_if (batch<T, A> const & self, batch_bool<T, A> const & mask, requires_arch<altivec>) noexcept
0 commit comments