Mesa (staging/21.2): ir3: Fix check for immediate range

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 12 17:45:23 UTC 2021


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Mon Oct  4 12:03:25 2021 +0200

ir3: Fix check for immediate range

This would incorrectly allow both e.g. 0x2000 and 0xffffe000 to be
encoded as 0x2000.

Fixes: f0a1f3de278 ("freedreno/ir3: cp small negative integers too")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13142>
(cherry picked from commit bf3c8e37051758b544fa3f3ba53430b201f1bff3)

---

 .pick_status.json          | 2 +-
 src/freedreno/ir3/ir3_cp.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index ac3f0614f66..1c9df148cea 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -40,7 +40,7 @@
         "description": "ir3: Fix check for immediate range",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "f0a1f3de27831d1ccb8a51fc0c99d63f25fd6e2a"
     },
diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c
index 50c43f3303f..2f4acde9759 100644
--- a/src/freedreno/ir3/ir3_cp.c
+++ b/src/freedreno/ir3/ir3_cp.c
@@ -470,7 +470,7 @@ reg_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr,
          /* other than category 1 (mov) we can only encode up to 10 bits: */
          if (ir3_valid_flags(instr, n, new_flags) &&
              ((instr->opc == OPC_MOV) || is_meta(instr) ||
-              !((iim_val & ~0x3ff) && (-iim_val & ~0x3ff)))) {
+              !((iim_val & ~0x1ff) && (-iim_val & ~0x1ff)))) {
             new_flags &= ~(IR3_REG_SABS | IR3_REG_SNEG | IR3_REG_BNOT);
             src_reg = ir3_reg_clone(instr->block->shader, src_reg);
             src_reg->flags = new_flags;



More information about the mesa-commit mailing list