pan/bi: Unwrap BRANCH into CONDITIONAL class
We can simplify the IR considerably and unify more conditions, which
gives conditional discard for free.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4883>
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index e438a58..16f44ff 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -86,7 +86,8 @@
/* abs/neg/outmod valid for a float op */
#define BI_MODS (1 << 0)
-/* bit 1 unused */
+/* Accepts a bi_cond */
+#define BI_CONDITIONAL (1 << 1)
/* Accepts a bifrost_roundmode */
#define BI_ROUNDMODE (1 << 2)
@@ -154,15 +155,6 @@
BI_COND_NE,
};
-struct bi_branch {
- /* Types are specified in src_types and must be compatible (either both
- * int, or both float, 16/32, and same size or 32/16 if float. Types
- * ignored if BI_COND_ALWAYS is set for an unconditional branch. */
-
- enum bi_cond cond;
- struct bi_block *target;
-};
-
/* Opcodes within a class */
enum bi_minmax_op {
BI_MINMAX_MIN,
@@ -270,6 +262,9 @@
/* For VECTOR ops, how many channels are written? */
unsigned vector_channels;
+ /* The comparison op. BI_COND_ALWAYS may not be valid. */
+ enum bi_cond cond;
+
/* A class-specific op from which the actual opcode can be derived
* (along with the above information) */
@@ -290,11 +285,7 @@
union {
enum bifrost_minmax_mode minmax;
struct bi_load_vary load_vary;
- struct bi_branch branch;
-
- /* For CSEL, the comparison op. BI_COND_ALWAYS doesn't make
- * sense here but you can always just use a move for that */
- enum bi_cond cond;
+ struct bi_block *branch_target;
/* For BLEND -- the location 0-7 */
unsigned blend_location;