nv50: Extract needed value bits without shifting them before calling bitcount
authorVlad Golovkin <vlad.golovkin.mail@gmail.com>
Mon, 16 Apr 2018 20:50:24 +0000 (23:50 +0300)
committerKarol Herbst <kherbst@redhat.com>
Wed, 2 May 2018 13:12:48 +0000 (15:12 +0200)
This can save one instruction since bitcount doesn't care about specific
bits' positions.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
src/gallium/drivers/nouveau/nv50/nv50_screen.c

index 1db112fa6c71ed9229adeef3ea475735719a6f19..b278a2f11b4120f965cd8df75b36440b9b136a4c 100644 (file)
@@ -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;