pan/bi: Extract bi_ec0_packed helper

Useful for scheduling decisions as well as packing.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8354>
This commit is contained in:
Alyssa Rosenzweig 2021-01-08 17:49:25 -05:00 committed by Marge Bot
parent 4252fb84f4
commit a8fce919d2
3 changed files with 13 additions and 5 deletions

View file

@ -50,6 +50,17 @@ bi_can_insert_tuple(bi_clause *clause, bool constant)
return (constant_count + tuple_count) <= 13;
}
/* Is embedded constant 0 packed for free in a clause with this many tuples? */
bool
bi_ec0_packed(unsigned tuple_count)
{
return (tuple_count == 3) ||
(tuple_count == 5) ||
(tuple_count == 6) ||
(tuple_count == 8);
}
/* Helper to calculate the number of quadwords in a clause. This is a function
* of the number of instructions and constants; it doesn't require actually
* packing, which is useful for branch offsets.

View file

@ -822,11 +822,7 @@ bi_pack_clause(bi_context *ctx, bi_clause *clause,
&clause->tuples[prev], i == 0, stage);
}
bool ec0_packed =
(clause->tuple_count == 3) ||
(clause->tuple_count == 5) ||
(clause->tuple_count == 6) ||
(clause->tuple_count == 8);
bool ec0_packed = bi_ec0_packed(clause->tuple_count);
if (ec0_packed)
clause->constant_count = MAX2(clause->constant_count, 1);

View file

@ -749,6 +749,7 @@ void bi_invalidate_liveness(bi_context *ctx);
bool bi_can_insert_tuple(bi_clause *clause, bool constant);
unsigned bi_clause_quadwords(bi_clause *clause);
signed bi_block_offset(bi_context *ctx, bi_clause *start, bi_block *target);
bool bi_ec0_packed(unsigned tuple_count);
static inline bool
bi_is_terminal_block(bi_block *block)