pan/midgard: Extend SSA concurrency checks to other args
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 5 Aug 2019 18:22:49 +0000 (11:22 -0700)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 5 Aug 2019 18:22:49 +0000 (11:22 -0700)
No glmark changes, but this seems like a good idea.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
src/panfrost/midgard/midgard_schedule.c

index f59ef260d3686827c8fe1c892602dc41be2ad5f7..f69e86e2f4674e417b11ca43eb85d87b7a61ba4b 100644 (file)
@@ -72,23 +72,22 @@ can_run_concurrent_ssa(midgard_instruction *first, midgard_instruction *second)
         int source_mask = first->mask;
 
         /* As long as the second doesn't read from the first, we're okay */
-        if (second->ssa_args.src[0] == source) {
-                if (first->type == TAG_ALU_4) {
-                        /* Figure out which components we just read from */
-
-                        int q = second->alu.src1;
-                        midgard_vector_alu_src *m = (midgard_vector_alu_src *) &q;
+        for (unsigned i = 0; i < ARRAY_SIZE(second->ssa_args.src); ++i) {
+                if (second->ssa_args.src[i] != source)
+                        continue;
 
-                        /* Check if there are components in common, and fail if so */
-                        if (swizzle_to_access_mask(m->swizzle) & source_mask)
-                                return false;
-                } else
+                if (first->type != TAG_ALU_4)
                         return false;
 
-        }
+                /* Figure out which components we just read from */
 
-        if (second->ssa_args.src[1] == source)
-                return false;
+                int q = (i == 0) ? second->alu.src1 : second->alu.src2;
+                midgard_vector_alu_src *m = (midgard_vector_alu_src *) &q;
+
+                /* Check if there are components in common, and fail if so */
+                if (swizzle_to_access_mask(m->swizzle) & source_mask)
+                        return false;
+        }
 
         /* Otherwise, it's safe in that regard. Another data hazard is both
          * writing to the same place, of course */