nir: add fp_math_ctrl as intrinsic index

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40630>
This commit is contained in:
Georg Lehmann 2026-03-25 14:23:30 +01:00 committed by Marge Bot
parent d2be2fd4c1
commit 854911aeab
3 changed files with 16 additions and 0 deletions

View file

@ -159,6 +159,10 @@ _nir_build_${name}(nir_builder *build${intrinsic_decl_list(opcode)})
if (!indices.src_type)
indices.src_type = (nir_alu_type)(nir_type_float | src0->bit_size);
% endif
% if FP_MATH_CTRL in opcode.indices:
if (!indices.fp_math_ctrl)
indices.fp_math_ctrl = build->fp_math_ctrl;
% endif
% for index in opcode.indices:
nir_intrinsic_set_${index.name}(intrin, indices.${index.name});
% endfor

View file

@ -388,6 +388,9 @@ index("unsigned", "num_matrices")
# Register class for load/store_preamble
index("nir_preamble_class", "preamble_class")
# Like nir_alu_instr::fp_math_ctrl, but for intrinsics
index("unsigned", "fp_math_ctrl")
intrinsic("nop", flags=[CAN_ELIMINATE])
# Uses a value and cannot be eliminated.

View file

@ -1811,6 +1811,15 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
break;
}
case NIR_INTRINSIC_FP_MATH_CTRL: {
unsigned fp_math_ctrl = nir_intrinsic_fp_math_ctrl(instr);
if (fp_math_ctrl)
print_fp_math_ctrl(fp_math_ctrl, state);
else
fprintf(fp, "fp-fast-math");
break;
}
default: {
unsigned off = info->index_map[idx] - 1;
fprintf(fp, "%s=%d", nir_intrinsic_index_names[idx], instr->const_index[off]);