pan/bi: Add swizzles
Requires a new field on bifrost_instruction, as well as a new class
property and a new class for the dedicated swizzle ops.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 6eddf44..5385f21 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -67,6 +67,7 @@
BI_STORE,
BI_STORE_VAR,
BI_SPECIAL, /* _FAST, _TABLE on supported GPUs */
+ BI_SWIZZLE,
BI_TEX,
BI_ROUND,
BI_NUM_CLASSES
@@ -99,6 +100,9 @@
* nopped out. Used for _FAST operations. */
#define BI_SCHED_SLOW (1 << 5)
+/* Swizzling allowed for the 8/16-bit source */
+#define BI_SWIZZLABLE (1 << 6)
+
/* It can't get any worse than csel4... can it? */
#define BIR_SRC_COUNT 4
@@ -171,6 +175,13 @@
* int). Zero if there is no destination. Bitsize included */
nir_alu_type dest_type;
+ /* If the source type is 8-bit or 16-bit such that SIMD is possible, and
+ * the class has BI_SWIZZLABLE, this is a swizzle for the input. Swizzles
+ * in practice only occur with one-source arguments (conversions,
+ * dedicated swizzle ops) and as component selection on two-sources
+ * where it is unambiguous which is which. Bounds are 32/type_size. */
+ unsigned swizzle[4];
+
/* A class-specific op from which the actual opcode can be derived
* (along with the above information) */