[Nouveau] [PATCH 3/4] nvc0/ir: Handle OP_POPCNT when folding constant expressions

Tobias Klausmann tobias.johannes.klausmann at mni.thm.de
Thu May 29 12:43:55 PDT 2014


Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 93f7c2a..68b9a6d 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -546,6 +546,16 @@ ConstantFolding::expr(Instruction *i,
       }
       break;
    }
+   case OP_POPCNT: {
+      switch (i->dType) {
+      case TYPE_S32:
+      case TYPE_U32:
+         res.data.u32 = util_bitcount(a->data.u32 & b->data.u32); break;
+      default:
+        return;
+      }
+      break;
+   }
    default:
       return;
    }
-- 
1.8.4.5



More information about the Nouveau mailing list