Add more missing vectorized casts for int on x86, and remove redundant unit tests

This commit is contained in:
Rasmus Munk Larsen
2023-03-24 16:02:00 +00:00
parent 33e206f714
commit b8b8a26145
5 changed files with 41 additions and 110 deletions

View File

@@ -27,13 +27,14 @@ struct type_casting_traits<float, bool> {
};
template <>
struct type_casting_traits<float, int> {
struct type_casting_traits<float, double> {
enum {
VectorizedCast = 1,
SrcCoeffRatio = 1,
TgtCoeffRatio = 1
TgtCoeffRatio = 2
};
};
#endif
template <>
struct type_casting_traits<int, float> {
@@ -45,14 +46,22 @@ struct type_casting_traits<int, float> {
};
template <>
struct type_casting_traits<float, double> {
struct type_casting_traits<float, int> {
enum {
VectorizedCast = 1,
SrcCoeffRatio = 1,
TgtCoeffRatio = 2
TgtCoeffRatio = 1
};
};
template <>
struct type_casting_traits<double, int> {
enum {
VectorizedCast = 1,
SrcCoeffRatio = 2,
TgtCoeffRatio = 1
};
};
#endif
template <>
struct type_casting_traits<double, float> {
@@ -91,6 +100,12 @@ template<> EIGEN_STRONG_INLINE Packet4f pcast<Packet2d, Packet4f>(const Packet2d
return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6));
}
template<> EIGEN_STRONG_INLINE Packet4i pcast<Packet2d, Packet4i>(const Packet2d& a, const Packet2d& b) {
return _mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps(_mm_cvtpd_epi32(a)),
_mm_castsi128_ps(_mm_cvtpd_epi32(b)),
(1 << 2) | (1 << 6)));
}
template<> EIGEN_STRONG_INLINE Packet2d pcast<Packet4f, Packet2d>(const Packet4f& a) {
// Simply discard the second half of the input
return _mm_cvtps_pd(a);