[5/6] panfrost/midgard: Add ibitcount8 op

Submitted by Alyssa Rosenzweig on April 5, 2019, 5:56 a.m.

Details

Message ID 20190405055627.6251-6-alyssa@rosenzweig.io
State New
Headers show
Series "Document new functionality (tilebuffer, shaders)" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Alyssa Rosenzweig April 5, 2019, 5:56 a.m.
The mechanics of this opcode are a little opaque, but essentially, it's
used in 8-bit mode to do a bit count in parallel of a uint and then
doing a ton of clever iadd/imov ops to recombine.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
 src/gallium/drivers/panfrost/midgard/helpers.h | 1 +
 src/gallium/drivers/panfrost/midgard/midgard.h | 2 ++
 2 files changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/midgard/helpers.h b/src/gallium/drivers/panfrost/midgard/helpers.h
index 6cb00a58d68..4c2be223186 100644
--- a/src/gallium/drivers/panfrost/midgard/helpers.h
+++ b/src/gallium/drivers/panfrost/midgard/helpers.h
@@ -254,6 +254,7 @@  static unsigned alu_opcode_props[256] = {
         [midgard_alu_op_ior]		 = UNITS_ADD,
         [midgard_alu_op_ixor]		 = UNITS_ADD,
         [midgard_alu_op_ilzcnt]		 = UNITS_ADD,
+        [midgard_alu_op_ibitcount8]	 = UNITS_ADD,
         [midgard_alu_op_inot]		 = UNITS_MOST,
         [midgard_alu_op_ishl]		 = UNITS_ADD,
         [midgard_alu_op_iasr]		 = UNITS_ADD,
diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h
index 2698a2b9bc6..cc32b07970e 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -86,6 +86,7 @@  typedef enum {
         midgard_alu_op_iandnot    = 0x74, /* (a, b) -> a & ~b, used for not/b2f */
         midgard_alu_op_ixor       = 0x76,
         midgard_alu_op_ilzcnt     = 0x78, /* Number of zeroes on left. 31 - ilzcnt(x) = findMSB(x) */
+        midgard_alu_op_ibitcount8 = 0x7B, /* Counts bits in 8-bit increments */
         midgard_alu_op_imov       = 0x7B,
         midgard_alu_op_iabs       = 0x7C,
         midgard_alu_op_feq        = 0x80,
@@ -501,6 +502,7 @@  static char *alu_opcode_names[256] = {
         [midgard_alu_op_iandnot]    = "iandnot",
         [midgard_alu_op_ixor]       = "ixor",
         [midgard_alu_op_ilzcnt]     = "ilzcnt",
+        [midgard_alu_op_ibitcount8] = "ibitcount8",
         [midgard_alu_op_feq]        = "feq",
         [midgard_alu_op_fne]        = "fne",
         [midgard_alu_op_flt]        = "flt",