r300: port over to nir_op_fmad

r300 doesn't advertise any fp64 support, so let's not set float_mul_add64
despite fuse_ffma64 being set.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41165>
This commit is contained in:
Karol Herbst 2026-04-24 16:13:11 +02:00 committed by Marge Bot
parent 89868d37ce
commit 5eb7d7d63b
3 changed files with 10 additions and 6 deletions

View file

@ -819,6 +819,7 @@ ntr_emit_alu(struct ntr_compile *c, nir_alu_instr *instr)
[nir_op_fmin] = TGSI_OPCODE_MIN,
[nir_op_fmax] = TGSI_OPCODE_MAX,
[nir_op_fmad] = TGSI_OPCODE_MAD,
[nir_op_ffma_old] = TGSI_OPCODE_MAD,
};

View file

@ -52,11 +52,11 @@ r300_nir_prepare_presubtract = [
(('fadd', a, -1.0), ('fneg', ('fadd', 1.0, ('fneg', a)))),
(('fadd', -1.0, a), ('fneg', ('fadd', 1.0, ('fneg', a)))),
# Bias presubtract 1 - 2 * x expects MAD -a 2.0 1.0 form.
(('ffma_old', 2.0, ('fneg', a), 1.0), ('ffma_old', ('fneg', a), 2.0, 1.0)),
(('ffma_old', a, -2.0, 1.0), ('ffma_old', ('fneg', a), 2.0, 1.0)),
(('ffma_old', -2.0, a, 1.0), ('ffma_old', ('fneg', a), 2.0, 1.0)),
(('ffma_old', 2.0, a, -1.0), ('fneg', ('ffma_old', ('fneg', a), 2.0, 1.0))),
(('ffma_old', a, 2.0, -1.0), ('fneg', ('ffma_old', ('fneg', a), 2.0, 1.0))),
(('fmad', 2.0, ('fneg', a), 1.0), ('fmad', ('fneg', a), 2.0, 1.0)),
(('fmad', a, -2.0, 1.0), ('fmad', ('fneg', a), 2.0, 1.0)),
(('fmad', -2.0, a, 1.0), ('fmad', ('fneg', a), 2.0, 1.0)),
(('fmad', 2.0, a, -1.0), ('fneg', ('fmad', ('fneg', a), 2.0, 1.0))),
(('fmad', a, 2.0, -1.0), ('fneg', ('fmad', ('fneg', a), 2.0, 1.0))),
# x * 2 can be usually folded into output modifier for the previous
# instruction, but that only works if x is a temporary. If it is input or
# constant just convert it to add instead.
@ -85,7 +85,7 @@ r300_nir_opt_algebraic_late = [
# This is very late flrp lowering to clean up after bcsel->fcsel->flrp.
r300_nir_lower_flrp = [
(('flrp', a, b, c), ('ffma_old', b, c, ('ffma_old', ('fneg', a), c, a)))
(('flrp', a, b, c), ('fmad', b, c, ('fmad', ('fneg', a), c, a)))
]
# Lower fcsel_ge from ftrunc on r300

View file

@ -107,6 +107,9 @@ static struct disk_cache* r300_get_disk_shader_cache(struct pipe_screen* pscreen
.fdot_replicates = true, \
.fuse_ffma32 = true, \
.fuse_ffma64 = true, \
.float_mul_add32 = \
nir_float_muladd_support_has_fmad | \
nir_float_muladd_support_fuse, \
.lower_bitops = true, \
.lower_extract_byte = true, \
.lower_extract_word = true, \