pan/bi: Fix backwards registers ports
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 8 Apr 2020 23:06:27 +0000 (19:06 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 10 Apr 2020 14:53:56 +0000 (16:53 +0200)
Will matter when packing multiple instructions per bundle.

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

src/panfrost/bifrost/bi_pack.c

index ae2a6df30f2fc13b4f9233378d4a79ee96a1117e..61d3b4f1ee2623da32f063537cc7f728c980d8fb 100644 (file)
@@ -87,13 +87,13 @@ bi_print_ports(struct bi_registers *regs)
 
         if (regs->write_fma || regs->write_add) {
                 printf("port 2 (%s): %u\n",
-                                regs->write_fma ? "FMA" : "ADD",
+                                regs->write_add ? "ADD" : "FMA",
                                 regs->port[2]);
         }
 
         if ((regs->write_fma && regs->write_add) || regs->read_port3) {
                 printf("port 3 (%s): %u\n",
-                                regs->read_port3 ? "read" : "ADD",
+                                regs->read_port3 ? "read" : "FMA",
                                 regs->port[3]);
         }
 }
@@ -274,15 +274,15 @@ bi_assign_ports(bi_bundle now, bi_bundle prev)
 
         /* Next, assign writes */
 
-        if (prev.fma && prev.fma->dest & BIR_INDEX_REGISTER) {
-                regs.port[2] = prev.fma->dest & ~BIR_INDEX_REGISTER;
-                regs.write_fma = true;
+        if (prev.add && prev.add->dest & BIR_INDEX_REGISTER && !write_dreg) {
+                regs.port[2] = prev.add->dest & ~BIR_INDEX_REGISTER;
+                regs.write_add = true;
         }
 
-        if (prev.add && prev.add->dest & BIR_INDEX_REGISTER && !write_dreg) {
-                unsigned r = prev.add->dest & ~BIR_INDEX_REGISTER;
+        if (prev.fma && prev.fma->dest & BIR_INDEX_REGISTER) {
+                unsigned r = prev.fma->dest & ~BIR_INDEX_REGISTER;
 
-                if (regs.write_fma) {
+                if (regs.write_add) {
                         /* Scheduler constraint: cannot read 3 and write 2 */
                         assert(!regs.read_port3);
                         regs.port[3] = r;
@@ -290,7 +290,7 @@ bi_assign_ports(bi_bundle now, bi_bundle prev)
                         regs.port[2] = r;
                 }
 
-                regs.write_add = true;
+                regs.write_fma = true;
         }
 
         /* Finally, ensure port 1 > port 0 for the 63-x trick to function */