pan/bi: Split special class in two

Some special instructions are scheduled on the FMA unit, let's add a
new class for this case and rename the old one accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index fbf7bcb..044452d 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -872,7 +872,7 @@
                 }
         case BI_STORE_VAR:
                 return pan_pack_add_st_cvt(clause, bundle.add, regs);
-        case BI_SPECIAL:
+        case BI_SPECIAL_ADD:
                 return bi_pack_add_special(clause, bundle.add, regs);
         case BI_TABLE:
                 assert(bundle.add->dest_type == nir_type_float32);
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index 447f899..ea0b61a 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -68,7 +68,8 @@
         case BI_SELECT: return "select";
         case BI_STORE: return "store";
         case BI_STORE_VAR: return "store_var";
-        case BI_SPECIAL: return "special";
+        case BI_SPECIAL_ADD: return "special";
+        case BI_SPECIAL_FMA: return "special";
         case BI_TABLE: return "table";
         case BI_TEXS: return "texs";
         case BI_TEXC: return "texc";
@@ -256,7 +257,7 @@
                 fprintf(fp, "%s", bi_bitwise_op_name(ins->op.bitwise));
         else if (ins->type == BI_IMATH)
                 fprintf(fp, "%s", bi_imath_op_name(ins->op.imath));
-        else if (ins->type == BI_SPECIAL)
+        else if (ins->type == BI_SPECIAL_ADD || ins->type == BI_SPECIAL_FMA)
                 fprintf(fp, "%s", bi_special_op_name(ins->op.special));
         else if (ins->type == BI_TABLE)
                 fprintf(fp, "%s", bi_table_op_name(ins->op.table));
diff --git a/src/panfrost/bifrost/bi_special.c b/src/panfrost/bifrost/bi_special.c
index 16e4d2e..13ce3ab 100644
--- a/src/panfrost/bifrost/bi_special.c
+++ b/src/panfrost/bifrost/bi_special.c
@@ -76,7 +76,7 @@
         /* FEXP2_FAST T, T, X */
 
         bi_instruction fexp = {
-                .type = BI_SPECIAL,
+                .type = BI_SPECIAL_ADD,
                 .op = { .special = BI_SPECIAL_EXP2_LOW },
                 .dest = pan_dest_index(&instr->dest.dest),
                 .dest_type = nir_type_float32,
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
index 19352e5..2617861 100644
--- a/src/panfrost/bifrost/bi_tables.c
+++ b/src/panfrost/bifrost/bi_tables.c
@@ -52,7 +52,8 @@
         [BI_REDUCE_FMA]         = BI_SCHED_FMA,
         [BI_STORE] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_SRC,
         [BI_STORE_VAR] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_SRC,
-        [BI_SPECIAL] 		= BI_SCHED_ADD | BI_SCHED_SLOW,
+        [BI_SPECIAL_ADD]	= BI_SCHED_ADD | BI_SCHED_SLOW,
+        [BI_SPECIAL_FMA]	= BI_SCHED_FMA | BI_SCHED_SLOW,
         [BI_TABLE]              = BI_SCHED_ADD,
         [BI_SELECT]             = BI_SCHED_ALL | BI_SWIZZLABLE,
         [BI_TEXS] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index c2aa43d..5ecfe7d 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -836,7 +836,7 @@
         case nir_op_frcp:
         case nir_op_frsq:
         case nir_op_iabs:
-                return BI_SPECIAL;
+                return BI_SPECIAL_ADD;
 
         default:
                 unreachable("Unknown ALU op");
@@ -984,7 +984,7 @@
         };
 
         /* TODO: Implement lowering of special functions for older Bifrost */
-        assert((alu.type != BI_SPECIAL) || !(ctx->quirks & BIFROST_NO_FAST_OP));
+        assert(alu.type != BI_SPECIAL_ADD || !(ctx->quirks & BIFROST_NO_FAST_OP));
 
         unsigned comps = nir_dest_num_components(instr->dest.dest);
         bool vector = comps > MAX2(1, 32 / nir_dest_bit_size(instr->dest.dest));
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index 176f7fd..1cb936cf 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -73,7 +73,8 @@
         BI_SELECT,
         BI_STORE,
         BI_STORE_VAR,
-        BI_SPECIAL, /* _FAST on supported GPUs */
+        BI_SPECIAL_ADD, /* _FAST on supported GPUs */
+        BI_SPECIAL_FMA, /* _FAST on supported GPUs */
         BI_TABLE,
         BI_TEXS,
         BI_TEXC,
diff --git a/src/panfrost/bifrost/test/bi_interpret.c b/src/panfrost/bifrost/test/bi_interpret.c
index bc2aa32..b975a1d 100644
--- a/src/panfrost/bifrost/test/bi_interpret.c
+++ b/src/panfrost/bifrost/test/bi_interpret.c
@@ -582,7 +582,8 @@
                 break;
         }
 
-        case BI_SPECIAL: {
+        case BI_SPECIAL_FMA:
+        case BI_SPECIAL_ADD: {
                 assert(nir_alu_type_get_base_type(ins->dest_type) == nir_type_float);
                 assert(ins->dest_type != nir_type_float64);
 
diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c
index e955779..a564689 100644
--- a/src/panfrost/bifrost/test/bi_test_pack.c
+++ b/src/panfrost/bifrost/test/bi_test_pack.c
@@ -295,7 +295,7 @@
 bit_special_helper(struct panfrost_device *dev,
                 unsigned size, uint32_t *input, enum bit_debug debug)
 {
-        bi_instruction ins = bit_ins(BI_SPECIAL, 2, nir_type_float, size);
+        bi_instruction ins = bit_ins(BI_SPECIAL_ADD, 2, nir_type_float, size);
         uint32_t exp_input[4];
 
         for (enum bi_special_op op = BI_SPECIAL_FRCP; op <= BI_SPECIAL_EXP2_LOW; ++op) {