From 903a818f33e713b66317fbe2fc588475bf0db6ab Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 14 Dec 2020 16:19:15 -0500 Subject: [PATCH] pan/bi: Add helper to extract a word from an index This pattern comes up surprisingly often due to the prevalance of vectors. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 0d952eb..7e203a3 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -471,6 +471,14 @@ bi_passthrough(enum bifrost_packed_src value) }; } +/* Extracts a word from a vectored index */ +static inline bi_index +bi_word(bi_index idx, unsigned component) +{ + idx.offset += component; + return idx; +} + static inline bool bi_is_null(bi_index idx) { -- 2.7.4