Module: Mesa
Branch: staging/23.0
Commit: f02783909c9ad2931ec065f2cdbf36aed90cca14
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=f02783909c9ad2931ec065f2cdbf36aed90cca14

Author: Iago Toral Quiroga <[email protected]>
Date:   Mon Apr 24 08:48:39 2023 +0200

broadcom/compiler: fix v3d_qpu_uses_sfu

We should check that the alu op is valid before testing the
write address.

Reviewed-by: Alejandro PiƱeiro <[email protected]>
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22593>
(cherry picked from commit 4a3be610d5e5deb47aff1a9fc8bbab85cff9e502)

---

 .pick_status.json            | 2 +-
 src/broadcom/qpu/qpu_instr.c | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 64719b4d55e..2dcd871ea87 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1614,7 +1614,7 @@
         "description": "broadcom/compiler: fix v3d_qpu_uses_sfu",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
diff --git a/src/broadcom/qpu/qpu_instr.c b/src/broadcom/qpu/qpu_instr.c
index a89999e3591..f793d03f681 100644
--- a/src/broadcom/qpu/qpu_instr.c
+++ b/src/broadcom/qpu/qpu_instr.c
@@ -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;
                 }

Reply via email to