summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-03 08:35:51 -0500
committerMarge Bot <[email protected]>2020-03-05 14:35:38 +0000
commit5896db957876c4dc1cd7ecb4e6eef44690b10530 (patch)
tree1aeb755529240439341cce6b4479848bd51fbf87 /src/panfrost
parentc70a198f24cbf5127d48673d96ad8f8153dbe729 (diff)
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/bifrost/bi_tables.c3
-rw-r--r--src/panfrost/bifrost/compiler.h11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
index 97244817301..5d3de06e222 100644
--- a/src/panfrost/bifrost/bi_tables.c
+++ b/src/panfrost/bifrost/bi_tables.c
@@ -33,7 +33,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_CMP] = BI_GENERIC | BI_MODS | BI_SCHED_ALL,
[BI_BLEND] = BI_ADD,
[BI_BITWISE] = BI_GENERIC | BI_SCHED_ALL,
- [BI_CONVERT] = BI_SCHED_ALL,
+ [BI_CONVERT] = BI_SCHED_ALL | BI_SWIZZLABLE,
[BI_CSEL] = BI_SCHED_FMA,
[BI_DISCARD] = BI_SCHED_ADD,
[BI_FMA] = BI_ROUNDMODE | BI_SCHED_FMA,
@@ -48,6 +48,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_STORE] = BI_SCHED_ADD,
[BI_STORE_VAR] = BI_SCHED_ADD,
[BI_SPECIAL] = BI_SCHED_ADD | BI_SCHED_SLOW,
+ [BI_SWIZZLE] = BI_SCHED_ALL | BI_SWIZZLABLE,
[BI_TEX] = BI_SCHED_ADD,
[BI_ROUND] = BI_GENERIC | BI_ROUNDMODE | BI_SCHED_ALL,
};
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 6eddf448ad7..5385f21d4b5 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -67,6 +67,7 @@ enum bi_class {
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 @@ extern unsigned bi_class_props[BI_NUM_CLASSES];
* 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 @@ typedef struct {
* 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) */