From 99152b6045791e368fff014858a935dffd5e8114 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 11 Dec 2020 19:57:39 -0500 Subject: [PATCH] pan/bi: Add bi_index data structure Rather than open-coding indices with manual bit packing flying around, let's add a data structure corresponding to a reference to some data. (Think nir_src, ibc_ref, etc). In particular this allows us to pack in more metadata, like an offset, for properly supporting limited vectors (for I/O) without bloating the IR with swizzle fields. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 9ff1ee2a76f..19216bc887a 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -391,6 +391,30 @@ enum bi_swizzle { BI_SWIZZLE_B0022 = 12, /* for b02 lanes */ }; +enum bi_index_type { + BI_INDEX_NULL = 0, + BI_INDEX_NORMAL = 1, + BI_INDEX_REGISTER = 2, + BI_INDEX_CONSTANT = 3, + BI_INDEX_PASS = 4, + BI_INDEX_FAU = 5 +}; + +typedef struct { + uint32_t value; + + /* modifiers, should only be set if applicable for a given instruction. + * For *IDP.v4i8, abs plays the role of sign. For bitwise ops where + * applicable, neg plays the role of not */ + bool abs : 1; + bool neg : 1; + + enum bi_swizzle swizzle : 4; + uint32_t offset : 2; + bool reg : 1; + enum bi_index_type type : 3; +} bi_index; + /* Represents the assignment of slots for a given bi_bundle */ typedef struct {