Skip to content

Commit 657c973

Browse files
WIP
1 parent c586776 commit 657c973

File tree

2 files changed

+12
-50
lines changed

2 files changed

+12
-50
lines changed

include/xsimd/arch/xsimd_altivec.hpp

Lines changed: 9 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,25 +1115,15 @@ namespace xsimd
11151115
{
11161116
return _mm_min_pd(self, other);
11171117
}
1118+
#endif
11181119

11191120
// mul
1120-
template <class A>
1121-
XSIMD_INLINE batch<float, A> mul(batch<float, A> const& self, batch<float, A> const& other, requires_arch<sse2>) noexcept
1122-
{
1123-
return _mm_mul_ps(self, other);
1124-
}
1125-
template <class A>
1126-
XSIMD_INLINE batch<double, A> mul(batch<double, A> const& self, batch<double, A> const& other, requires_arch<sse2>) noexcept
1127-
{
1128-
return _mm_mul_pd(self, other);
1129-
}
1130-
1131-
// mul
1132-
template <class A>
1133-
XSIMD_INLINE batch<int16_t, A> mul(batch<int16_t, A> const& self, batch<int16_t, A> const& other, requires_arch<sse2>) noexcept
1121+
template <class A, class T, typename std::enable_if<std::is_scalar<T>::value, void>::type>
1122+
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
11341123
{
1135-
return _mm_mullo_epi16(self, other);
1124+
return vec_mul(self, other);
11361125
}
1126+
#if 0
11371127

11381128
// nearbyint_as_int
11391129
template <class A>
@@ -1479,44 +1469,14 @@ namespace xsimd
14791469
*(typename batch<T, A>::register_type)mem = self;
14801470
}
14811471

1482-
#if 0
14831472
// sub
1484-
template <class A>
1485-
XSIMD_INLINE batch<float, A> sub(batch<float, A> const& self, batch<float, A> const& other, requires_arch<sse2>) noexcept
1486-
{
1487-
return _mm_sub_ps(self, other);
1488-
}
1489-
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
1490-
XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<sse2>) noexcept
1491-
{
1492-
XSIMD_IF_CONSTEXPR(sizeof(T) == 1)
1493-
{
1494-
return _mm_sub_epi8(self, other);
1495-
}
1496-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
1497-
{
1498-
return _mm_sub_epi16(self, other);
1499-
}
1500-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
1501-
{
1502-
return _mm_sub_epi32(self, other);
1503-
}
1504-
else XSIMD_IF_CONSTEXPR(sizeof(T) == 8)
1505-
{
1506-
return _mm_sub_epi64(self, other);
1507-
}
1508-
else
1509-
{
1510-
assert(false && "unsupported arch/op combination");
1511-
return {};
1512-
}
1513-
}
1514-
template <class A>
1515-
XSIMD_INLINE batch<double, A> sub(batch<double, A> const& self, batch<double, A> const& other, requires_arch<sse2>) noexcept
1473+
template <class A, class T, class = typename std::enable_if<std::is_scalar<T>::value, void>::type>
1474+
XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<altivec>) noexcept
15161475
{
1517-
return _mm_sub_pd(self, other);
1476+
return vec_sub(self, other);
15181477
}
15191478

1479+
#if 0
15201480
// swizzle
15211481

15221482
template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>

include/xsimd/config/xsimd_arch.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,16 @@ namespace xsimd
169169
using all_sve_architectures = arch_list<detail::sve<512>, detail::sve<256>, detail::sve<128>>;
170170
using all_rvv_architectures = arch_list<detail::rvv<512>, detail::rvv<256>, detail::rvv<128>>;
171171
using all_arm_architectures = typename detail::join<all_sve_architectures, arch_list<i8mm<neon64>, neon64, neon>>::type;
172+
using all_power_architectures = arch_list<altivec>;
172173
using all_riscv_architectures = all_rvv_architectures;
173174
using all_wasm_architectures = arch_list<wasm>;
174-
using all_architectures = typename detail::join<all_riscv_architectures, all_wasm_architectures, all_arm_architectures, all_x86_architectures>::type;
175+
using all_architectures = typename detail::join<all_power_architectures, all_riscv_architectures, all_wasm_architectures, all_arm_architectures, all_x86_architectures>::type;
175176

176177
using supported_architectures = typename detail::supported<all_architectures>::type;
177178

178179
using x86_arch = typename detail::supported<all_x86_architectures>::type::best;
179180
using arm_arch = typename detail::supported<all_arm_architectures>::type::best;
181+
using power_arch = typename detail::supported<all_power_architectures>::type::best;
180182
using riscv_arch = typename detail::supported<all_riscv_architectures>::type::best;
181183
using best_arch = typename supported_architectures::best;
182184

0 commit comments

Comments
 (0)