mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
util: optimize bitcount on OpenCL
Fixes: bfc18b6fb1 ("libagx: drop libagx_popcount")
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34661>
This commit is contained in:
parent
eecfb02463
commit
d31ad329c2
1 changed files with 4 additions and 0 deletions
|
|
@ -326,6 +326,8 @@ util_bitcount(unsigned n)
|
|||
{
|
||||
#if defined(HAVE___BUILTIN_POPCOUNT)
|
||||
return __builtin_popcount(n);
|
||||
#elif __OPENCL_VERSION__
|
||||
return popcount(n);
|
||||
#else
|
||||
/* K&R classic bitcount.
|
||||
*
|
||||
|
|
@ -366,6 +368,8 @@ util_bitcount64(uint64_t n)
|
|||
{
|
||||
#ifdef HAVE___BUILTIN_POPCOUNTLL
|
||||
return __builtin_popcountll(n);
|
||||
#elif __OPENCL_VERSION__
|
||||
return popcount(n);
|
||||
#else
|
||||
return util_bitcount((unsigned)n) + util_bitcount((unsigned)(n >> 32));
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue