agx: Implement nir_op_pack_64_2x32_split

This maps to a collect where the dest size is 64 and the src size is 32.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19971>
This commit is contained in:
Alyssa Rosenzweig
2022-11-19 15:07:52 -05:00
committed by Marge Bot
parent 68e25f33da
commit 442e29890d
2 changed files with 13 additions and 3 deletions
+6
View File
@@ -1088,6 +1088,12 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
return agx_convert_to(b, dst, agx_immediate(mode), s0, AGX_ROUND_RTE);
}
case nir_op_pack_64_2x32_split:
{
agx_index idx[] = { s0, s1 };
return agx_emit_collect_to(b, dst, 2, idx);
}
/* Split a 64-bit word into 32-bit parts. Do not use null destinations to
* let us CSE (and coalesce) the splits when both x and y are split.
*/
+7 -3
View File
@@ -61,7 +61,7 @@ agx_write_registers(agx_instr *I, unsigned d)
case AGX_OPCODE_LDCF:
return 6;
case AGX_OPCODE_COLLECT:
return I->nr_srcs * size;
return I->nr_srcs * agx_size_align_16(I->src[0].size);
default:
return size;
}
@@ -178,6 +178,10 @@ pick_regs(struct ra_ctx *rctx, agx_instr *I, unsigned d)
if (base >= rctx->bound || (base + count) > rctx->bound)
continue;
/* Unaligned destinations can happen when dest size > src size */
if (base % align)
continue;
if (!BITSET_TEST_RANGE(rctx->used_regs, base, base + count - 1))
return base;
}
@@ -424,7 +428,7 @@ agx_ra(agx_context *ctx)
if (ins->op == AGX_OPCODE_COLLECT) {
assert(ins->dest[0].type == AGX_INDEX_REGISTER);
unsigned base = ins->dest[0].value;
unsigned width = agx_size_align_16(ins->dest[0].size);
unsigned width = agx_size_align_16(ins->src[0].size);
struct agx_copy *copies = alloca(sizeof(copies[0]) * ins->nr_srcs);
unsigned n = 0;
@@ -432,7 +436,7 @@ agx_ra(agx_context *ctx)
/* Move the sources */
agx_foreach_src(ins, i) {
if (agx_is_null(ins->src[i])) continue;
assert(ins->src[i].size == ins->dest[0].size);
assert(ins->src[i].size == ins->src[0].size);
copies[n++] = (struct agx_copy) {
.dest = base + (i * width),