[Mesa-dev] [PATCH] nv50: Extract needed value bits without shifting them before calling bitcount

Vlad Golovkin vlad.golovkin.mail at gmail.com
Mon Apr 16 20:50:24 UTC 2018


This can save one instruction since bitcount doesn't care about specific
bits' positions.
---
 src/gallium/drivers/nouveau/nv50/nv50_screen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
index 6fd2982e3c..98eb0309ad 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -982,7 +982,7 @@ nv50_screen_create(struct nouveau_device *dev)
    nouveau_getparam(dev, NOUVEAU_GETPARAM_GRAPH_UNITS, &value);
 
    screen->TPs = util_bitcount(value & 0xffff);
-   screen->MPsInTP = util_bitcount((value >> 24) & 0xf);
+   screen->MPsInTP = util_bitcount(value & 0x0f000000);
 
    screen->mp_count = screen->TPs * screen->MPsInTP;
 
-- 
2.14.1



More information about the mesa-dev mailing list