nouveau/nir: Implement mul_zero_wins behavior for use_legacy_math_rules.

This is the same flag TGSI sets for LEGACY_MATH_RULES.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Tested-by: Mobin Aydinfar <mobin@mobintestserver.ir>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16176>
This commit is contained in:
Emma Anholt 2022-04-26 13:39:28 -07:00 committed by Marge Bot
parent a05bfff8cb
commit 1e2e52eff7
1 changed files with 12 additions and 0 deletions

View File

@ -997,6 +997,7 @@ bool Converter::assignSlots() {
unsigned index;
info->io.viewportId = -1;
info->io.mul_zero_wins = nir->info.use_legacy_math_rules;
info_out->numInputs = 0;
info_out->numOutputs = 0;
info_out->numSysVals = 0;
@ -2585,6 +2586,17 @@ Converter::visit(nir_alu_instr *insn)
Instruction *i = mkOp(getOperation(op), dType, newDefs[0]);
for (unsigned s = 0u; s < info.num_inputs; ++s) {
i->setSrc(s, getSrc(&insn->src[s]));
if (this->info->io.mul_zero_wins) {
switch (op) {
case nir_op_fmul:
case nir_op_ffma:
i->dnz = true;
break;
default:
break;
}
}
}
i->subOp = getSubOp(op);
}