1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Vectorized update min max

This commit is contained in:
Andrey Piskunov
2022-06-29 14:06:43 +03:00
parent 37d8f14250
commit 9930d0dedd
2 changed files with 171 additions and 16 deletions

View File

@ -239,6 +239,18 @@ class SimdFilterProcessor<
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return reinterpret_cast<SimdType>(std::min(reinterpret_cast<int128_t>(x), reinterpret_cast<int128_t>(y)));
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return reinterpret_cast<SimdType>(std::max(reinterpret_cast<int128_t>(x), reinterpret_cast<int128_t>(y)));
}
};
template <typename VT, typename T>
@ -353,6 +365,16 @@ class SimdFilterProcessor<
{
_mm_storeu_pd(reinterpret_cast<T*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_pd(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_pd(x, y);
}
};
template <typename VT, typename T>
@ -467,6 +489,16 @@ class SimdFilterProcessor<
{
_mm_storeu_ps(reinterpret_cast<T*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_ps(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_ps(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -574,6 +606,16 @@ class SimdFilterProcessor<VT, CHECK_T,
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_blendv_epi8(x, y, _mm_cmpgt_epi64(x,y));
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_blendv_epi8(x, y, _mm_cmpgt_epi64(y,x));
}
};
template <typename VT, typename CHECK_T>
@ -684,6 +726,16 @@ class SimdFilterProcessor<VT, CHECK_T,
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_blendv_epi8(x, y, _mm_cmpgt_epi64(x,y));
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_blendv_epi8(x, y, _mm_cmpgt_epi64(y,x));
}
};
template <typename VT, typename CHECK_T>
@ -791,6 +843,16 @@ class SimdFilterProcessor<VT, CHECK_T,
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epi32(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epi32(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -901,6 +963,16 @@ class SimdFilterProcessor<VT, CHECK_T,
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epu32(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epu32(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1007,6 +1079,16 @@ class SimdFilterProcessor<
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epi16(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epi16(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1114,6 +1196,16 @@ class SimdFilterProcessor<
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epu16(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epu16(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1227,6 +1319,16 @@ class SimdFilterProcessor<
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epi8(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epi8(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1340,6 +1442,16 @@ class SimdFilterProcessor<
{
_mm_storeu_si128(reinterpret_cast<SimdType*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return _mm_min_epu8(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return _mm_max_epu8(x, y);
}
};
} // namespace simd