From cb6dea6b4dcb665a917c03de2a174410410af8f6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 25 Jul 2019 15:33:56 -0700 Subject: [PATCH] pan/midgard: Share mir_nontrivial_outmod To be used with redundant move elimination. Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/compiler.h | 1 + src/panfrost/midgard/midgard_opt_copy_prop.c | 16 ---------------- src/panfrost/midgard/mir.c | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index d3f1004d93c..034a256589a 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -390,6 +390,7 @@ void mir_print_block(midgard_block *block); void mir_print_shader(compiler_context *ctx); bool mir_nontrivial_source2_mod(midgard_instruction *ins); bool mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask); +bool mir_nontrivial_outmod(midgard_instruction *ins); /* MIR goodies */ diff --git a/src/panfrost/midgard/midgard_opt_copy_prop.c b/src/panfrost/midgard/midgard_opt_copy_prop.c index 30fe1c7cb4f..32d830d6ac7 100644 --- a/src/panfrost/midgard/midgard_opt_copy_prop.c +++ b/src/panfrost/midgard/midgard_opt_copy_prop.c @@ -25,22 +25,6 @@ #include "compiler.h" #include "midgard_ops.h" -static bool -mir_nontrivial_outmod(midgard_instruction *ins) -{ - bool is_int = midgard_is_integer_op(ins->alu.op); - unsigned mod = ins->alu.outmod; - - /* Type conversion is a sort of outmod */ - if (ins->alu.dest_override != midgard_dest_override_none) - return true; - - if (is_int) - return mod != midgard_outmod_int_wrap; - else - return mod != midgard_outmod_none; -} - bool midgard_opt_copy_prop(compiler_context *ctx, midgard_block *block) { diff --git a/src/panfrost/midgard/mir.c b/src/panfrost/midgard/mir.c index 2c2d2fc8345..d8e52982b68 100644 --- a/src/panfrost/midgard/mir.c +++ b/src/panfrost/midgard/mir.c @@ -140,6 +140,22 @@ mir_nontrivial_source2_mod(midgard_instruction *ins) return mir_nontrivial_mod(src2, is_int, ins->mask); } +bool +mir_nontrivial_outmod(midgard_instruction *ins) +{ + bool is_int = midgard_is_integer_op(ins->alu.op); + unsigned mod = ins->alu.outmod; + + /* Type conversion is a sort of outmod */ + if (ins->alu.dest_override != midgard_dest_override_none) + return true; + + if (is_int) + return mod != midgard_outmod_int_wrap; + else + return mod != midgard_outmod_none; +} + /* Checks if an index will be used as a special register -- basically, if we're * used as the input to a non-ALU op */ -- 2.30.2