From bf3c8e37051758b544fa3f3ba53430b201f1bff3 Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Mon, 4 Oct 2021 12:03:25 +0200 Subject: [PATCH] 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: --- 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;