r600,sfn: support new multadd opcodes

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 01:52:26 +02:00 committed by Marge Bot
parent eec83fd9f6
commit 89868d37ce
4 changed files with 9 additions and 2 deletions

View file

@ -1087,6 +1087,9 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen,
.fuse_ffma16 = true,
.fuse_ffma32 = true,
.fuse_ffma64 = true,
.float_mul_add16 = nir_float_muladd_support_has_fmad | nir_float_muladd_support_fuse,
.float_mul_add32 = nir_float_muladd_support_has_fmad | nir_float_muladd_support_fuse,
.float_mul_add64 = nir_float_muladd_support_has_ffma | nir_float_muladd_support_fuse,
.lower_flrp32 = true,
.lower_flrp64 = true,
.lower_fdiv = true,

View file

@ -1639,6 +1639,7 @@ AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
return emit_alu_op2_64bit_one_dst(*alu, op2_setgt_64, shader, true);
case nir_op_fneu32:
return emit_alu_op2_64bit_one_dst(*alu, op2_setne_64, shader, false);
case nir_op_ffma:
case nir_op_ffma_old:
return emit_alu_fma_64bit(*alu, op3_fma_64, shader);
@ -1956,10 +1957,12 @@ AluInstr::from_nir(nir_alu_instr *alu, Shader& shader)
case nir_op_unpack_64_2x32_split_y:
return emit_unpack_64_2x32_split(*alu, 1, shader);
case nir_op_fmad:
case nir_op_ffma_old:
if (!shader.has_flag(Shader::sh_legacy_math_rules))
return emit_alu_op3(*alu, op3_muladd_ieee, shader);
FALLTHROUGH;
case nir_op_fmadz:
case nir_op_ffmaz_old:
return emit_alu_op3(*alu, op3_muladd, shader);

View file

@ -1033,6 +1033,7 @@ Lower64BitToVec2::support_fp64_op(nir_op op) const
case nir_op_fge32:
case nir_op_flt32:
case nir_op_fneu32:
case nir_op_ffma:
case nir_op_ffma_old:
case nir_op_fadd:
case nir_op_fmul:

View file

@ -257,7 +257,7 @@ r600_nir_lower_cube_to_2darray_impl(nir_builder *b, nir_instr *instr, void *_opt
auto cubed = nir_cube_amd(b,
nir_trim_vector(b, tex->src[coord_idx].src.ssa, 3));
auto xy = nir_fmad_old(b,
auto xy = nir_fmad(b,
nir_vec2(b, nir_channel(b, cubed, 1), nir_channel(b, cubed, 0)),
nir_frcp(b, nir_fabs(b, nir_channel(b, cubed, 2))),
nir_imm_float(b, 1.5));
@ -266,7 +266,7 @@ r600_nir_lower_cube_to_2darray_impl(nir_builder *b, nir_instr *instr, void *_opt
if (tex->is_array && tex->op != nir_texop_lod) {
auto slice = nir_fround_even(b, nir_channel(b, tex->src[coord_idx].src.ssa, 3));
z =
nir_fmad_old(b, nir_fmax(b, slice, nir_imm_float(b, 0.0)), nir_imm_float(b, 8.0), z);
nir_fmad(b, nir_fmax(b, slice, nir_imm_float(b, 0.0)), nir_imm_float(b, 8.0), z);
}
if (tex->op == nir_texop_txd) {