broadcom/compiler: fix v3d_qpu_uses_sfu
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 24 Apr 2023 06:48:39 +0000 (08:48 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 09:34:20 +0000 (09:34 +0000)
We should check that the alu op is valid before testing the
write address.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22593>

src/broadcom/qpu/qpu_instr.c

index a89999e..f793d03 100644 (file)
@@ -664,12 +664,14 @@ v3d_qpu_uses_sfu(const struct v3d_qpu_instr *inst)
                 return true;
 
         if (inst->type == V3D_QPU_INSTR_TYPE_ALU) {
-                if (inst->alu.add.magic_write &&
+                if (inst->alu.add.op != V3D_QPU_A_NOP &&
+                    inst->alu.add.magic_write &&
                     v3d_qpu_magic_waddr_is_sfu(inst->alu.add.waddr)) {
                         return true;
                 }
 
-                if (inst->alu.mul.magic_write &&
+                if (inst->alu.mul.op != V3D_QPU_M_NOP &&
+                    inst->alu.mul.magic_write &&
                     v3d_qpu_magic_waddr_is_sfu(inst->alu.mul.waddr)) {
                         return true;
                 }