panfrost/midgard: Identify inand
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 25 Apr 2019 04:25:33 +0000 (04:25 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Thu, 25 Apr 2019 20:37:45 +0000 (20:37 +0000)
This was previously thought to be inot, but it's actually a bit more
general than that! :)

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

index 116c69b2c14f27630451a7c2f1e53ace42bfb662..a7087fd07eee2119adba94f92848bf3fe71fc656 100644 (file)
@@ -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},
index c7cc5d44d1ca4b445718403088d02738556385cc..454e30050a011fe7a0e818aa85a20239d0e2ae23 100644 (file)
@@ -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) */
index 72455c7dc87022337c6b114b48b27b7fb7443afc..742217c5a97e932830a96f33ff470faaf1abf1a6 100644 (file)
@@ -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) {