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@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2019-04-25 04:25:33 +00:00
parent 5f942db190
commit bcabcfe3ad
3 changed files with 7 additions and 3 deletions

View 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},

View 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) */

View 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) {