@@ -65,59 +65,23 @@ namespace xsimd
6565 XSIMD_INLINE batch<T, A> avg(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
6666 template <class A, class T>
6767 XSIMD_INLINE batch<T, A> avgr(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
68+ #endif
6869
6970 // abs
7071 template <class A >
71- XSIMD_INLINE batch<double, A> abs(batch<double, A> const& self, requires_arch<sse2>) noexcept
72- {
73- __m128d sign_mask = _mm_set1_pd(-0.f); // -0.f = 1 << 31
74- return _mm_andnot_pd(sign_mask, self);
75- }
76- template <class A>
77- XSIMD_INLINE batch<float, A> abs(batch<float, A> const& self, requires_arch<sse2>) noexcept
72+ XSIMD_INLINE batch<float , A> abs (batch<float , A> const & self, requires_arch<altivec>) noexcept
7873 {
79- __m128 sign_mask = _mm_set1_ps(-0.f); // -0.f = 1 << 31
80- return _mm_andnot_ps(sign_mask, self);
74+ return vec_abs (self);
8175 }
8276
8377 // add
84- template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
85- XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse2>) noexcept
86- {
87- XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
88- {
89- return _mm_add_epi8(self, other);
90- }
91- else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
92- {
93- return _mm_add_epi16(self, other);
94- }
95- else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
96- {
97- return _mm_add_epi32(self, other);
98- }
99- else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
100- {
101- return _mm_add_epi64(self, other);
102- }
103- else
104- {
105- assert(false && "unsupported arch/op combination");
106- return {};
107- }
108- }
109-
110- template <class A>
111- XSIMD_INLINE batch<float, A> add(batch<float, A> const& self, batch<float, A> const& other, requires_arch<sse2>) noexcept
78+ template <class A , class T , class = typename std::enable_if<std::is_scalar<T>::value, void >::type>
79+ XSIMD_INLINE batch<T, A> add (batch<T, A> const & self, batch<T, A> const & other, requires_arch<altivec>) noexcept
11280 {
113- return _mm_add_ps (self, other);
81+ return vec_add (self, other);
11482 }
11583
116- template <class A>
117- XSIMD_INLINE batch<double, A> add(batch<double, A> const& self, batch<double, A> const& other, requires_arch<sse2>) noexcept
118- {
119- return _mm_add_pd(self, other);
120- }
84+ #if 0
12185
12286 // all
12387 template <class A>
@@ -923,40 +887,22 @@ namespace xsimd
923887 return _mm_cmpunord_pd(self, self);
924888 }
925889
890+ #endif
926891 // load_aligned
927- template <class A>
928- XSIMD_INLINE batch<float, A> load_aligned(float const* mem, convert<float>, requires_arch<sse2>) noexcept
929- {
930- return _mm_load_ps(mem);
931- }
932- template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
933- XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<sse2>) noexcept
934- {
935- return _mm_load_si128((__m128i const*)mem);
936- }
937- template <class A>
938- XSIMD_INLINE batch<double, A> load_aligned(double const* mem, convert<double>, requires_arch<sse2>) noexcept
892+ template <class A , class = typename std::enable_if<std::is_scalar<T>::value, void >::type>
893+ XSIMD_INLINE batch<T, A> load_aligned (T const * mem, convert<T>, requires_arch<altivec>) noexcept
939894 {
940- return _mm_load_pd( mem);
895+ return vec_ld ( 0 , mem);
941896 }
942897
943898 // load_unaligned
944- template <class A>
945- XSIMD_INLINE batch<float, A> load_unaligned(float const* mem, convert<float>, requires_arch<sse2>) noexcept
946- {
947- return _mm_loadu_ps(mem);
948- }
949- template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
950- XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<sse2>) noexcept
899+ template <class A , class T , class = typename std::enable_if<std::is_scalar<T>::value, void >::type>
900+ XSIMD_INLINE batch<T, A> load_unaligned (T const * mem, convert<T>, requires_arch<altivec>) noexcept
951901 {
952- return _mm_loadu_si128((__m128i const*)mem);
953- }
954- template <class A>
955- XSIMD_INLINE batch<double, A> load_unaligned(double const* mem, convert<double>, requires_arch<sse2>) noexcept
956- {
957- return _mm_loadu_pd(mem);
902+ return *(typename batch<T, A>::register_type)mem;
958903 }
959904
905+ #if 0
960906 // load_complex
961907 namespace detail
962908 {
@@ -972,6 +918,8 @@ namespace xsimd
972918 return { _mm_shuffle_pd(hi, lo, _MM_SHUFFLE2(0, 0)), _mm_shuffle_pd(hi, lo, _MM_SHUFFLE2(1, 1)) };
973919 }
974920 }
921+ #endif
922+ #if 0
975923
976924 // le
977925 template <class A>
0 commit comments