Only on supported GPUs at the moment; for older Bifrost that don't
support these, I'm not sure yet where the right place to do the lowering
is. NIR algebraic rules would be "nice" but probably impractical -- but
it wouldn't be hard to do it directly in BIR (as a lowering pass or
alternative implementation).
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>
case nir_op_mov:
return BI_MOV;
+ case nir_op_frcp:
+ case nir_op_frsq:
+ case nir_op_fsin:
+ case nir_op_fcos:
+ return BI_SPECIAL;
+
default:
unreachable("Unknown ALU op");
}
| nir_dest_bit_size(instr->dest.dest),
};
+ /* TODO: Implement lowering of special functions for older Bifrost */
+ assert((alu.type != BI_SPECIAL) || !(ctx->quirks & BIFROST_NO_FAST_OP));
+
if (instr->dest.dest.is_ssa) {
/* Construct a writemask */
unsigned bits_per_comp = instr->dest.dest.ssa.bit_size;
case nir_op_umax:
alu.op.minmax = BI_MINMAX_MAX; /* MINMAX */
break;
+ case nir_op_frcp:
+ alu.op.special = BI_SPECIAL_FRCP;
+ break;
+ case nir_op_frsq:
+ alu.op.special = BI_SPECIAL_FRSQ;
+ break;
+ case nir_op_fsin:
+ alu.op.special = BI_SPECIAL_FSIN;
+ break;
+ case nir_op_fcos:
+ alu.op.special = BI_SPECIAL_FCOS;
+ break;
default:
break;
}