pan/bi: Sketch out instruction word packing

Instructions are 78-bits with some seriously suspicious packing
requirements but hey, gotta save 'em bits.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
This commit is contained in:
Alyssa Rosenzweig 2020-03-12 14:33:32 -04:00 committed by Marge Bot
parent 9269c85578
commit 50bce53cd0
2 changed files with 51 additions and 2 deletions

View File

@ -40,14 +40,60 @@ bi_pack_header(bi_clause *clause, bi_clause *next)
return u;
}
static unsigned
bi_pack_registers(bi_clause *clause, bi_bundle bundle)
{
/* TODO */
return 0;
}
static unsigned
bi_pack_fma(bi_clause *clause, bi_bundle bundle)
{
/* TODO */
return BIFROST_FMA_NOP;
}
static unsigned
bi_pack_add(bi_clause *clause, bi_bundle bundle)
{
/* TODO */
return BIFROST_ADD_NOP;
}
struct bi_packed_bundle {
uint64_t lo;
uint64_t hi;
};
static struct bi_packed_bundle
bi_pack_bundle(bi_clause *clause, bi_bundle bundle)
{
unsigned reg = bi_pack_registers(clause, bundle);
uint64_t fma = bi_pack_fma(clause, bundle);
uint64_t add = bi_pack_add(clause, bundle);
struct bi_packed_bundle packed = {
.lo = reg | (fma << 35) | ((add & 0b111111) << 58),
.hi = add >> 6
};
return packed;
}
static void
bi_pack_clause(bi_context *ctx, bi_clause *clause, bi_clause *next,
struct util_dynarray *emission)
{
struct bi_packed_bundle ins_1 = bi_pack_bundle(clause, clause->bundles[0]);
assert(clause->bundle_count == 1);
struct bifrost_fmt1 quad_1 = {
.tag = BIFROST_FMT1_FINAL,
.header = bi_pack_header(clause, next)
.header = bi_pack_header(clause, next),
.ins_1 = ins_1.lo,
.ins_2 = ins_1.hi & ((1 << 11) - 1),
.ins_0 = (ins_1.hi >> 11) & 0b111,
};
util_dynarray_append(emission, struct bifrost_fmt1, quad_1);

View File

@ -323,6 +323,9 @@ struct bifrost_branch {
/* Clause packing */
#define BIFROST_FMA_NOP (0x701960)
#define BIFROST_ADD_NOP (0x3D960)
struct bifrost_fmt1 {
unsigned ins_0 : 3;
unsigned tag : 5;