pan/bi: Add helper to extract a word from an index
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 14 Dec 2020 21:19:15 +0000 (16:19 -0500)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 23 Dec 2020 18:29:36 +0000 (13:29 -0500)
This pattern comes up surprisingly often due to the prevalance of
vectors.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8215>

src/panfrost/bifrost/compiler.h

index 0d952eb..7e203a3 100644 (file)
@@ -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)
 {