pan/bi: Add strip_index helper
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 23 Jul 2021 18:34:22 +0000 (14:34 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 28 Jul 2021 00:26:06 +0000 (00:26 +0000)
Needed to correctly lower sources to moves, used in the FAU lowering.
Technically, the issue is already present on Bifrost, but it's hidden
because Bifrost packing doesn't validate the absense of unsupported
modifiers. Valhall packing adds more safety, which caught this issue.

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

src/panfrost/bifrost/compiler.h

index f983815..f93907e 100644 (file)
@@ -236,6 +236,20 @@ bi_replace_index(bi_index old, bi_index replacement)
         return replacement;
 }
 
+/* Remove any modifiers. This has the property:
+ *
+ *     replace_index(x, strip_index(x)) = x
+ *
+ * This ensures it is suitable to use when lowering sources to moves */
+
+static inline bi_index
+bi_strip_index(bi_index index)
+{
+        index.abs = index.neg = false;
+        index.swizzle = BI_SWIZZLE_H01;
+        return index;
+}
+
 /* For bitwise instructions */
 #define bi_not(x) bi_neg(x)