1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Add missing ”v_popcount“ for RVV and enable tests.

This commit is contained in:
Liutong HAN
2023-07-11 16:10:27 +08:00
parent c982be3924
commit a00818047f
2 changed files with 11 additions and 0 deletions
@@ -1651,6 +1651,10 @@ inline v_uint32 v_popcount(const v_uint32& a)
{
return v_hadd(v_hadd(v_popcount(vreinterpret_u8m1(a))));
}
inline v_uint64 v_popcount(const v_uint64& a)
{
return v_hadd(v_hadd(v_hadd(v_popcount(vreinterpret_u8m1(a)))));
}
inline v_uint8 v_popcount(const v_int8& a)
{
@@ -1664,6 +1668,11 @@ inline v_uint32 v_popcount(const v_int32& a)
{
return v_popcount(v_abs(a));\
}
inline v_uint64 v_popcount(const v_int64& a)
{
// max(0 - a) is used, since v_abs does not support 64-bit integers.
return v_popcount(v_reinterpret_as_u64(vmax(a, v_sub(v_setzero_s64(), a), VTraits<v_int64>::vlanes())));
}
//////////// SignMask ////////////