Skip to content

Commit d9c8dd4

Browse files
WIP
1 parent 018ebd1 commit d9c8dd4

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,27 @@ namespace xsimd
315315
return vec_extract(self.data, 0);
316316
}
317317

318+
// floor
319+
template <class A, class T, class = typename std::enable_if<std::is_floating_point<T>::value, void>::type>
320+
XSIMD_INLINE batch<T, A> floor(batch<T, A> const& self, requires_arch<altivec>) noexcept
321+
{
322+
return vec_floor(self.data);
323+
}
324+
325+
// fma
326+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
327+
XSIMD_INLINE batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<altivec>) noexcept
328+
{
329+
return vec_madd(x, y, z);
330+
}
331+
332+
// fms
333+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
334+
XSIMD_INLINE batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<altivec>) noexcept
335+
{
336+
return vec_nmsub(x, y, z);
337+
}
338+
318339
// ge
319340
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
320341
XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
@@ -523,14 +544,16 @@ namespace xsimd
523544
return hadd(self, common {});
524545
}
525546

526-
// rsqrt
527-
template <class A>
528-
XSIMD_INLINE batch<float, A> rsqrt(batch<float, A> const& val, requires_arch<altivec>) noexcept
547+
// round
548+
template <class A, class T, class = typename std::enable_if<std::is_floating_point<T>::value, void>::type>
549+
XSIMD_INLINE batch<T, A> round(batch<T, A> const& self, requires_arch<altivec>) noexcept
529550
{
530-
return vec_rsqrt(val.data);
551+
return vec_round(self.data);
531552
}
532-
template <class A>
533-
XSIMD_INLINE batch<double, A> rsqrt(batch<double, A> const& val, requires_arch<altivec>) noexcept
553+
554+
// rsqrt
555+
template <class A, class T, typename std::enable_if<std::is_floating_point<T>::value, void>::type>
556+
XSIMD_INLINE batch<T, A> rsqrt(batch<T, A> const& val, requires_arch<altivec>) noexcept
534557
{
535558
return vec_rsqrt(val.data);
536559
}

0 commit comments

Comments
 (0)