pan/bi: Make sure we don't print special index as a register

index can have both a SPECIAL flag and PAN_IS_REG (bit 0) set, but we
shouln't treat the index as a register in that case. Let's bail out
early in bi_print_dest_index() when we're passed a special index
that's not a register.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7206>
This commit is contained in:
Boris Brezillon 2020-10-17 11:19:42 +02:00 committed by Marge Bot
parent a194dcc827
commit 74c158011d
1 changed files with 4 additions and 3 deletions

View File

@ -82,16 +82,17 @@ bi_class_name(enum bi_class cl)
static bool
bi_print_dest_index(FILE *fp, bi_instruction *ins, unsigned index)
{
if ((index & BIR_SPECIAL) && (index & BIR_SPECIAL) != BIR_INDEX_REGISTER)
return false;
if (!index)
fprintf(fp, "_");
else if (index & BIR_INDEX_REGISTER)
fprintf(fp, "br%u", index & ~BIR_INDEX_REGISTER);
else if (index & PAN_IS_REG)
fprintf(fp, "r%u", index >> 1);
else if (!(index & BIR_SPECIAL))
fprintf(fp, "%u", (index >> 1) - 1);
else
return false;
fprintf(fp, "%u", (index >> 1) - 1);
return true;
}