diff options
author | Alyssa Rosenzweig <[email protected]> | 2020-03-12 14:33:32 -0400 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-03-19 03:23:07 +0000 |
commit | 50bce53cd0c44db531b37cb37426e3b087c788da (patch) | |
tree | d2332bcfb5d104aac557f7a8e3c75d4df7fc00c1 /src/panfrost | |
parent | 9269c85578bd68169681efad0fb2a3563eb280ab (diff) |
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4242>
Diffstat (limited to 'src/panfrost')
-rw-r--r-- | src/panfrost/bifrost/bi_pack.c | 50 | ||||
-rw-r--r-- | src/panfrost/bifrost/bifrost.h | 3 |
2 files changed, 51 insertions, 2 deletions
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 016046bcda0..f59440192d4 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -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); diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h index 959c951e582..803abe804f9 100644 --- a/src/panfrost/bifrost/bifrost.h +++ b/src/panfrost/bifrost/bifrost.h @@ -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; |