ir3: Fix check for immediate range

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

Fixes: f0a1f3de27 ("freedreno/ir3: cp small negative integers too")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13142>
This commit is contained in:
Connor Abbott 2021-10-04 12:03:25 +02:00 committed by Marge Bot
parent 6dc56f18bc
commit bf3c8e3705

View file

@ -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;