Mesa (master): nv50: Extract needed value bits without shifting them before calling bitcount

Karol Herbst karolherbst at kemper.freedesktop.org
Wed May 2 13:14:22 UTC 2018


Module: Mesa
Branch: master
Commit: 967aabca06fc48ee18e1f4fc534483d45bdcaa70
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=967aabca06fc48ee18e1f4fc534483d45bdcaa70

Author: Vlad Golovkin <vlad.golovkin.mail at gmail.com>
Date:   Mon Apr 16 23:50:24 2018 +0300

nv50: Extract needed value bits without shifting them before calling bitcount

This can save one instruction since bitcount doesn't care about specific
bits' positions.

Reviewed-by: Karol Herbst <kherbst at redhat.com>

---

 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 1db112fa6c..b278a2f11b 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
@@ -992,7 +992,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;
 




More information about the mesa-commit mailing list