Skip to content

Commit 1bd2ce7

Browse files
fast-cast
1 parent b5ab4f1 commit 1bd2ce7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,24 +255,32 @@ namespace xsimd
255255
return vec_div(self, other);
256256
}
257257

258-
#if 0
259-
260258
// fast_cast
261259
namespace detail
262260
{
263261
template <class A>
264262
XSIMD_INLINE batch<float, A> fast_cast(batch<int32_t, A> const& self, batch<float, A> const&, requires_arch<altivec>) noexcept
265263
{
266-
return _mm_cvtepi32_ps(self);
264+
return vec_ctf(self.data, 0);
265+
}
266+
template <class A>
267+
XSIMD_INLINE batch<float, A> fast_cast(batch<uint32_t, A> const& self, batch<float, A> const&, requires_arch<altivec>) noexcept
268+
{
269+
return vec_ctf(self.data, 0);
267270
}
268271

269272
template <class A>
270273
XSIMD_INLINE batch<int32_t, A> fast_cast(batch<float, A> const& self, batch<int32_t, A> const&, requires_arch<altivec>) noexcept
271274
{
272-
return _mm_cvttps_epi32(self);
275+
return vec_cts(self.data, 0);
276+
}
277+
278+
template <class A>
279+
XSIMD_INLINE batch<uint32_t, A> fast_cast(batch<float, A> const& self, batch<uint32_t, A> const&, requires_arch<altivec>) noexcept
280+
{
281+
return vec_ctu(self.data, 0);
273282
}
274283
}
275-
#endif
276284

277285
// eq
278286
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>

0 commit comments

Comments
 (0)