diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-11-08 13:27:39 -0500 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-11-14 02:36:21 +0000 |
commit | f72873e6aa098b5fe31a89dc467a3baa981aa442 (patch) | |
tree | 724d0337fc63533065d191fe8d1d91981cb20d1b /src | |
parent | 39b5f2fa0bc904b8a8eff695bdcb8981c7b9a33e (diff) |
pan/midgard: Copypropagate vector creation
total instructions in shared programs: 3457 -> 3431 (-0.75%)
instructions in affected programs: 787 -> 761 (-3.30%)
helped: 14
HURT: 0
helped stats (abs) min: 1 max: 12 x̄: 1.86 x̃: 1
helped stats (rel) min: 1.01% max: 11.11% x̄: 9.22% x̃: 11.11%
95% mean confidence interval for instructions value: -3.55 -0.16
95% mean confidence interval for instructions %-change: -11.41% -7.03%
Instructions are helped.
total bundles in shared programs: 1830 -> 1826 (-0.22%)
bundles in affected programs: 279 -> 275 (-1.43%)
helped: 2
HURT: 0
total quadwords in shared programs: 3144 -> 3121 (-0.73%)
quadwords in affected programs: 645 -> 622 (-3.57%)
helped: 13
HURT: 0
helped stats (abs) min: 1 max: 11 x̄: 1.77 x̃: 1
helped stats (rel) min: 2.09% max: 16.67% x̄: 12.61% x̃: 14.29%
95% mean confidence interval for quadwords value: -3.45 -0.09
95% mean confidence interval for quadwords %-change: -15.43% -9.79%
Quadwords are helped.
total registers in shared programs: 303 -> 301 (-0.66%)
registers in affected programs: 14 -> 12 (-14.29%)
helped: 2
HURT: 0
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/midgard/midgard_opt_copy_prop.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/panfrost/midgard/midgard_opt_copy_prop.c b/src/panfrost/midgard/midgard_opt_copy_prop.c index 7c483b212e5..20e256e6637 100644 --- a/src/panfrost/midgard/midgard_opt_copy_prop.c +++ b/src/panfrost/midgard/midgard_opt_copy_prop.c @@ -25,6 +25,50 @@ #include "compiler.h" #include "midgard_ops.h" +/* Special case for copypropagating the results of vectors */ + +static bool +midgard_opt_copy_prop_reg(compiler_context *ctx, midgard_block *block) +{ + bool progress = false; + + mir_foreach_instr_in_block_safe(block, ins) { + if (ins->type != TAG_ALU_4) continue; + if (!OP_IS_MOVE(ins->alu.op)) continue; + + unsigned from = ins->src[1]; + unsigned to = ins->dest; + + if (!(to & IS_REG)) continue; + if (from & IS_REG) continue; + + if (ins->has_inline_constant) continue; + if (ins->has_constants) continue; + if (mir_nontrivial_source2_mod(ins)) continue; + if (mir_nontrivial_outmod(ins)) continue; + if (!mir_single_use(ctx, ins->src[1])) continue; + + bool bad = false; + + mir_foreach_instr_global(ctx, c) { + if (mir_has_arg(c, ins->src[1])) { + if (ins->mask != c->mask) + bad = true; + } + } + + if (bad) + continue; + + + mir_rewrite_index_dst(ctx, ins->src[1], ins->dest); + mir_remove_instruction(ins); + progress |= true; + } + + return progress; +} + bool midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block) { @@ -90,5 +134,5 @@ midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block) progress |= true; } - return progress; + return progress | midgard_opt_copy_prop_reg(ctx, block); } |