pco: port over to nir_op_ffma

It says fmad, but it's actually ffma.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Simon Perretta <simon.perretta@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41165>
This commit is contained in:
Karol Herbst 2026-04-24 16:32:22 +02:00 committed by Marge Bot
parent 255811703f
commit 5404b382fb
3 changed files with 8 additions and 5 deletions

View file

@ -40,6 +40,8 @@ static const struct spirv_to_nir_options spirv_options = {
static const nir_shader_compiler_options nir_options = {
.discard_is_demote = true,
.fuse_ffma32 = true,
.float_mul_add32 = nir_float_muladd_support_has_ffma |
nir_float_muladd_support_fuse,
.has_f2i32_rtne = true,
.has_fused_comp_and_csel = true,

View file

@ -1288,12 +1288,12 @@ static nir_def *alu_iter(nir_builder *b,
.component = component,
.io_semantics = io_semantics);
nir_def *result = nir_ffma_old(b,
nir_channel(b, coeffs, 1),
nir_channel(b, coords, 1),
nir_channel(b, coeffs, 2));
nir_def *result = nir_ffma_weak(b,
nir_channel(b, coeffs, 1),
nir_channel(b, coords, 1),
nir_channel(b, coeffs, 2));
result =
nir_ffma_old(b, nir_channel(b, coeffs, 0), nir_channel(b, coords, 0), result);
nir_ffma_weak(b, nir_channel(b, coeffs, 0), nir_channel(b, coords, 0), result);
return result;
}

View file

@ -3177,6 +3177,7 @@ static pco_instr *trans_alu(trans_ctx *tctx, nir_alu_instr *alu)
instr = pco_fmul(&tctx->b, dest, src[0], src[1]);
break;
case nir_op_ffma:
case nir_op_ffma_old:
instr = pco_fmad(&tctx->b, dest, src[0], src[1], src[2]);
break;