}
}
+static unsigned
+bi_pack_add_imath(bi_instruction *ins, struct bi_registers *regs)
+{
+ /* TODO: 32+16 add */
+ assert(ins->src_types[0] == ins->src_types[1]);
+ unsigned sz = nir_alu_type_get_type_size(ins->src_types[0]);
+ enum bi_imath_op p = ins->op.imath;
+
+ unsigned op = 0;
+
+ if (sz == 8) {
+ op = (p == BI_IMATH_ADD) ? BIFROST_ADD_IADD_8 :
+ BIFROST_ADD_ISUB_8;
+ } else if (sz == 16) {
+ op = (p == BI_IMATH_ADD) ? BIFROST_ADD_IADD_16 :
+ BIFROST_ADD_ISUB_16;
+ } else if (sz == 32) {
+ op = (p == BI_IMATH_ADD) ? BIFROST_ADD_IADD_32 :
+ BIFROST_ADD_ISUB_32;
+ } else {
+ unreachable("64-bit todo");
+ }
+
+ return bi_pack_add_2src(ins, regs, op);
+}
+
static unsigned
bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
case BI_DISCARD:
return bi_pack_add_discard(bundle.add, regs);
case BI_FREXP:
+ unreachable("Packing todo");
case BI_IMATH:
+ return bi_pack_add_imath(bundle.add, regs);
case BI_LOAD:
unreachable("Packing todo");
case BI_LOAD_ATTR:
#define BIFROST_ADD_OP_LD_UBO_4 (0x0c220 >> 3)
#define BIFROST_ADD_SEL_16(swiz) ((0xea60 >> 3) | (swiz))
+#define BIFROST_ADD_IADD_8 (0x17880 >> 3)
+#define BIFROST_ADD_IADD_16 (0x17900 >> 3)
+#define BIFROST_ADD_IADD_32 (0x178c0 >> 3)
+#define BIFROST_ADD_ISUB_8 (0x17a80 >> 3)
+#define BIFROST_ADD_ISUB_16 (0x17b00 >> 3)
+#define BIFROST_ADD_ISUB_32 (0x17ac0 >> 3)
+
struct bifrost_add_2src {
unsigned src0 : 3;
unsigned src1 : 3;