RETURN_PACKED(pack);
}
+static unsigned
+bi_pack_fma_1src(bi_instruction *ins, struct bi_registers *regs, unsigned op)
+{
+ struct bifrost_fma_inst pack = {
+ .src0 = bi_get_src(ins, regs, 0, true),
+ .op = op
+ };
+
+ RETURN_PACKED(pack);
+}
+
static unsigned
bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
case BI_FREXP:
case BI_ISUB:
case BI_MINMAX:
+ return BIFROST_FMA_NOP;
case BI_MOV:
+ return bi_pack_fma_1src(bundle.fma, regs, BIFROST_FMA_OP_MOV);
+ case BI_FMOV:
case BI_SHIFT:
case BI_SWIZZLE:
case BI_ROUND:
case BI_LOAD_VAR_ADDRESS:
case BI_MINMAX:
case BI_MOV:
+ case BI_FMOV:
case BI_SHIFT:
case BI_STORE:
case BI_STORE_VAR:
[BI_LOAD_VAR] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_DEST,
[BI_LOAD_VAR_ADDRESS] = BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
[BI_MINMAX] = BI_GENERIC | BI_SCHED_ALL,
- [BI_MOV] = BI_MODS | BI_SCHED_ALL,
+ [BI_MOV] = BI_SCHED_ALL,
+ [BI_FMOV] = BI_MODS | BI_SCHED_ALL,
[BI_SHIFT] = BI_SCHED_ALL,
[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,
BIFROST_SRC_PASS_ADD = 7,
};
+#define BIFROST_FMA_EXT (0xe0000)
+#define BIFROST_FMA_OP_MOV BIFROST_FMA_EXT | (0x32d)
+
struct bifrost_fma_inst {
unsigned src0 : 3;
unsigned op : 20;
case nir_op_fsat:
case nir_op_fneg:
case nir_op_fabs:
+ return BI_FMOV;
case nir_op_mov:
return BI_MOV;
alu.src[2] = BIR_INDEX_ZERO; /* FMA */
break;
case nir_op_fsat:
- alu.outmod = BIFROST_SAT; /* MOV */
+ alu.outmod = BIFROST_SAT; /* FMOV */
break;
case nir_op_fneg:
- alu.src_neg[0] = true; /* MOV */
+ alu.src_neg[0] = true; /* FMOV */
break;
case nir_op_fabs:
- alu.src_abs[0] = true; /* MOV */
+ alu.src_abs[0] = true; /* FMOV */
break;
case nir_op_fsub:
- alu.src_neg[1] = true; /* ADD */
+ alu.src_neg[1] = true; /* FADD */
break;
case nir_op_fmax:
case nir_op_imax:
BI_CSEL,
BI_DISCARD,
BI_FMA,
+ BI_FMOV,
BI_FREXP,
BI_ISUB,
BI_LOAD,