Mesa (master): panfrost/midgard: Identify inand

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 25 21:03:13 UTC 2019


Module: Mesa
Branch: master
Commit: bcabcfe3adfa7a0084712804c005dd8bc3c2eb01
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bcabcfe3adfa7a0084712804c005dd8bc3c2eb01

Author: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Date:   Thu Apr 25 04:25:33 2019 +0000

panfrost/midgard: Identify inand

This was previously thought to be inot, but it's actually a bit more
general than that! :)

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>

---

 src/gallium/drivers/panfrost/midgard/helpers.h         | 2 +-
 src/gallium/drivers/panfrost/midgard/midgard.h         | 2 +-
 src/gallium/drivers/panfrost/midgard/midgard_compile.c | 6 +++++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/panfrost/midgard/helpers.h b/src/gallium/drivers/panfrost/midgard/helpers.h
index 116c69b2c14..a7087fd07ee 100644
--- a/src/gallium/drivers/panfrost/midgard/helpers.h
+++ b/src/gallium/drivers/panfrost/midgard/helpers.h
@@ -223,7 +223,7 @@ static struct {
         [midgard_alu_op_ixor]		 = {"ixor", UNITS_ADD | OP_COMMUTES},
         [midgard_alu_op_ilzcnt]		 = {"ilzcnt", UNITS_ADD},
         [midgard_alu_op_ibitcount8]	 = {"ibitcount8", UNITS_ADD},
-        [midgard_alu_op_inot]		 = {"inot", UNITS_MOST},
+        [midgard_alu_op_inand]		 = {"inand", UNITS_MOST},
         [midgard_alu_op_ishl]		 = {"ishl", UNITS_ADD},
         [midgard_alu_op_iasr]		 = {"iasr", UNITS_ADD},
         [midgard_alu_op_ilsr]		 = {"ilsr", UNITS_ADD},
diff --git a/src/gallium/drivers/panfrost/midgard/midgard.h b/src/gallium/drivers/panfrost/midgard/midgard.h
index c7cc5d44d1c..454e30050a0 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard.h
+++ b/src/gallium/drivers/panfrost/midgard/midgard.h
@@ -82,7 +82,7 @@ typedef enum {
         midgard_alu_op_ishl       = 0x6E,
         midgard_alu_op_iand       = 0x70,
         midgard_alu_op_ior        = 0x71,
-        midgard_alu_op_inot       = 0x72,
+        midgard_alu_op_inand      = 0x72, /* ~(a & b), for inot let a = b */
         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) */
diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
index 72455c7dc87..742217c5a97 100644
--- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c
+++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c
@@ -1184,7 +1184,7 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
                 ALU_CASE(iand, iand);
                 ALU_CASE(ior, ior);
                 ALU_CASE(ixor, ixor);
-                ALU_CASE(inot, inot);
+                ALU_CASE(inot, inand);
                 ALU_CASE(ishl, ishl);
                 ALU_CASE(ishr, iasr);
                 ALU_CASE(ushr, ilsr);
@@ -1376,6 +1376,10 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
                 ins.has_constants = true;
                 ins.constants[0] = 0.0f;
                 ins.alu.src2 = vector_alu_srco_unsigned(blank_alu_src_xxxx);
+        } else if (instr->op == nir_op_inot) {
+                /* ~b = ~(b & b), so duplicate the source */
+                ins.ssa_args.src1 = ins.ssa_args.src0;
+                ins.alu.src2 = ins.alu.src1;
         }
 
         if ((opcode_props & UNITS_ALL) == UNIT_VLUT) {




More information about the mesa-commit mailing list