nak: copy late_algebraic iadd3 rules without the constant restriction

We can fold 32 bit immediates into iadd3, so we can do a bit better than
nir_opt_algebraic_late.

Totals:
CodeSize: 920980832 -> 920883040 (-0.01%); split: -0.01%, +0.00%
Number of GPRs: 3544248 -> 3544249 (+0.00%); split: -0.00%, +0.00%
Static cycle count: 168911080368 -> 168904975964 (-0.00%); split: -0.00%, +0.00%
Spills to reg: 67033 -> 67232 (+0.30%)
Fills from reg: 79665 -> 79733 (+0.09%)

Totals from 1351 (1.54% of 87622) affected shaders:
CodeSize: 33776080 -> 33678288 (-0.29%); split: -0.29%, +0.00%
Number of GPRs: 79967 -> 79968 (+0.00%); split: -0.02%, +0.02%
Static cycle count: 21002924361 -> 20996819957 (-0.03%); split: -0.03%, +0.00%
Spills to reg: 9324 -> 9523 (+2.13%)
Fills from reg: 10824 -> 10892 (+0.63%)

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36505>
This commit is contained in:
Karol Herbst 2025-07-31 23:18:34 +02:00 committed by Marge Bot
parent 0090637395
commit 431a9508a0

View file

@ -40,6 +40,9 @@ algebraic_lowering = [
(('umax', 'a', 'b'), ('bcsel', ('ult', a, b), b, a), volta),
(('iadd', 'a@64', ('ineg', 'b@64')), ('isub', a, b)),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', '#b'), 'c(is_not_const)'), ('iadd3', a, b, c)),
(('iadd', ('iadd(is_used_once)', 'a(is_not_const)', 'b(is_not_const)'), '#c'), ('iadd3', a, b, c)),
(('iadd(is_used_by_non_ldc_nv)', 'a@32', ('ishl', 'b@32', '#s@32')),
('lea_nv', a, b, s), 'nak->sm >= 70'),
(('iadd', 'a@64', ('ishl', 'b@64', '#s@32')),