pan/midgard: Extract simple source mod check
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 26 Jul 2019 18:52:30 +0000 (11:52 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 30 Jul 2019 17:35:09 +0000 (10:35 -0700)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/compiler.h
src/panfrost/midgard/midgard_compile.c
src/panfrost/midgard/mir.c

index decffeb2f70428ff42ea94243c19c5a1f3c1f266..ba5bc75810b034a6b9826ef4fb7b046ab1d93d24 100644 (file)
@@ -443,8 +443,8 @@ void mir_print_instruction(midgard_instruction *ins);
 void mir_print_bundle(midgard_bundle *ctx);
 void mir_print_block(midgard_block *block);
 void mir_print_shader(compiler_context *ctx);
-bool mir_nontrivial_raw_mod(midgard_vector_alu_src src, bool is_int);
 bool mir_nontrivial_source2_mod(midgard_instruction *ins);
+bool mir_nontrivial_source2_mod_simple(midgard_instruction *ins);
 bool mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask);
 bool mir_nontrivial_outmod(midgard_instruction *ins);
 
index ae526e89effd4495fe586232c0fedcf62e8bb8ea..f3842820f3d0bb8596d277dad499ae9e2170f6d1 100644 (file)
@@ -1877,8 +1877,7 @@ embedded_to_inline_constant(compiler_context *ctx)
 
                         /* We don't know how to handle these with a constant */
 
-                        bool is_int = midgard_is_integer_op(ins->alu.op);
-                        if (mir_nontrivial_raw_mod(*src, is_int) || src->half || src->rep_low || src->rep_high) {
+                        if (mir_nontrivial_source2_mod_simple(ins) || src->rep_low || src->rep_high) {
                                 DBG("Bailing inline constant...\n");
                                 continue;
                         }
index 2d100728724fdf7be659951b593c4f559510d253..225b0680f3fac00c0a8afa2cbddae41447dd6420 100644 (file)
@@ -108,7 +108,7 @@ mir_single_use(compiler_context *ctx, unsigned value)
         return mir_use_count(ctx, value) <= 1;
 }
 
-bool
+static bool
 mir_nontrivial_raw_mod(midgard_vector_alu_src src, bool is_int)
 {
         if (is_int)
@@ -133,6 +133,7 @@ mir_nontrivial_mod(midgard_vector_alu_src src, bool is_int, unsigned mask)
 
         return false;
 }
+
 bool
 mir_nontrivial_source2_mod(midgard_instruction *ins)
 {
@@ -144,6 +145,17 @@ mir_nontrivial_source2_mod(midgard_instruction *ins)
         return mir_nontrivial_mod(src2, is_int, ins->mask);
 }
 
+bool
+mir_nontrivial_source2_mod_simple(midgard_instruction *ins)
+{
+        bool is_int = midgard_is_integer_op(ins->alu.op);
+
+        midgard_vector_alu_src src2 =
+                vector_alu_from_unsigned(ins->alu.src2);
+
+        return mir_nontrivial_raw_mod(src2, is_int) && !src2.half;
+}
+
 bool
 mir_nontrivial_outmod(midgard_instruction *ins)
 {