pan/bi: Pull out bi_count_write_registers

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>
This commit is contained in:
Alyssa Rosenzweig
2021-05-04 17:20:45 -04:00
committed by Marge Bot
parent 02832f9d03
commit 6f51bd99f2
2 changed files with 12 additions and 9 deletions
+11 -9
View File
@@ -93,22 +93,24 @@ bi_count_read_registers(bi_instr *ins, unsigned s)
}
unsigned
bi_writemask(bi_instr *ins, unsigned d)
bi_count_write_registers(bi_instr *ins, unsigned d)
{
/* Assume we write a scalar */
unsigned mask = 0xF;
if (d == 0 && bi_opcode_props[ins->op].sr_write) {
unsigned count = bi_count_staging_registers(ins);
/* TODO: this special case is even more special, TEXC has a
* generic write mask stuffed in the desc... */
if (ins->op == BI_OPCODE_TEXC)
count = 4;
mask = (1 << (count * 4)) - 1;
return 4;
else
return bi_count_staging_registers(ins);
}
return 1;
}
unsigned
bi_writemask(bi_instr *ins, unsigned d)
{
unsigned mask = BITFIELD_MASK(bi_count_write_registers(ins, d) * 4);
unsigned shift = ins->dest[d].offset * 4; /* 32-bit words */
return (mask << shift);
}
+1
View File
@@ -756,6 +756,7 @@ pan_next_block(pan_block *block)
bool bi_has_arg(bi_instr *ins, bi_index arg);
unsigned bi_count_read_registers(bi_instr *ins, unsigned src);
unsigned bi_count_write_registers(bi_instr *ins, unsigned dest);
unsigned bi_writemask(bi_instr *ins, unsigned dest);
bi_clause * bi_next_clause(bi_context *ctx, pan_block *block, bi_clause *clause);
bool bi_side_effects(enum bi_opcode op);