pan/bi: Use builder for atomic lowering in scheduler
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 22 Jul 2022 20:00:01 +0000 (16:00 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 2 Sep 2022 16:03:23 +0000 (16:03 +0000)
The last places where sources are appended. Fix them and we can move on.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17794>

src/panfrost/bifrost/bi_schedule.c

index ffd9a7f..778e5b9 100644 (file)
@@ -353,9 +353,11 @@ bi_lower_atom_c(bi_context *ctx, struct bi_clause_state *clause, struct
         if (bi_is_null(pinstr->dest[0]))
                 atom_c->op = BI_OPCODE_ATOM_C_I32;
 
-        pinstr->op = BI_OPCODE_ATOM_CX;
-        pinstr->src[3] = atom_c->src[2];
-        pinstr->nr_srcs = 4;
+        bi_instr *atom_cx = bi_atom_cx_to(&b, pinstr->dest[0], pinstr->src[0],
+                        pinstr->src[1], pinstr->src[2], pinstr->src[0],
+                        pinstr->sr_count);
+        tuple->add = atom_cx;
+        bi_remove_instruction(pinstr);
 
         return atom_c;
 }
@@ -372,12 +374,12 @@ bi_lower_atom_c1(bi_context *ctx, struct bi_clause_state *clause, struct
         if (bi_is_null(pinstr->dest[0]))
                 atom_c->op = BI_OPCODE_ATOM_C1_I32;
 
-        pinstr->op = BI_OPCODE_ATOM_CX;
-        pinstr->src[2] = pinstr->src[1];
-        pinstr->src[1] = pinstr->src[0];
-        pinstr->src[3] = bi_dontcare(&b);
-        pinstr->src[0] = bi_null();
-        pinstr->nr_srcs = 4;
+
+        bi_instr *atom_cx = bi_atom_cx_to(&b, pinstr->dest[0], bi_null(),
+                        pinstr->src[0], pinstr->src[1], bi_dontcare(&b),
+                        pinstr->sr_count);
+        tuple->add = atom_cx;
+        bi_remove_instruction(pinstr);
 
         return atom_c;
 }