v3d: Make sure that QPU instruction-has-a-dest matches VIR.
authorEric Anholt <eric@anholt.net>
Thu, 2 Aug 2018 00:47:13 +0000 (17:47 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 6 Aug 2018 20:03:23 +0000 (13:03 -0700)
Found when debugging register spilling -- we would try to spill the dest
of a STVPMV, inserting spill code after entering the last segment.  In
fact, we were likely to to choose to do this, given that the STVPMV "dest"
temp was never read from, making it cheap to spill.

Cc: "18.2" <mesa-stable@lists.freedesktop.org>
src/broadcom/compiler/v3d_compiler.h
src/broadcom/compiler/vir.c

index 33a9942734d0e80c4d459f08d7189e7dc0080b4e..70edeed273009fe62f8233aa9b8b3caf88d446a9 100644 (file)
@@ -928,7 +928,7 @@ VIR_A_ALU2(OR)
 VIR_A_ALU2(XOR)
 VIR_A_ALU2(VADD)
 VIR_A_ALU2(VSUB)
-VIR_A_ALU2(STVPMV)
+VIR_A_NODST_2(STVPMV)
 VIR_A_ALU1(NOT)
 VIR_A_ALU1(NEG)
 VIR_A_ALU1(FLAPUSH)
index 86379faa5bb76073a73af40bc58176a88bd28dd7..fc0b34d4453280e7eff608156b9918c51248aa54 100644 (file)
@@ -452,6 +452,16 @@ vir_emit_def(struct v3d_compile *c, struct qinst *inst)
 {
         assert(inst->dst.file == QFILE_NULL);
 
+        /* If we're emitting an instruction that's a def, it had better be
+         * writing a register.
+         */
+        if (inst->qpu.type == V3D_QPU_INSTR_TYPE_ALU) {
+                assert(inst->qpu.alu.add.op == V3D_QPU_A_NOP ||
+                       v3d_qpu_add_op_has_dst(inst->qpu.alu.add.op));
+                assert(inst->qpu.alu.mul.op == V3D_QPU_M_NOP ||
+                       v3d_qpu_mul_op_has_dst(inst->qpu.alu.mul.op));
+        }
+
         inst->dst = vir_get_temp(c);
 
         if (inst->dst.file == QFILE_TEMP)