mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #23966 from hanliutong:popcount
Add missing ”v_popcount“ for RVV and enable tests.
This commit is contained in:
commit
bd2695f01b
@ -1651,6 +1651,10 @@ inline v_uint32 v_popcount(const v_uint32& a)
|
|||||||
{
|
{
|
||||||
return v_hadd(v_hadd(v_popcount(vreinterpret_u8m1(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)
|
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));\
|
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 ////////////
|
//////////// SignMask ////////////
|
||||||
|
@ -2048,6 +2048,7 @@ void test_hal_intrin_uint64()
|
|||||||
.test_rotate<0>().test_rotate<1>()
|
.test_rotate<0>().test_rotate<1>()
|
||||||
.test_extract_n<0>().test_extract_n<1>()
|
.test_extract_n<0>().test_extract_n<1>()
|
||||||
.test_extract_highest()
|
.test_extract_highest()
|
||||||
|
.test_popcount()
|
||||||
//.test_broadcast_element<0>().test_broadcast_element<1>()
|
//.test_broadcast_element<0>().test_broadcast_element<1>()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -2069,6 +2070,7 @@ void test_hal_intrin_int64()
|
|||||||
.test_extract_highest()
|
.test_extract_highest()
|
||||||
//.test_broadcast_element<0>().test_broadcast_element<1>()
|
//.test_broadcast_element<0>().test_broadcast_element<1>()
|
||||||
.test_cvt64_double()
|
.test_cvt64_double()
|
||||||
|
.test_popcount()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user