mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 16:48:07 +02:00
nir: handle fmul(a,a)/ffma(a,a,b) in nir_def_all_uses_ignore_sign_bit
Foz-DB Navi31: Totals from 436 (0.55% of 79395) affected shaders: Instrs: 808917 -> 805868 (-0.38%) CodeSize: 4269056 -> 4246512 (-0.53%) Latency: 5827077 -> 5819815 (-0.12%); split: -0.13%, +0.00% InvThroughput: 625482 -> 622959 (-0.40%); split: -0.41%, +0.00% SClause: 21797 -> 21756 (-0.19%); split: -0.23%, +0.04% Copies: 48502 -> 48505 (+0.01%); split: -0.04%, +0.05% VALU: 481686 -> 479074 (-0.54%); split: -0.54%, +0.00% SALU: 76699 -> 76700 (+0.00%) Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31844>
This commit is contained in:
parent
7e8a08ae77
commit
8f094a7762
1 changed files with 14 additions and 2 deletions
|
|
@ -1714,9 +1714,21 @@ nir_def_all_uses_ignore_sign_bit(const nir_def *def)
|
|||
return false;
|
||||
nir_instr *instr = nir_src_parent_instr(use);
|
||||
|
||||
if (instr->type != nir_instr_type_alu ||
|
||||
nir_instr_as_alu(instr)->op != nir_op_fabs)
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
return false;
|
||||
|
||||
nir_alu_instr *alu = nir_instr_as_alu(instr);
|
||||
if (alu->op == nir_op_fabs) {
|
||||
continue;
|
||||
} else if (alu->op == nir_op_fmul || alu->op == nir_op_ffma) {
|
||||
nir_alu_src *alu_src = list_entry(use, nir_alu_src, src);
|
||||
unsigned src_index = alu_src - alu->src;
|
||||
/* a * a doesn't care about sign of a. */
|
||||
if (src_index < 2 && nir_alu_srcs_equal(alu, alu, 0, 1))
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue