[Mesa-dev] [PATCH 4/6] panfrost/midgard: Add ilzcnt op

Alyssa Rosenzweig alyssa at rosenzweig.io
Fri Apr 5 05:56:25 UTC 2019


Used for implementing findLSB/MSB

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

diff --git a/src/gallium/drivers/panfrost/midgard/helpers.h b/src/gallium/drivers/panfrost/midgard/helpers.h
index 0ef5dac51d4..6cb00a58d68 100644
--- a/src/gallium/drivers/panfrost/midgard/helpers.h
+++ b/src/gallium/drivers/panfrost/midgard/helpers.h
@@ -253,6 +253,7 @@ static unsigned alu_opcode_props[256] = {
         [midgard_alu_op_iand]		 = UNITS_ADD, /* XXX: Test case where it's right on smul but not sadd */
         [midgard_alu_op_ior]		 = UNITS_ADD,
         [midgard_alu_op_ixor]		 = UNITS_ADD,
+        [midgard_alu_op_ilzcnt]		 = 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 0f963b9b3b1..2698a2b9bc6 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -85,6 +85,7 @@ typedef enum {
         midgard_alu_op_inot       = 0x72,
         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_imov       = 0x7B,
         midgard_alu_op_iabs       = 0x7C,
         midgard_alu_op_feq        = 0x80,
@@ -499,6 +500,7 @@ static char *alu_opcode_names[256] = {
         [midgard_alu_op_inot]       = "inot",
         [midgard_alu_op_iandnot]    = "iandnot",
         [midgard_alu_op_ixor]       = "ixor",
+        [midgard_alu_op_ilzcnt]     = "ilzcnt",
         [midgard_alu_op_feq]        = "feq",
         [midgard_alu_op_fne]        = "fne",
         [midgard_alu_op_flt]        = "flt",
-- 
2.20.1



More information about the mesa-dev mailing list