pan/midgard: Add helper to pack load/store registers

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-08-01 14:14:43 -07:00
parent e112d9d333
commit 1a116037d8
1 changed files with 18 additions and 0 deletions

View File

@ -340,4 +340,22 @@ mir_is_simple_swizzle(unsigned swizzle, unsigned mask)
return true;
}
/* Packs a load/store argument */
static inline uint8_t
midgard_ldst_reg(unsigned reg, unsigned component)
{
assert(reg == REGISTER_LDST_BASE || (reg == REGISTER_LDST_BASE + 1));
midgard_ldst_register_select sel = {
.component = component,
.select = reg - 26
};
uint8_t packed;
memcpy(&packed, &sel, sizeof(packed));
return packed;
}
#endif