return bi_pack_fma_1src(ins, regs, op);
}
-
+
+static unsigned
+bi_pack_fma_imath(bi_instruction *ins, struct bi_registers *regs)
+{
+ /* Scheduler: only ADD can have 8/16-bit imath */
+ assert(ins->dest_type == nir_type_int32 || ins->dest_type == nir_type_uint32);
+
+ unsigned op = ins->op.imath == BI_IMATH_ADD
+ ? BIFROST_FMA_IADD_32
+ : BIFROST_FMA_ISUB_32;
+
+ return bi_pack_fma_2src(ins, regs, op);
+}
+
static unsigned
bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
case BI_FREXP:
return bi_pack_fma_frexp(bundle.fma, regs);
case BI_IMATH:
- unreachable("Packing todo");
+ return bi_pack_fma_imath(bundle.fma, regs);
case BI_MINMAX:
return bi_pack_fma_addmin(bundle.fma, regs);
case BI_MOV:
unsigned op : 20;
} __attribute__((packed));
+#define BIFROST_FMA_IADD_32 (0x4ff98 >> 3)
+#define BIFROST_FMA_ISUB_32 (0x4ffd8 >> 3)
+
struct bifrost_fma_2src {
unsigned src0 : 3;
unsigned src1 : 3;