return bi_pack_add_1src(ins, regs, BIFROST_ADD_CONVERT | op);
}
+static unsigned
+bi_pack_fma_select(bi_instruction *ins, struct bi_registers *regs)
+{
+ unsigned size = nir_alu_type_get_type_size(ins->src_types[0]);
+
+ if (size == 16) {
+ unsigned swiz = (ins->swizzle[0][0] | (ins->swizzle[1][0] << 1));
+ unsigned op = BIFROST_FMA_SEL_16(swiz);
+ return bi_pack_fma_2src(ins, regs, op);
+ } else {
+ unreachable("Unimplemented");
+ }
+}
+
static unsigned
bi_pack_fma(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
{
case BI_MOV:
return bi_pack_fma_1src(bundle.fma, regs, BIFROST_FMA_OP_MOV);
case BI_SHIFT:
+ return BIFROST_FMA_NOP;
case BI_SELECT:
+ return bi_pack_fma_select(bundle.fma, regs);
case BI_ROUND:
return BIFROST_FMA_NOP;
case BI_REDUCE_FMA:
#define BIFROST_FMA_OP_MOV BIFROST_FMA_EXT | (0x32d)
#define BIFROST_FMA_OP_FREXPE_LOG BIFROST_FMA_EXT | 0x3c5
#define BIFROST_FMA_OP_ADD_FREXPM ((BIFROST_FMA_EXT | 0x1e80) >> 3)
+#define BIFROST_FMA_SEL_16(swiz) (((BIFROST_FMA_EXT | 0x1e00) >> 3) | (swiz))
struct bifrost_fma_inst {
unsigned src0 : 3;
#define BIFROST_ADD_OP_LD_UBO_2 (0x0c1e0 >> 3)
#define BIFROST_ADD_OP_LD_UBO_3 (0x0caa0 >> 3)
#define BIFROST_ADD_OP_LD_UBO_4 (0x0c220 >> 3)
+#define BIFROST_ADD_SEL_16(swiz) ((0xea60 >> 3) | (swiz))
struct bifrost_add_2src {
unsigned src0 : 3;