Skip to content

Commit 6e5978c

Browse files
WIP
1 parent f90e5e8 commit 6e5978c

File tree

1 file changed

+14
-70
lines changed

1 file changed

+14
-70
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 14 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ namespace xsimd
179179
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
180180
XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
181181
{
182-
return vec_andc(other, self);
182+
return vec_nand(self, other);
183183
}
184184
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
185185
XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<altivec>) noexcept
186186
{
187-
return vec_andc(other, self);
187+
return vec_nand(self, other);
188188
}
189189

190190
#if 0
@@ -343,38 +343,18 @@ namespace xsimd
343343
}
344344
}
345345

346+
#endif
346347
// bitwise_xor
347-
template <class A>
348-
XSIMD_INLINE batch<float, A> bitwise_xor(batch<float, A> const& self, batch<float, A> const& other, requires_arch<altivec>) noexcept
349-
{
350-
return _mm_xor_ps(self, other);
351-
}
352-
template <class A>
353-
XSIMD_INLINE batch_bool<float, A> bitwise_xor(batch_bool<float, A> const& self, batch_bool<float, A> const& other, requires_arch<altivec>) noexcept
354-
{
355-
return _mm_xor_ps(self, other);
356-
}
357-
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
348+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
358349
XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
359350
{
360-
return _mm_xor_si128(self, other);
361-
}
362-
template <class A>
363-
XSIMD_INLINE batch<double, A> bitwise_xor(batch<double, A> const& self, batch<double, A> const& other, requires_arch<altivec>) noexcept
364-
{
365-
return _mm_xor_pd(self, other);
351+
return vec_xor(self, other);
366352
}
367-
template <class A>
368-
XSIMD_INLINE batch_bool<double, A> bitwise_xor(batch_bool<double, A> const& self, batch_bool<double, A> const& other, requires_arch<altivec>) noexcept
369-
{
370-
return _mm_xor_pd(self, other);
371-
}
372-
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
353+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
373354
XSIMD_INLINE batch<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<altivec>) noexcept
374355
{
375-
return _mm_xor_si128(self, other);
356+
return vec_xor(self, other);
376357
}
377-
#endif
378358

379359
// bitwise_cast
380360
template <class A, class T_in, class T_out>
@@ -383,44 +363,13 @@ namespace xsimd
383363
return *reinterpret_cast<typename batch<T_out, A>::register_type const*>(&self.data);
384364
}
385365

386-
#if 0
387-
388366
// broadcast
389-
template <class A>
390-
batch<float, A> XSIMD_INLINE broadcast(float val, requires_arch<altivec>) noexcept
391-
{
392-
return _mm_set1_ps(val);
393-
}
394-
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
367+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
395368
XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<altivec>) noexcept
396369
{
397-
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
398-
{
399-
return _mm_set1_epi8(val);
400-
}
401-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
402-
{
403-
return _mm_set1_epi16(val);
404-
}
405-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
406-
{
407-
return _mm_set1_epi32(val);
408-
}
409-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
410-
{
411-
return _mm_set1_epi64x(val);
412-
}
413-
else
414-
{
415-
assert(false && "unsupported arch/op combination");
416-
return {};
417-
}
418-
}
419-
template <class A>
420-
XSIMD_INLINE batch<double, A> broadcast(double val, requires_arch<altivec>) noexcept
421-
{
422-
return _mm_set1_pd(val);
370+
return vec_splats(val);
423371
}
372+
#if 0
424373

425374
// store_complex
426375
namespace detail
@@ -573,7 +522,7 @@ namespace xsimd
573522
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
574523
XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<altivec>) noexcept
575524
{
576-
return vec_extract(self, 0);
525+
return vec_extract(self, 0);
577526
}
578527
#if 0
579528

@@ -752,20 +701,15 @@ namespace xsimd
752701
{
753702
return self - batch<T, A>(mask.data);
754703
}
704+
#endif
755705

756706
// insert
757707
template <class A, class T, size_t I, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
758708
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I> pos, requires_arch<altivec>) noexcept
759709
{
760-
XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
761-
{
762-
return _mm_insert_epi16(self, val, I);
763-
}
764-
else
765-
{
766-
return insert(self, val, pos, common {});
767-
}
710+
return vec_insert(val, self, pos);
768711
}
712+
#if 0
769713

770714
// isnan
771715
template <class A>

0 commit comments

Comments
 (0)