Mesa (main): ir3: Fix check for immediate range

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 12 12:25:05 UTC 2021


Module: Mesa
Branch: main
Commit: bf3c8e37051758b544fa3f3ba53430b201f1bff3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf3c8e37051758b544fa3f3ba53430b201f1bff3

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>

---

 src/freedreno/ir3/ir3_cp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c
index e7e5ec68c7c..e345417c914 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