1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Tests for simd min/max

This commit is contained in:
Andrey Piskunov
2022-07-01 19:29:11 +03:00
parent 9930d0dedd
commit 1681edaca0
3 changed files with 242 additions and 74 deletions

View File

@ -165,13 +165,13 @@ template <typename T, typename ENABLE=void>
struct TypeToVecWrapperType;
template <typename T>
struct TypeToVecWrapperType<T, typename std::enable_if<std::is_unsigned<T>::value>::type>
struct TypeToVecWrapperType<T, typename std::enable_if<std::is_unsigned<T>::value>::type>
: WidthToVecWrapperType<sizeof(T)>
{
};
template <typename T>
struct TypeToVecWrapperType<T, typename std::enable_if<std::is_signed<T>::value>::type>
struct TypeToVecWrapperType<T, typename std::enable_if<std::is_signed<T>::value>::type>
: WidthToSVecWrapperType<sizeof(T)>
{
};
@ -419,6 +419,16 @@ class SimdFilterProcessor<
{
vst1q_s32(reinterpret_cast<int32_t*>(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>
@ -532,6 +542,16 @@ class SimdFilterProcessor<
{
vst1q_f64(reinterpret_cast<T*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_f64(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_f64(x, y);
}
};
template <typename VT, typename T>
@ -645,6 +665,16 @@ class SimdFilterProcessor<
{
vst1q_f32(reinterpret_cast<T*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_f32(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_f32(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -752,6 +782,16 @@ class SimdFilterProcessor<
{
vst1q_s64(reinterpret_cast<int64_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vbslq_s64(vcgtq_s64(x,y), x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vbslq_s64(vcgtq_s64(y,x), x, y);
}
};
template <typename VT, typename CHECK_T>
@ -859,6 +899,16 @@ class SimdFilterProcessor<
{
vst1q_u64(reinterpret_cast<uint64_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vbslq_u64(vcgtq_u64(x,y), x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vbslq_u64(vcgtq_u64(y,x), x, y);
}
};
template <typename VT, typename CHECK_T>
class SimdFilterProcessor<
@ -965,6 +1015,16 @@ class SimdFilterProcessor<
{
vst1q_s32(reinterpret_cast<int32_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_s32(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_s32(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1072,6 +1132,16 @@ class SimdFilterProcessor<
{
vst1q_u32(reinterpret_cast<uint32_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_u32(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_u32(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1178,6 +1248,16 @@ class SimdFilterProcessor<
{
vst1q_s16(reinterpret_cast<int16_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_s16(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_s16(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1284,6 +1364,16 @@ class SimdFilterProcessor<VT, CHECK_T,
{
vst1q_u16(reinterpret_cast<uint16_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_u16(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_u16(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1389,6 +1479,16 @@ class SimdFilterProcessor<
{
vst1q_s8(reinterpret_cast<int8_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_s8(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_s8(x, y);
}
};
template <typename VT, typename CHECK_T>
@ -1496,6 +1596,16 @@ class SimdFilterProcessor<
{
vst1q_u8(reinterpret_cast<uint8_t*>(dst), x);
}
MCS_FORCE_INLINE SimdType min(SimdType& x, SimdType& y)
{
return vminq_u8(x, y);
}
MCS_FORCE_INLINE SimdType max(SimdType& x, SimdType& y)
{
return vmaxq_u8(x, y);
}
};
}; // namespace simd