diff --git a/src/compiler/nir/nir_builder_opcodes_h.py b/src/compiler/nir/nir_builder_opcodes_h.py index f577e2c596e..ffbc9245c4e 100644 --- a/src/compiler/nir/nir_builder_opcodes_h.py +++ b/src/compiler/nir/nir_builder_opcodes_h.py @@ -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 diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 6a0e65fbfb6..2cf55f5b3f8 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -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. diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index 497103e1e39..31cb16de822 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -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]);