panfrost/midgard: Add ilzcnt op
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Fri, 5 Apr 2019 05:34:03 +0000 (05:34 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 7 Apr 2019 16:00:39 +0000 (16:00 +0000)
Used for implementing findLSB/MSB

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/helpers.h
src/gallium/drivers/panfrost/midgard/midgard.h

index 0ef5dac51d4bea50c9590de4b3944cbf2affae0a..6cb00a58d685f072459814e96a9d380abab684b6 100644 (file)
@@ -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,
index 0f963b9b3b1632c4d7841fb6f9c05fdec4c9347b..2698a2b9bc6726b994d32281baa05b19af76fc11 100644 (file)
@@ -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",