summaryrefslogtreecommitdiffstats
path: root/src/panfrost/midgard
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-02-26 13:50:46 -0500
committerMarge Bot <[email protected]>2020-02-27 21:02:35 +0000
commit21c578027fb25421af750b98bc59ecd59bcfeff4 (patch)
treed3a5fc032001a8cb081b81f1a5736547b26c2f03 /src/panfrost/midgard
parent995e4371055b93aa7dda3caff252b86494ef5893 (diff)
pan/midgard: Allow inverted inverted ops
We'd like to transform `inand.not` back to `iand` and so forth. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3978>
Diffstat (limited to 'src/panfrost/midgard')
-rw-r--r--src/panfrost/midgard/midgard_opt_invert.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/panfrost/midgard/midgard_opt_invert.c b/src/panfrost/midgard/midgard_opt_invert.c
index e11e4c0fdec..b0ca4bd257f 100644
--- a/src/panfrost/midgard/midgard_opt_invert.c
+++ b/src/panfrost/midgard/midgard_opt_invert.c
@@ -113,16 +113,35 @@ mir_is_bitwise(midgard_instruction *ins)
}
}
+static bool
+mir_is_inverted_bitwise(midgard_instruction *ins)
+{
+ switch (ins->alu.op) {
+ case midgard_alu_op_inand:
+ case midgard_alu_op_inor:
+ case midgard_alu_op_inxor:
+ return true;
+ default:
+ return false;
+ }
+}
+
static midgard_alu_op
mir_invert_op(midgard_alu_op op)
{
switch (op) {
case midgard_alu_op_iand:
return midgard_alu_op_inand;
+ case midgard_alu_op_inand:
+ return midgard_alu_op_iand;
case midgard_alu_op_ior:
return midgard_alu_op_inor;
+ case midgard_alu_op_inor:
+ return midgard_alu_op_ior;
case midgard_alu_op_ixor:
return midgard_alu_op_inxor;
+ case midgard_alu_op_inxor:
+ return midgard_alu_op_ixor;
default:
unreachable("Op not invertible");
}
@@ -162,7 +181,7 @@ midgard_opt_fuse_dest_invert(compiler_context *ctx, midgard_block *block)
mir_foreach_instr_in_block_safe(block, ins) {
/* Search for inverted bitwise */
if (ins->type != TAG_ALU_4) continue;
- if (!mir_is_bitwise(ins)) continue;
+ if (!mir_is_bitwise(ins) && !mir_is_inverted_bitwise(ins)) continue;
if (!ins->invert) continue;
ins->alu.op = mir_invert_op(ins->alu.op);