agx: Dynamically size split instruction
This is more flexible. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804>
This commit is contained in:

committed by
Marge Bot

parent
7c9fba34bc
commit
82e8e709cb
@@ -208,13 +208,12 @@ agx_block_add_successor(agx_block *block, agx_block *successor)
|
||||
static void
|
||||
agx_emit_split(agx_builder *b, agx_index *dests, agx_index vec, unsigned n)
|
||||
{
|
||||
/* Setup the destinations */
|
||||
for (unsigned i = 0; i < n; ++i) {
|
||||
dests[i] = agx_temp(b->shader, vec.size);
|
||||
}
|
||||
agx_instr *I = agx_split(b, n, vec);
|
||||
|
||||
/* Emit the split */
|
||||
agx_split_to(b, dests[0], dests[1], dests[2], dests[3], vec);
|
||||
agx_foreach_dest(I, d) {
|
||||
dests[d] = agx_temp(b->shader, vec.size);
|
||||
I->dest[d] = dests[d];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -255,7 +254,10 @@ agx_umul_high_to(agx_builder *b, agx_index dst, agx_index P, agx_index Q)
|
||||
|
||||
agx_index product = agx_temp(b->shader, P.size + 1);
|
||||
agx_imad_to(b, product, agx_abs(P), agx_abs(Q), agx_zero(), 0);
|
||||
return agx_split_to(b, agx_null(), dst, agx_null(), agx_null(), product);
|
||||
|
||||
agx_instr *split = agx_split(b, 2, product);
|
||||
split->dest[1] = dst;
|
||||
return split;
|
||||
}
|
||||
|
||||
static agx_index
|
||||
|
@@ -209,9 +209,6 @@ agx_is_equiv(agx_index left, agx_index right)
|
||||
return (left.type == right.type) && (left.value == right.value);
|
||||
}
|
||||
|
||||
#define AGX_MAX_DESTS 4
|
||||
#define AGX_MAX_SRCS 5
|
||||
|
||||
enum agx_icond {
|
||||
AGX_ICOND_UEQ = 0,
|
||||
AGX_ICOND_ULT = 1,
|
||||
|
@@ -266,7 +266,7 @@ op("or", _, srcs = 2)
|
||||
op("logical_end", _, dests = 0, srcs = 0, can_eliminate = False)
|
||||
|
||||
op("combine", _, srcs = VARIABLE)
|
||||
op("split", _, srcs = 1, dests = 4)
|
||||
op("split", _, srcs = 1, dests = VARIABLE)
|
||||
op("phi", _, srcs = VARIABLE)
|
||||
|
||||
op("unit_test", _, dests = 0, srcs = 1, can_eliminate = False)
|
||||
|
@@ -121,7 +121,7 @@ agx_print_instr(agx_instr *I, FILE *fp)
|
||||
|
||||
bool print_comma = false;
|
||||
|
||||
for (unsigned d = 0; d < info.nr_dests; ++d) {
|
||||
agx_foreach_dest(I, d) {
|
||||
if (print_comma)
|
||||
fprintf(fp, ", ");
|
||||
else
|
||||
@@ -130,7 +130,7 @@ agx_print_instr(agx_instr *I, FILE *fp)
|
||||
agx_print_index(I->dest[d], false, fp);
|
||||
}
|
||||
|
||||
for (unsigned s = 0; s < I->nr_srcs; ++s) {
|
||||
agx_foreach_src(I, s) {
|
||||
if (print_comma)
|
||||
fprintf(fp, ", ");
|
||||
else
|
||||
|
@@ -333,10 +333,12 @@ agx_ra(agx_context *ctx)
|
||||
unsigned width = agx_size_align_16(agx_split_width(ins));
|
||||
|
||||
struct agx_copy copies[4];
|
||||
assert(ins->nr_dests <= ARRAY_SIZE(copies));
|
||||
|
||||
unsigned n = 0;
|
||||
|
||||
/* Move the sources */
|
||||
for (unsigned i = 0; i < 4; ++i) {
|
||||
agx_foreach_dest(ins, i) {
|
||||
if (agx_is_null(ins->dest[i])) continue;
|
||||
|
||||
copies[n++] = (struct agx_copy) {
|
||||
|
Reference in New Issue
Block a user