From 1a116037d831da36b872e5739c445bce3964400d Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 1 Aug 2019 14:14:43 -0700 Subject: [PATCH] pan/midgard: Add helper to pack load/store registers Signed-off-by: Alyssa Rosenzweig --- src/panfrost/midgard/helpers.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/panfrost/midgard/helpers.h b/src/panfrost/midgard/helpers.h index 9d04b057126..c44783e3d68 100644 --- a/src/panfrost/midgard/helpers.h +++ b/src/panfrost/midgard/helpers.h @@ -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 -- 2.30.2